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 showFix it fast
Most common cause, 1 of 2phpinfo 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.
# /etc/php/8.3/fpm/php.ini
disable_functions = exec,passthru,shell_exec,system
sudo systemctl reload php8.3-fpmShort 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.
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.
curl -s http://localhost/info.php | head -c 300Then find the line you see in this list and open its fix:
What does the error look like?
The phpinfo() test page is completely blank, while other .php pages loadUncaught 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.
echo '<?php var_dump(ini_get("disable_functions"));' | sudo tee /var/www/html/ini-check.php
curl -s http://localhost/ini-check.phpFix
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.
# /etc/php/8.3/fpm/php.ini
disable_functions = exec,passthru,shell_exec,system
sudo systemctl reload php8.3-fpmVerify
The page now prints the PHP Version table. Delete both test files afterwards.
curl -s http://localhost/info.php | grep -c "PHP Version"
sudo rm /var/www/html/info.php /var/www/html/ini-check.phpConfirmed by php.net
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.
php -r 'var_dump(ini_get("short_open_tag"));' # CLI value; the web php.ini can differFix
Write the test file with the full <?php tag instead of switching short tags on; the <?= echo shorthand works either way.
printf '<?php\nphpinfo();\n' | sudo tee /var/www/html/info.phpVerify
The page renders the configuration tables. Remove the file when you are done.
curl -s http://localhost/info.php | grep -c "PHP Version"
sudo rm /var/www/html/info.phpConfirmed by php.net
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.