Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I’m trying to get PHP4 running under CGI alongside PHP5 as a module in Apache. Long story short, I have some legacy applications that aren’t running under PHP5 and they would take a while to rewrite, so short term I should hopefully be able to run both PHP versions for now.

Most of the sites I’ve come across state that running one version as CGI and another as an Apache module is the best way to go about this. I’m pretty sure I have my httpd.conf setup properly as I’m no longer receiving “file not found” errors in my logs. Posting changes below for reference:

AddHandler php4-script .php4
Action php4-script "/cgi-bin/php4"
…
ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/"

My current error is “Premature end of script headers: php4”. I’ve tried some diagnosis that I found here. If I run cgi-bin/php4 htdocs/test.php4 from the command prompt (where test.php4 is a simple echo phpinfo()), I get all the phpinfo data on screen, but no HTML formatting. I tried setting the PATH_TRANSLATE variable as the above link mentions and running cgi-bin/php4 but I never got any output doing that, possible issue could be this. Also I’ve checked and rechecked all my file permissions and everything looks good there.

Any other thoughts as to what I could be missing? Other option is to run another Apache instance on a different port, tried this at first but it started to get a bit messy, though I may have to revert to this.

share|improve this question

migrated from stackoverflow.com Apr 15 '11 at 13:41

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

see: http://www.deanspot.org/~alex/php5fcgi/index.html (Click on the symbol that looks like Theta, located in the right-bottom corner when you mouse over that area)

share|improve this answer
    
Thanks for the info. Ended up going with dual Apache however since I first posted this as I was having so many problems. –  XHR Apr 15 '11 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.