View Full Version : wht is the Problem when your PHP IS not PHP

02-18-2010, 01:41 PM

Recently I have made Script , All Ok But Some People Reported to me that the Admin Area Shows as

(this is Only Example not actual Code )

if (substr(trim($line), -1, 1) == ';')
// Perform the query
mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
// Reset temp variable to empty
$templine = '';

AS if its Not php and Just Shows up as Html its a Php file and seem OK BECAUSE NO ANY PHP ERROR.. Debug mode is on and no any php errors Shown .. its just Like if the code is Html ..

its Ok with me and Most who used it but Few Reported that problem and Can not Figuer out wht Could it be..

02-18-2010, 01:51 PM
This will happen if the webserver it is running on is not set to process files with a .php extension as php, but rather as straight text. For example if you put php code on a vanilla windows web server this would happen as it does not recognise the .php extension as anything special.



02-18-2010, 06:52 PM
Thank you ,

But they have the Appache and the Script Works But Only the Admin Area.. If it Happens to me i cN GO FROM THERE TO SEE WHTS MATTER it just not happening..But Some Different Users reported to me it Happends to them .. So i'm pretty sure Something is Wrong.

02-19-2010, 09:01 AM
Sounds very odd. The only other reasons I can think that it would show the PHP if properly configured are:

if you have not put php tags around all of your code
if you have output an incorrect content-type header (e.g. if you set content type explicitly to text/plain)
if the code is somehow getting escaped
if there is an .htaccess file in the directory that overrides the server config
if the server has been hacked which could involve any of the above or more issues

As you say the first step in fixing a problem is reproducing it, if you can't see the problem yourself and cannot establish a pattern for what links the clients who are experiencing it then you are going to struggle to fix it. Do you have the ability to call one of the people with a problem and talk them through what they are doing, maybe get them to tyr some test scripts etc.?