A great way to test PHP is by creating a PHPInfo page.
This is a simple page that displays PHP settings and easily proves if PHP is working or if a specific feature is install or should be working on PHP.

We’ve made a simple tutorial with images to make it easy to get started using this nifty file.

  1. Create a new empty phpinfo.php file
    In Windows you can do this by opening notepad and going to “Save As”

    Browse to a folder of your choice or the desktop, select “All Files (*.*)” in the Save as type drop down and enter the filename as “phpinfo.php”, and click save:
  2. In the file enter the following:
    <?php
    phpinfo();
  3. Save the file
  4. Now we need to load the file to your website, you can normally do this by using an FTP client like FileZilla or if your working locally just copy the file to the website folder.
  5. Go to your browser and navigate to the file. EG http://myfancynewsite.com/phpinfo.php
  6. Confirm that a page like below shows up.

 

Hopefully at this point you’ve got PHPInfo working, scroll through the page and you will see a lot of different details regarding your PHP installation.

If your using a special module/extension or need to confirm it is installed on your server this is a great way to do so.

Warning: It’s not recommended to leave this file around on the website, this will provide a potential attacker with a lot of information regarding your server and host. After confirming the details we recommend deleting the file.

What do I do if it doesn’t work?
First this will depend on the type of error you are getting:

404: This means that the file is missing, confirm that the file is in the correct directory and uploaded.

500 or other error:
This file should work without issues on a website host so I would contact your host if there are issues with the file.
If you are running this on a local machine for development you’ll want to go through standard diagnostics for your setup. I would start Googling the error you received as this is be different based on your operating system and web server.

Leave a Reply

Your email address will not be published. Required fields are marked *

fifty nine − 55 =