Testing your Environment In PHP

While there’s nothing wrong with getting started writing PHP scripts sing no-frills editors such as Windows Notepad or vi, chances are you’re soon going to want to graduate to a full-fledged PHP-specific development solution. Several open source and commercial solutions are available.

The best way to verify your PHP installation is by attempting to execute a PHP script.

Open a text editor and add the following lines to a new file:


If you’re running Apache, save the file within the htdocs directory as phpinfo.php.

Note: from now onwards this tutorial will use XAMPP from Apache Friends for development. You can still use Apache, but if you are having any problem configuring it, just uninstall Apache and install XAMPP. XAMPP is easy to install, no manual configuration required, and all components installed in one go (Apache + MySQL + PHP + phpMyAdmin).

If you’re running IIS, save the file within C:\inetpub\wwwroot\.

Now open a browser and access this file by entering the following URL: http://localhost/phpinfo.php.

If all goes well, you should see output similar to that shown in Figure below:


The page above contains a lot of information related to your environment, such as: PHP core Configuration info, apache2handler info, Apache Environment info etc.


If you’re attempting to run this script on a Web hosting provider’s server, and you receive an error message stating phpinfo() has been disabled for security reasons, you’ll need to try Testing Your Installation executing another script.

Try executing this one instead, which should produce some simple output:

echo “A simple but effective PHP test!”;

Scroll to Top