麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
发在php编程论坛没人回,有人知道怎么在linux下配置php为cgi方式吗
悬赏分:20 - 2007年08月09日

debian bf 2.4 怎么把php安装为CGI模式呀。我怎么只能用模块模式

我的配置文件在下面
PHP是用
apt-get install php4-cgi 来安装的
php.ini 没改过
php4 /var/www/test.php 可以得出结果



ServerType standalone
ServerRoot /etc/apache
LockFile /var/lock/apache.lock
PidFile /var/run/apache.pid
ScoreBoardFile /var/run/apache.scoreboard
Timeout 60
KeepAlive On
MaxKeepAliveRequests 30
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 100
MaxRequestsPerChild 100
LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so

LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
LoadModule status_module /usr/lib/apache/1.3/mod_status.so
LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
LoadModule fastcgi_module /usr/lib/apache/1.3/mod_fastcgi.so

LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
LoadModule access_module /usr/lib/apache/1.3/mod_access.so
LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so
LoadModule unique_id_module /usr/lib/apache/1.3/mod_unique_id.so
LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so
ExtendedStatus On
Port 80
User www-data
Group www-data
ServerAdmin sky@cq110.com

#DocumentRoot /var/www

Options SymLinksIfOwnerMatch ExecCGI
AllowOverride None


Options ExecCGI Indexes Includes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

Redirect /~www http://swder.net

UserDir public_html


RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]+\.swder.net$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.swder\.net(.*) http://swder.net/~$1$2


AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

Order allow,deny
Allow from all


Order deny,allow
Deny from all



DirectoryIndex index.html index.htm index.shtml index.cgi




AccessFileName .htaccess

Order allow,deny
Deny from all

UseCanonicalName Off
TypesConfig /etc/mime.types
DefaultType text/plain

MIMEMagicFile share/magic

HostnameLookups Off
ErrorLog /var/log/apache/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %v" f
ull
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %P %T" d
ebug
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combine
d
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache/access.log combined
ServerSignature On
#
# Document types.


AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz

LanguagePriority en da nl et fr de el it ja pl pt pt-br ltz ca es sv

AddType application/x-tar .tgz
AddType image/bmp .bmp
AddType text/x-hdml .hdml



BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0



ScriptAlias /fcgi-bin/ /usr/bin/

Options ExecCGI
SetHandler fastcgi-script

AddType application/x-httpd-fastphp .php
Action application/x-httpd-fastphp "/
fcgi-bin/php4"

ServerName swder.net
ServerAlias www.swder.net
User mydebian
Group mydebian
DocumentRoot /var/www
Options +ExecCGI
#SuexecUser mydebian





########################################
Install PHP CGI, or Turning Mole Hills into Mountains
I've always used PHP compiled into Apache, so PHP CGI was new to me. And for the life of me, I couldn't figure out how the hell to begin. I searched the documentation, typed ./configure --help dozens of time, finally opening up the configure script and going through it line by line. I simply could not find a parameter, argument, option, environement variable, or config file, that said, "Build PHP as a CGI". Which brings us to the problem of, "How does one document a negative?"

PHP apparently expects to be compiled as a CGI. The fact that no one does this, hasn't changed that basic assumption. So just compile the damn thing sans --with-apache, and you've got a PHP CGI executable ready to go. Hmmm, we're already 30 minutes over budget for installing Gallery, and we haven't touched it.


Compiling, or Mop the Augean Stables
Well we've got configure in the bag, and the freshly downloaded 4.2.0 is happily compiling, but wait! Now make is having problems. Something about EX_OK being used before its defined. Screw it! We'll switch back to 4.1.1 which is kicking around the src directory, and try to build that instead. Ok that worked.

Putter around trying to figure out how to enable PHP-CGI.

#!/usr/local/bin/php? No that doesn't work.
AddHandler cgi-script .php? Hmmm, nothing.
AddHandler application/cgi-php, Action applicaton/cgi-php /usr/local/bin/php? 404, /usr/local/bin/php/~kellan/test.php not found.

提问者:skybyte   08-09 16:04
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
26 + 17 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM