tags:

views:

22

answers:

1

Hi,

One moment my local apache server was serving my php nicely. The next (I don't know of any settings changing in between) it doesn't serve them properly.

Given a php page, it will serve the pure html that was in that page, and just strip out the php code. This tells me that something is working, although not properly, because if the server was not working at all, I imagine I would just get a page having all of php code, unparsed.

Does anyone have any idea what could cause this to happen?

Thanks, Yazan

+1  A: 

Check the page's source to make absolutely sure the PHP code isn't showing up unparsed. (It usually won't show up on the page, since PHP code lives inside a processing instruction (<?php ... ?>).) If it's there, then the PHP interpreter isn't running, and would need to be enabled by saying 'php_flag engine on' in the Apache server or site config, or 'engine = On' in php.ini.

If it's not there, then something is causing your PHP not to return anything. That's probably not a server thing, or even a PHP interpreter thing -- that's more likely a bug in the code, and i'd have to see it before i could say more.

Well, before i could say much more. Try enabling error_reporting, see if the code is triggering any errors.

cHao
Thank you for your quick response. I checked the code, the php is indeed being parsed out. This issue is showing up on all of my php pages, including ones that I knew to be working.I checked and engine = on in php.ini, I can't however find php_flag engine in the apache server (do you know where this would be?)
[Fri Aug 06 05:49:32 2010] [notice] Child 1852: Acquired the start mutex.[Fri Aug 06 05:49:32 2010] [notice] Child 1852: Starting 64 worker threads.[Fri Aug 06 05:49:32 2010] [notice] Child 1852: Starting thread to listen on port 80.[Fri Aug 06 05:50:27 2010] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
As long as it's on in php.ini, it should be OK. "php_flag engine" is usually found either in the main config (or one of the files included from it, like /etc/httpd/conf.d/php.conf on Fedora), or in whatever file(s) contain the <VirtualHost> section for your site. Either way, it's rarely turned off sitewide, and if it were, you'd be seeing PHP code mixed in with the HTML source.
cHao
I'm not seeing any errors in that snippet of the log file. What i meant was, turn on error_reporting ("php_value error_reporting -1" in the Apache config, or "error_reporting = -1" in php.ini) and see if any errors show up *in the page*. Consider enabling "display_errors" and "display_startup_errors" too.
cHao