Your phpinfo()

“Phpinfo” is a nice little script to have saved in your root directory. It’s one simple line, and will tell you lots of information about the system you are working with. It will tell you what configuration files you are working with, information about your server, and information about the database you are working with. It also lets you know about all of the php modules and packages you have currently turned on and running and their version.

All of this information is great if you are running into a problem and need to pin point where exactly you should start debugging. Often times, especially if you switch OS’s often, you may forget to enable a module in your php.ini; in which case, you will not see it in your phpinfo. If it is in your phpinfo, a environment path may be incorrect, or the module is trying to work with a directory that you may not have on your system because you were unaware that it was a dependency. Sometimes it can even be that you are working with an old version of the module, and things aren’t working the way they should. All of this can be figured out with a quick trip to your phpinfo.

If your installation did not come with a phpinfo file in your working directory, just copy this line down into a new file, name it phpinfo.php, and save it in your document root folder.

<?php phpinfo(); ?>

After you have saved this file, point your browser to:

http://localhost/phpinfo.php

A pre-formatted page with lots of information will appear, and as you work your way down the page, you will notice a lot of familiar information. The information is listed alphabetically, so if you are looking for a specific module or package, it should be easy to narrow down.

You should keep this file around in your document root folder, and any time you need to look something up, just point your browser to the file, and all of your information will appear.

This entry was posted in Development, PHP and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply