views:

103

answers:

1

I was trying to add curl support to php on a VPS, and after logging in and trying to perform a php upgrade, my site gives me a 500 error every time I try to access it.

So, I tried refreshing apache install with easyApache, and it went swimmingly outside of the fact that php scripts still didn't work.

I decided there must be something going on with php parsing, so I tail -f'd /etc/httpd/logs/error_log and tried navigating to the site, and sure enough, it looks like there's something wrong with the headers.

Here's what the error log is generating on all php file requests:

[Fri Jun 18 20:01:47 2010] [error] [client 00.00.00.00] malformed header from script. Bad header=<head> : index.php

As far as I can tell, the "Bad header" always equals the first line of the php script.

Unfortunately, I'm super stumped after this, I've never run into issues like this, and although I know my way around unix, I'm no server admin.

I suppose this could be a serverfault question, but I figure this is the type of thing developers are more likely to run into, so you guys might be able to help.

+1  A: 

It seems you've upgraded from PHP < 5.2.3 to PHP >= 5.2.3. In the PHP 5.2.3 changelog, you can read:

Changed CGI install target to php-cgi and 'make install' to install CLI when CGI is selected.

You need to use the php-cgi binary and not the php binary.

In your Apache configuration, check the following line:

Action application/x-httpd-php /usr/bin/php-cgi

If it's pointing to the /usr/bin/php binary, point it to php-cgi.

analogue
This was definitely the problem, I just downgraded to 5.2.1, as I'm not in need of any 5.2.3 functionality, but if anyone were to run into the same issue, this would be the way to fix it. Thanks!
Jesse