How to install suPHP Setup on CentOS 6.x
Add RPM Forge repository.
32-bit:
rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
64-bit:
rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Disable RPMForge by default (if you leave things like this enabled, it will break your system).
# sed -i ‘s/enabled = 1/enabled = 0/g’ /etc/yum.repos.d/rpmforge.repo
Install mod_suphp via yum:
Install suPHP
# yum install mod_suphp -y –enablerepo=rpmforge
Edit PHP Handler:
sed -i ‘s/x-httpd-php=php:\/usr\/bin\/php/x-httpd-php=\”php:\/usr\/bin\/php-cgi\”/g’ /etc/suphp.conf
If you do not perform the above (replace “x-httpd-php=php:/usr/bin/php” with “x-httpd-php=”php:/usr/bin/php-cgi””) you will get the similar issues to the following errors:
[error] [client] SecurityException in Application.cpp:511: Unknown Interpreter: php
[error] [client] Premature end of script headers: index.php
Example vhost config (/etc/httpd/conf.d/example.com.conf
<VirtualHost ip-address:80>
NameVirtualHost example.com
ServerName example.com
ServerAlias www.example.com
ServerAdmin [email protected]
DocumentRoot /path/to/web/document/root
ErrorLog /var/log/httpd/example.com-error_log
CustomLog /var/log/httpd/example.com-access_log combined
DirectoryIndex index.php index.htmlsuPHP_Engine on
suPHP_UserGroup user group
AddHandler x-httpd-php .php
suPHP_AddHandler x-httpd-php<Directory />
AllowOverride All
</Directory>
</VirtualHost>