Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get PHP5 to work with Apache 2 on RH9

Status
Not open for further replies.

themanfalconar

Technical User
Sep 13, 2003
10
0
0
EU
Hello all,

I'm new to Apache and PHP, and so I've attempted to set up a web server whereby I can have a play with them. I'm running Apache 2.0.49 with PHP5.0.0 RC1 on RedHat 9. Apache is working fine as a web server, and I even have it working with CGI.

When I attempt to open a simple php document using I get the error message:

Forbidden

You don't have permission to access /test/phptest.php on this server.

I've changed the permissions on the test folder to 0777 and it still comes up with the same message. I've put everything in httpd.conf that is recommend on php.net, and so I'm really scratching my head as to why it doesn't work. I think I must be missing something in my httpd.conf file... For your reference, a copy of my httpd.conf file is available at:


And the PHP file I'm trying to run is:


Please note that the above files are hosted on a completely different webserver (because it's up all of the time, rather than the one I'm messing with).

If any of you can help then I'd be most grateful. Like I said, I'm fairly new to this stuff so please treat me as a beginner when replying!

Regards,

Dan Falconar
 
If you are new to PHP, I strongly recommend that you not install PHP 5. The "RC1" part of the version you download stands for "Release Candidate 1" -- the software is not production-ready yet. You can always upgrade to PHP 5 when the production release is made available.

What errors is Apache reporting in its logs on startup and when you try to hit the page?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I did actually try using PHP 4, but got exactly the same message. Besides, they said that RC1 is certainly good enough to play around with!

The tail of the log looks like this:

[Mon Apr 12 20:47:33 2004] [error] [client 212.135.207.206] Options ExecCGI is off in this directory: /usr/local/apache2/htdocs/test/phptest.php, referer:
Ok, so I add the following lines to httpd.conf to deal with this error:

<Directory "/usr/local/apache2/htdocs/test>
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

Which gives the error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

And then the new error in the log I get is:

[Mon Apr 12 20:49:11 2004] [notice] Apache/2.0.49 (Unix) PHP/5.0.0RC1 configured -- resuming normal operations
[Mon Apr 12 20:49:22 2004] [error] [client 212.135.207.206] Premature end of script headers: phptest.php, referer: [Mon Apr 12 20:49:22 2004] [error] [client 212.135.207.206] (8)Exec format error: exec of '/usr/local/apache2/htdocs/test/phptest.php' failed, referer:
Maybe we're closer... any ideas?

Dan
 
When you compiled PHP, what options did you hand the configure script?

The system seems to be acting like it will only invoke PHP as an external CGI language, not as an internal module. One way to check this is to add a shebang line to the beginning of your PHP script and see what happens.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I've now solved the problem. It turns out that my httpd.conf was trying to process php as CGI.

Thank you all for your help, it is much appreciated.

Regards,

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top