I've tried phpinfo() but it output nothing. It is interesting that php-r "phpinfo();"
works correctly while using phpinfo() in web outputs nothing.
Again, nothing is written to error.log too. php.ini
is empty.
I don't know what to do now.
Edit:
Thanks to lanzz, I got that phpinfo() requires no output before it.
I had a similar issue. I am running Apache2 on my Ubuntu machine for local testing of projects before deployment. I created a phpinfo(); page, and noticed it was blank. Upon inspecting in my browser, the php function would be commented out.
Your browser has nothing to do with php.
In order for PHP scripts to execute, you have to save the file as a .php file, which I'm sure you did.
PHP tags alone aren't valid in HTML documents, so you need to create an actual HTML document, and save it as .php. Then, include a basic HTML document like so:
<?php
phpinfo();
?>
<html>
<head>
<title>Php Info</title>
</head>
<body>
</body>
</html>
Then you would do: localhost/phpinfo.php or whatever you're working on. In my case it was an actual domain name that was mapped to my localhost, so 'myProjectName'.com/phpinfo.php
This is just from my experience and it worked 100%.
First, Check the content of your "access.log" ; if you don't see the call to the phpinfo file, you certainly have a problem on your web server.
Otherwise, try to get a simple php file :
<?php echo "Hello, world.";
Or HTML file :
<h1>Hello, world !</h1>
Then you can determine where is the problem.
Perhaps the PHP module for the web server isn't loaded.
Just wanted to add, that I was using short tags '<?'
<? phpinfo();
which was failing, becuase I was using short tags when they were disabled so it should have been
<?php phpinfo();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With