A friend\'s lamp host seems to be misconfigured. I try to execute php, but it doesn\'t seem to be working.
In Chrome\'s inspect element:
Sounds like you are using an editor that is changing what you enter. Make sure that what you want in the file is what is actually in the file. Using FTP to upload a php file should ensure this.
It seems you have to instruct apache explicitly to handle html files as php files, I was having the same problem but renaming the file to .php solved the issue for me.
I just solved this same problem. You need to open your file from your WAMP, and not from your hard drive directrory.
In your browser, put: localhost/...../yourfile.php
Otherwise, your browser will replace all <?php ?>
with <!-- ?php ?-->
I was faced with exact same problem when I accidently tried to test local php file in browser on server through file://
protocol, not through installed site.
So the answer is one: "Mr. PHP has left the building". We need to check the configuration, location of a file or access.
And browser is just trying to fix a web page and help us.
This answer doesn't apply to the OP's specific variant of this problem, but I had the basic same issue – <? var_dump($test); ?>
being converted to <!--? var_dump($test); ?-->
– which I could solve by enabling short_open_tag
in php.ini.
If you are placing your code outside the standard directories (development scenario, in my case) you should check in your /etc/apache2/mod-enabled or /etc/apache2/mod-available in the php5.conf (for ubuntu) and comment the lines that the comment indicates:
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>