John Davidson

apache - Why are my php tags converted to html comments?

0 comments
Message:


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:



<?php echo 'test'; ?> 


becomes :



<!--?php echo 'test'; ?-->


Furthermore, its been triggering a file download, rather than opening it as a webpage.



I've tried various code in an .htaccess file, but it doesn't seem to have any effect:



AddType x-mapp-php5 .php
AddType application/x-httpd-php .php
AddHandler x-mapp-php5 .php


My Answer:
It sounds like the server is not properly interpreting the PHP code and is treating it as HTML comments instead. This could be due to a misconfiguration in the server settings or the PHP module not being properly installed or enabled.

You can try adding the following line to your .htaccess file to force the server to interpret PHP code:


AddType application/x-httpd-php .php


If that doesn't work, you may need to contact your hosting provider or server administrator to check the server configuration and ensure that PHP is properly installed and enabled.

Rate this post

4 of 5 based on 6566 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us