Apache php如何让cgi模式和dso模式共存

主要的virtualhost都使用apache2 dso的php模块,但某几个virtualhost需要以cgi模式运行php,请问该如何配置?

cgi就是把bin方式的php作为解释程序,和配置普通的cgi应该没有区别的....

php编译安装后(dso)就有可执行的bin方式php了.你可以用find查查,或者which php来查.

我记得原来看到过通过配置不同的PHP文件后缀来指定何种解释方式。
比如:phtml为CGI方式,php为DSO模式。
但不记得如何配置了。

首先以正常方式安装apache,以及DSO方式的PHP,并配置apache的httpd.conf,让其支持PHP文件。然后再编译CGI方式的PHP,make后直接拷贝sapi/cli/php到/usr/local/apache2/cgi-bin/目录。再修改httpd.conf,添加: Action phtml-script /cgi-bin/php AddHandler phtml-script .phtml 然后重新启动apache服务。 现在,*.php文件是以DSO模式运行的,而*.phtml是以CGI模式运行的。

How to install both DSO and CGI mode?
Hi, all

I have installed php+SSL+MySQL+Apache sucessfully under RedHat6 linux. ()

DSO module is fast, but suExec is much safe for virtual host to run php in cgi mode as user's uid, with a little slow. So I want users deside this themselves by add a .htaccess with "addtype..." inside.

The problem is that how to install php in both DSO mode and CGI mode? is that the CGI php module make php scripts as shell scripts?

just do a ./configure but leave out any reference to a web server, like --with-apxs or --with-apache, This will build an executable called php. Just copy it to /www/cgi-bin and /usr/local/bin and you're done with the install. (note your web server probably lives in a different directory than /www.... change accordingly.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wywpdp.html