同时运行mod_php和suPHP

我最近从5.2.x的Debian Lenny开始,能够使用mod_php来处理位于/ home /中的所有php文件都不在/ home /和suPHP中的任何php文件。

我这样做是因为我需要一个默认的php.ini(给了我所有的phpfunction)在/ var / www /我的网站,我不想从根改变所有.php文件的所有者。 我也有一个默认的php.ini所有的/ home / php文件没有危险的function。

这是我曾设置:

<IfModule mod_suphp.c> <Directory /home/> AddType application/x-httpd-php .php .php3 .php4 .php5 suPHP_AddHandler application/x-httpd-php suPHP_Engine on suPHP_ConfigPath /home/shared/ </Directory> </IfModule> 

这是工作完美的,但最近我升级到PHP 5.3.5从dotdeb(莱尼没有官方的PHP 5.3)。 这在lenny上有奇怪的问题,比如不能正确显示错误和小点数。 所以我决定从lenny升级到挤压。 卸载的PHP(随着它来了suphp),并重新安装新的来源。 我现在有5.3.3-7与Debian挤压,但我不能让mod_php和suPHP在同一时间运行了。 mod_php将始终工作,并且在apache2或suphp日志中没有错误。 如果我禁用mod_php,那么suPHP将起作用。

我做错了吗?

通过将php_admin_flag engine Offphp_admin_flag engine Off的顶部,我能够完成我之后的mod_suphp.c 。 此外,我不得不确保我使用suPHP_Engine off默认suPHP_Engine off

最终结果:

  <IfModule mod_suphp.c> <Directory /home/> php_admin_flag engine Off AddType application/x-httpd-php .php .php3 .php4 .php5 suPHP_AddHandler application/x-httpd-php suPHP_Engine on suPHP_ConfigPath /home/shared/ </Directory> </IfModule> 

只是对于那些想知道的,这是我的/home/shared/php.ini他们将是每个/home用户php.ini除非我在vhosts中指定不同:

 allow_url_fopen = Off display_errors = On display_startup_errors = On log_errors = On error_reporting = E_ALL error_log = "/var/log/apache2/php_user_errors.log" expose_php = Off magic_quotes_sybase = Off register_globals = Off open_basedir = "/home:/tmp" short_open_tag = On session.save_path = "/tmp" disable_functions = "phpinfo, apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,curl_exec,curl_multi_exec,dir,disk_free_space,diskfreespace,dl,eval,exec,fsockopen,highlight_file,ini_alter,ini_restore,ini_set,openlog,parse_ini_file,passthru,pclose,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,readfile,set_time_limit,shell_exec,show_source,stream_socket_server,symlink,system,virtual" 

我需要一个默认的php.ini(给了我所有的function的PHP)在我的网站在/ var / www /,我不想改变所有.php文件的所有者从根。 我也有一个默认的php.ini所有的/ home / php文件没有危险的function。

覆盖httpd.confconfiguration中的相关ini设置(然后允许忽略none以防止它们在.htaccess中被更改)不是简单的吗? 就像是….

 <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec php_admin_flag safe_mode On <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory>