Lesson 00 - Is PHP available?
Features
It seems like a silly question, but not every web hosting company has made PHP available to all their customers. It is easy to test PHP availability using the phpinfo function.
Actions
 |
Click to see phpinfo.php in action on this tutorial site. |
Download this file: phpinfo.txt, change the extension to .php and upload it to your website.
Surf to the phpinfo.php file on your website with your browser. You should see results similar to the image on the right.
|

Click here to see a larger image |
Gotchas
WARNING: Do not rename the file to phpinfo.phps. phps files tell PHP to show the source code instead of executing the code.
If you see the source code with your browser or you get an error message, PHP is not installed on your webserver. Your next step is to call your web hosting company.
Source Code
If PHP is installed on your webserver, then download this file: phpinfo.txt to your PC. Change the file extension to .phps and upload the file to your webserver. View the file with your browser and you should see code identical to that shown below.
| |
<html>
<head>
<title>Test phpinfo</title>
</head>
<body>
<?php
/* Show all information, defaults to INFO_ALL */
phpinfo();
?>
</body>
</html>
|
This code is very simple. Only one function, phpinfo, is called.
Final Thoughts
If all went well, then you have learned three things:
- PHP is installed on your webserver.
- Your first PHP function: phpinfo().
- That files with an extension of .phps allow you to view the PHP source code with your browser.
|