This file (test.php
) runs the PHP info blurb as expected:
<html>
<body>
<?php
phpinfo();
?>
</body>
</html>
But this code, also when saved as test.php
, generates a blank screen:
<?php
echo "<html><body><?php phpinfo(); ?></body></html>";
?>
The source code here, when reviewed from the browser, shows:
<html><body><?php phpinfo(); ?></body></html>
...so almost certainly there is something screwy about how I've set up the server to parse things..
I am running a localhost of PHP version 5.6.28 and Apache 2.4 on Windows 10. Other than the newbie setup instructions here, I haven't changed many of the defaults. I do have:
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddType application/x-httpd-php .php
...already in the httpd.conf
file.
test.php
definitely has a .php extension already, but I did see this idea, so I added this line:
AddHandler php-script .html
...to the httpd.conf
file. I also added:
AddType application/x-httpd-php-source .phps
AddType text.html .php
that were suggested here: Apache is downloading php files instead of displaying them
Am I missing something obvious?
Update: after monkeying by adding the above lines to the httpd.conf
file, test.php
actually generates a few unescaped characters?
"; ?>
rather than a totally blank screen, or the expected phpinfo information.