How To: Check PHP Modules With phpinfo

Reading Time: 2 minutes

Say your PHP application is unable to load a needed PHP module. The first thing to check is to see if the PHP module is available to the application. The best way to do that is with what is called a “phpinfo” file.

What is a phpinfo file?

A phpinfo file is an extremely small PHP script that provides you almost too much information about your site’s PHP environment.

How do I make a phpinfo file?

Create a file in your site’s document root called “whatever.php” with the following content:

Note: it is not a good idea to name the file “phpinfo.php”, as some attackers search for files with that name left on servers.

Now load that file in the browser, for example at The page will give you plenty of information about the version of PHP in use, the core functions available, and the modules being loaded.

My, that’s a lot of information! How do I search for the module I need?

The easiest way is to use your browser’s search function. Press CTRL-f (the control key at the same time as the f key) in order to search within the page.

Is there a simpler way to find this information? On the command line, perhaps?

There is a common way to see if a PHP module is installed on the command line, though it is not as effective as the phpinfo method:
php -m | grep -i modulename
This does tell you what modules the php command line tool is seeing. It does not tell you what modules Apache’s PHP is able to load.

The PHP module my site needs is/is not installed.

If the PHP module you need is not installed, it should be relatively straightforward to install it. If phpinfo shows it as loaded, however, further troubleshooting is warranted. Do not hesitate to contact our Heroic Support Team™ if needed.

One last thing…

Be sure to remove the file from your server when you are done, as a security precaution.

About the Author: Patrick Hawkins

Patrick Hawkins is a former Test Engineer and Managed WordPress admin with Liquid Web

Latest Articles

How to Set Up a Cron Job in cPanel

Read Article

How to Set Up a Cron Job in cPanel

Read Article

What Is Puppet Software and How Do You Use It?

Read Article

Accessing Man Pages on Ubuntu 16.04 LTS

Read Article

What is VMware Fusion?

Read Article