How To: Check PHP Modules With phpinfo
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:
<?php
phpinfo();
?>
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 http://example.com/heroic.php. 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.
Related Articles:
- What is CentOS? Everything You Need to Know
- Check Apache Status with systemctl status and apachectl status Commands
- How to Find the Server Name Indication (SNI) Supporting Details
- How to Install Pip on CentOS 7
- Get Kernel Version for Linux: A Guide
- What Is a Time Series Database? How It Works & Use Cases

About the Author: Patrick Hawkins
Patrick Hawkins is a former Test Engineer and Managed WordPress admin with Liquid Web
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
How to Install WordPress on Linux (AlmaLinux)
Read ArticleWhat is CentOS? Everything You Need to Know
Read ArticleWhat is CentOS? Everything You Need to Know
Read ArticleRedis as Cache: How It Works and Why You Should Use It
Read ArticleRefer-a-Friend Program for Website Hosting: Get $100 for Each Friend!
Read Article