How to create phpinfo pages

Do you want to know PHP/Apache information? The easiest way is to use the phpinfo() function.

1. Log in to your control panel (cPanel, DirectAdmin, CWP etc)

2. Go to the File Manager and create a new file – phpinfo.php – in your public directory (where your site’s files are)

3. Edit this file and put the text:

<?php
phpinfo();
?>

4. Access the newly created file – https://yourdomain.com/phpinfo.php

phpinfo output

If you are an admin you can easily create such a file for the specific user:
1. navigate to the specific directory:

# cd /home/username/public_html/

2. create a phpinfo file, edit it with the vi/nano editor and add the above PHP code:

# touch phpinfo.php
or
# nano phpinfo.php

3. modify phpinfo.php file permissions:

# chmod 644 phpinfo.php
# chown <username>:<username> phpinfo.php

4. access the file phpinfo.php in your web browser or send the link to the client.


Notice that on some servers the phpinfo() function is disabled. In this case, you may need to use other functions like ini_get(). A simple PHP file to get the most common PHP values is here https://github.com/plothost/php-list-values

Resources:
phpinfo() help

Leave a Reply