Friday, July 13, 2007

Finally got it work, ESX to go

Apache2.2.3 + Php5.1.6 + cgi problem
Symptom:
As corrected before, directory listing works. But it doesn't work for cgi-bin.
SPECweb complains:
attemp to invoke directory as script: /var/www/cgi-bin/
On the browser, it complains:
403 Forbidden
You don't have permission to access /cgi-bin/ on this server
But actually it has the full permission 777 and it has the apache:apache ownership
(it sounds like specweb cannot write script in cgi-bin direcotry)
To make php work properly in Apache

Solution:
1. in php.conf
add
AddType application/x-httpd-php .php
comment out
AddType application/x-httpd-php-source .phps

2.To make cgi work properly in Apache
change
ScriptAlias /cgi-bin/ "/var/www/cgi-bin"
Directory "/var/www/cgi-bin"
AllowOverride None
Options None
Order allow, deny
Allow from all
/Directory
to
Alias /cgi-bin/ "/var/www/cgi-bin"
Directory "/var/www/cgi-bin"
AllowOverride None
Options ExecCGI Indexes
Order allow, deny //no space between allow and deny
AddHandler cgi-script cgi pl // if in the cgi-bin/ is perl scripts , if python, then add py
Directory

3. SElinux conflicts with apache
Sometimes SElinux also brings trouble without ideas. So disable SElinux and reboot is more safe and saves your trouble

Also two helpful commands:
1)ls -aZ
to display the SElinux security configuration
--- system_u:object_r:httpd_sys_script_exec_t:s0
--- system_u:object_r:httpd_sys_content_t:s0
use chcron to change it

2) /sbin/service httpd configtest
Syntax OK
to validate the http.conf syntax error


Now testing with 20 sessions in 131.......
---------------------------------
Here is how to make fastcgi working in Apache2.2.3 (When I am free, I will translate it in English)
http://hi.baidu.com/coffeefoam/blog/item/1446493be749f3e814cecbb8.html

No comments: