Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Node.js, PHP and APIs

A phpinfo() test page stays empty although the rest of the PHP site runs

Your error

The phpinfo() test page is completely blank, while other .php pages load1 more line it can show

Fix it fast

Most common cause, 1 of 2

phpinfo is listed in disable_functions

On a server you run, take phpinfo out of disable_functions in the php.ini the web SAPI loads and reload PHP.

Fix
# /etc/php/8.3/fpm/php.ini
disable_functions = exec,passthru,shell_exec,system

sudo systemctl reload php8.3-fpm
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

A blank phpinfo() page beside working PHP pages has two usual causes. phpinfo is listed in disable_functions, and since PHP 8 that turns the call into an undefined-function fatal error which display_errors hides. Or the test file opens with <? while short_open_tag is Off, so PHP sends the code to the browser as text, which shows nothing.

  • Applies to PHP 8.2 to 8.6, PHP-FPM and Apache mod_php, Ubuntu 24.04 and 26.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Fetch the test page and look at the raw body. Your own <? phpinfo(); ?> text coming back means the short tag; an empty body means PHP stopped with an error.

Run this first
curl -s http://localhost/info.php | head -c 300

Then find the line you see in this list and open its fix:

  1. 1phpinfo is listed in disable_functionsThe body is empty or the server answers 500, and the PHP error log shows Call to undefined function phpinfo()
  2. 2The test file opens with <? and short_open_tag is Offcurl returns the literal <? phpinfo(); ?> text, and pages that start with <?php work

What does the error look like?

  • The phpinfo() test page is completely blank, while other .php pages load
  • Uncaught Error: Call to undefined function phpinfo()

Cause 1 of 2

phpinfo is listed in disable_functions

You seeThe body is empty or the server answers 500, and the PHP error log shows Call to undefined function phpinfo()

Check

Since PHP 8.0 a function named in disable_functions is treated exactly like one that does not exist, so a phpinfo() call ends in an Uncaught Error. With display_errors Off, the value php.ini-production ships, the visitor gets an empty page while every script that avoids phpinfo() keeps running.

Check
echo '<?php var_dump(ini_get("disable_functions"));' | sudo tee /var/www/html/ini-check.php
curl -s http://localhost/ini-check.php

Fix

On a server you run, take phpinfo out of disable_functions in the php.ini the web SAPI loads and reload PHP. The setting is INI_SYSTEM and must be set in php.ini, so .htaccess and ini_set() cannot change it. On shared hosting, read single values with ini_get() instead.

Fix
# /etc/php/8.3/fpm/php.ini
disable_functions = exec,passthru,shell_exec,system

sudo systemctl reload php8.3-fpm

Verify

The page now prints the PHP Version table. Delete both test files afterwards.

Verify
curl -s http://localhost/info.php | grep -c "PHP Version"
sudo rm /var/www/html/info.php /var/www/html/ini-check.php

Confirmed by php.net

Did this fix it?

Cause 2 of 2

The test file opens with <? and short_open_tag is Off

You seecurl returns the literal <? phpinfo(); ?> text, and pages that start with <?php work

Check

short_open_tag decides whether PHP accepts the short <? opening tag. Its built-in default is 1, yet both php.ini-production and php.ini-development set it to Off, and then PHP passes <? phpinfo(); ?> through untouched. The browser does not display that text, so the page looks empty.

Check
php -r 'var_dump(ini_get("short_open_tag"));'   # CLI value; the web php.ini can differ

Fix

Write the test file with the full <?php tag instead of switching short tags on; the <?= echo shorthand works either way.

Fix
printf '<?php\nphpinfo();\n' | sudo tee /var/www/html/info.php

Verify

The page renders the configuration tables. Remove the file when you are done.

Verify
curl -s http://localhost/info.php | grep -c "PHP Version"
sudo rm /var/www/html/info.php

Confirmed by php.net

Did this fix it?

How do I stop it coming back?

  • Delete phpinfo() test files as soon as you have read them, because they expose the full server configuration.
  • Open every PHP file with <?php and keep short_open_tag Off, as both php.ini files shipped with PHP do.
  • Read a single setting with ini_get() in a protected admin script rather than publishing a phpinfo() page.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: Spotless Laundry, EZ Estimater.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.