问题描述
服务器
我有我使用主办我目前的项目开发服务器。这里有一些数据:
I have a development server that I'm using to host my current projects. Here are some stats:
root@myserver:/usr/bin $ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"
root@myserver:/usr/bin $ apache2 -v
Server version: Apache/2.2.16 (Ubuntu)
Server built: Nov 18 2010 21:17:43
root@myserver:/usr/bin $ php --version
PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010 14:00:18)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
root@myserver:/usr/bin $ uname -r
2.6.35-22-server
问题
我使用的是运行PHP 5.3.3 mod_php5
和它的伟大的工作。但我需要在服务器上运行PHP 5.2.11只是一个VH,所以我用
推荐答案
一个很好的选择是。
如果设置正确,你可以有许多处理程序,如你所愿;即使是虚拟主机内不同的目录中。
If set up properly, you can have as many handlers, as you wish; even for different directories within a virtual host.
为了增加安全性,有suPHP的偏执狂模式中,您分配一个Unix用户和组到虚拟主机和脚本将运行该用户。
For added security, there's suPHP's "paranoid" mode in which you assign a Unix user and group to a virtual host and the scripts will be run as that user.
我suPHP配置看起来像:
My suPHP config looks like that:
...
[handlers]
;Handler for php-scripts
x-httpd-php=php:/usr/bin/php4-cgi
x-httpd-php5=php:/usr/bin/php5-cgi
;Handler for CGI-scripts
x-suphp-cgi=execute:!self
...
在一个简单的的.htaccess
文件,它可能有脚本运行使用不同版本的PHP:
Within a simple .htaccess
file it is possible to have scripts run using different versions of PHP:
<FilesMatch \.php$>
SetHandler x-httpd-php
</FilesMatch>
<FilesMatch \.php5$>
SetHandler x-httpd-php5
</FilesMatch>
# etc...
希望有所帮助。
这篇关于我怎么能告诉的Apache2,默认运行mod_php5但在CGI模式运行这个VH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!