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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php as cgi with apache 2

Status
Not open for further replies.

roycrom

Programmer
Aug 2, 2002
184
GB
Hi, im trying to get php-4.3.6 running as cgi on apache-2.0.49. This is on a solaris 9 box.

I configured php as follows
Code:
./configure --prefix=/usr/local/packages/php2 
--with-pgsql=/usr/local/packages/postgresql 
--with-gd=/usr/local/packages/gd 
--with-png-dir=/usr/local/packages/libpng 
--with-freetype-dir=/usr/local/packages/freetype 
--with-zlib-dir=/usr/local/packages/zlib 
--with-jpeg-dir=/usr/local/packages/jpeg 
--with-imagick=/usr/local/packages/imagemagick 
--with-ldap=/usr/local/packages/openldap 
--with-pspell=/usr/local/packages/aspell 
--enable-gd-native-ttf 
--enable-sysvsem --enable-ftp 
--enable-force-cgi-redirect 
--enable-cgi 
--disable-cli 
--disable-pear

in my virtual host section i have
Code:
<VirtualHost xxx.xxx.xxx.xxx>
ServerAdmin webmaster@domain.com
DocumentRoot /u01/inet/users/school/docs
ServerName [URL unfurl="true"]www.school.domain.com[/URL]

AddType application/x-httpd-php .php
Action application/x-httpd-php /u01/inet/users/cgi-bin/php

<Directory "/u01/inet/users/school/docs">
    Options +ExecCGI
</Directory>
ErrorLog /export/home/apache2/logs_2.0.49/error_log_school
</VirtualHost>

When I try to go to a php page in the url
the server trys to fetch the file:
/u01/inet/users/cgi-bin/php/php/test.php

so the error_log_school says the file does not exist.

I know its to do with the Action directive but how else do I tell apache to use php to action .php requests?

Anyone else have a similiar problem.

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
I had alot of trouble with apache 2 and php 4.3 and eventually gave up.
I couldn't actually find any benefits for having apache 2 in its current enviroment so to revert was easier.

Errors included apache reporting that it wasunable to locate certain modules (which existed), and pages either not being found, and apache failing to start.

Good luck.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
It seems to be.

The PHP online manual page which covers installing PHP with Apache 2 states:
Warning:
Do not use Apache 2.0 and PHP in a production environment neither on Unix nor on Windows.



I haven't had problems running Apache2 and PHP 4.3.6 (on RH 9). The only trouble I've had is that when I try to use apachectl to restart Apache, I get a segmentation fault. If I use apachectl to stop then start Apache, there's no problem.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
The main reason I wanted to use Apache 2 was for the perchild MPM. There is also a message saying don't use that option too on the apache site.

My problem is that the site has about 600 virtual hosts and wanted to lock them all into their own document root.

We had a bit of a defacement on our sites. Someone had exploited a hole in postnuke that allowed them to deface all our v hosts home pages. Only two of the hosts are running on postnuke.

That hole is plugged but it has really got me thinking about how to tighten up.

Tried using the open_basedir but there are bugs with this that apache say are fixed but they still manifest themselves. I put the open_basedir in one virtual host and it leaked to other v hosts. So I then decided to run php as cgi and use suexec which worked to a degree but as I also serve up a lot of php, I need to use fastcgi which for the life of me I can't get to work with suexec.

Its a shame because there are some nice modules out there that for one reason or another won't fit together into a nice apache shape.

Thanks for the replies.

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
This is an old post and you have surely found the answer by now, but I had a similar problem with Apache 2 and php 4 and added the directive

AcceptPathInfo On to Apache 2

This solved the problem and allowed the php script I was using to be run rather than the server seeing it as a directory.

Here is what I added to the Apached config

<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
AcceptPathInfo On
LimitRequestBody 5524288
</Files>

And here is an article which mentions pathinfo

If you havent solved the problem, this is worth trying.



 
That should read, I added the line

AcceptPathInfo on

without the apache bit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top