mod_php and suphp at same time


; Security options
;Check wheter script is within DOCUMENT_ROOT
;Send minor error messages to browser
;Handler for php-scripts
;Handler for CGI-scripts


# This is the Apache server configuration file providing suPHP support.
# It contains the configuration directives to instruct the server how to
# serve php pages while switching to the user context before rendering.
LoadModule suphp_module modules/
# This option tells mod_suphp if a PHP-script requested on this server (or
# VirtualHost) should be run with the PHP-interpreter or returned to the
# browser "as it is".
#suPHP_Engine on
# Disable php when suphp is used, to avoid having both.
#<IfModule mod_php5.c>
#php_admin_flag engine off
#<IfModule mod_php4.c>
#php_admin_flag engine off
# To use suPHP to parse PHP-Files
#AddHandler x-httpd-php .php
#AddHandler x-httpd-php .php .php4 .php3 .phtml
# This option tells mod_suphp which path to pass on to the PHP-interpreter
# (by setting the PHPRC environment variable).
# Do *NOT* refer to a file but to the directory the file resides in.
# E.g.: If you want to use "/path/to/server/config/php.ini", use "suPHP_Config
# /path/to/server/config".
# If you don’t use this option, PHP will use its compiled in default path.
# suPHP_ConfigPath /etc
# If you compiled suphp with setid-mode "force" or "paranoid", you can
# specify the user- and groupname to run PHP-scripts with.
# Example: suPHP_UserGroup foouser bargroup
# suPHP_UserGroup apache apache
# This option tells mod_suphp to handle requests with the type <mime-type>.
# Please note this only works, if an action for the handler is specified
# in the suPHP configuration file.
#suPHP_AddHandler x-httpd-php
# This option tells mod_suphp to NOT handle requests with the type <mime-type>.
# suPHP_RemoveHandler <mime-type>

Usege example

SuexecUserGroup "#500" "#500"
DocumentRoot /home/
suPHP_Engine on
AddHandler x-httpd-php .php
AddHandler x-httpd-php .php .php4 .php3 .phtml
suPHP_AddHandler x-httpd-php
<Directory /home/>
allow from all
DirectoryIndex index.htm index.html index.php

suPHP parents directory is not own by defined user or root

root at server1:/root/suPHP/suphp-0.6.3/src# diff -u ./Application.cpp
— ./Application.cpp 2008-04-24 15:21:20.000000000 -0700
+++ ./Application.cpp-dist 2008-03-30 04:43:38.000000000 -0700
@@ -492,14 +492,12 @@
directory = directory.getParentDirectory();

UserInfo directoryOwner = directory.getUser();
if (directoryOwner != owner && !directoryOwner.isSuperUser()) {
std::string error = “Directory ” + directory.getPath()
+ ” is not owned by ” + owner.getUsername();
throw SoftException(error, __FILE__, __LINE__);

if (!directory.isSymlink()
&& !config.getAllowDirectoryGroupWriteable()

Originally found at

Install/upgrade to php 5.2.5 on Centos4

1, Get FedoraCore php src rpm
2, Install php 5.2.5.src.rpm, and modify spec

root@ns99 ~# rpm -ivh php-5.2.5-7.fc9.src.rpm
root@ns99 SPECS#cd /usr/src/redhat/SPECS

replace php.spec as provide here. ” it for avoid error on php test step”
Download php.spec here

3, build rpm and install
If any package need for dependency, install before build rpm. 

 root@ns99 SPECS#rpmbuild –bb php.spec
 root@ns99 SPECS#cd ../RPMS/i386/
 root@ns99 i386# rpm -Uvh php-common-5.2.5-7.i386.rpm php-mysql-5.2.5-7.i386.rpm php-debuginfo-5.2.5-7.i386.rpm  php-ncurses-5.2.5-7.i386.rpm php-devel-5.2.5-7.i386.rpm php-odbc-5.2.5-7.i386.rpm php-pdo-5.2.5-7.i386.rpm php-gd-5.2.5-7.i386.rpm php-pgsql-5.2.5-7.i386.rpm php-imap-5.2.5-7.i386.rpm php-snmp-5.2.5-7.i386.rpm php-ldap-5.2.5-7.i386.rpm php-5.2.5-7.i386.rpm php-mbstring-5.2.5-7.i386.rpm php-bcmath-5.2.5-7.i386.rpm php-mcrypt-5.2.5-7.i386.rpm php-xml-5.2.5-7.i386.rpm php-cli-5.2.5-7.i386.rpm php-mhash-5.2.5-7.i386.rpm php-xmlrpc-5.2.5-7.i386.rpm

install Apache2 + php5 + mysql on gentoo

Install apache2 with php, mysql and ssl

1, Modify /etc/make.conf
add those use flag : apache2 ssl pam xml xml2 pcre session unicode php mysql innodb berkdb

ns2 ~ # emerge apache mysql php
……… when it done
ns2 ~ # /usr/bin/mysql_install_db
ns2 ~ # /etc/init.d/apache restart && rc-update add apache default