本教程介绍了如何在 OpenSUSE 12.3 上安装 ">Apache2 的 mod_fcgid 和 PHP5 。mod_fcgid 能够兼容替代旧的 mod_fastcgi,它可以替代Apache用户来执行权限的PHP脚本。
1.初步说明
在本教程中我们使用 OpenSUSE 12.3 服务器的主机名 server1.example.com ,IP地址是 192.168.0.100。
本教程中将创建两个Apache虚拟主机 www.example1.com 和 www.example2.com ,用于mod_fcgid演示使用。
2.安装 Apache2/mod_fcgi/PHP5
安装 Apache2,mod_fcgid 和 PHP5,如下命令:
zypper install apache2 apache2-mod_fcgid php5-fastcgi
如果已经安装PHP5作为一个Apache模块,先禁用现在的PHP5模块:
a2dismod php5
下一步启用suexec 和 fcgid模块:
suexec and fcgid
然后创建Apache系统启动链接且运行:
systemctl enable apache2.service systemctl start apache2.service
下一步打开/etc/php5/fastcgi/php.ini:
vi /etc/php5/fastcgi/php.ini
取消注释行cgi.fix_pathinfo = 1:
[...] ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For
more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; http://php.net/cgi.fix-pathinfo cgi.fix_pathinfo=1 [...]