Home » Centos/RHEL » Apache » Install and Configure mod_suphp on centos/rhel

Install and Configure mod_suphp on centos/rhel

suPHP is a tool for executing PHP scripts with the permissions of their owners. There are some significant improvments in suPHP

If you have already successfully installed Apache, PHP and Mysql, on the server then follow the below steps.
Install and Configure mod_suphp.
1. Add the RepoForge repo
Fort 32-bit:

#rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

For 64-bit:

#rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

2. Now Install the following packages.

#yum install -y php-cli mod_suphp

After install package make sure /etc/suphp.conf must have the below contents

[global]
logfile=/var/log/httpd/suphp_log
loglevel=info
webserver_user=apache
docroot=/
env_path=/bin:/usr/bin
umask=0022
;min_uid=500
;min_gid=500

; Security options
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=false

;full_php_process_display=true
;Send minor error messages to browser
errors_to_browser=false

[handlers]
;Handler for php-scripts
;x-httpd-php=”php:/usr/bin/php”
x-httpd-php=”php:/usr/bin/php-cgi”
application/x-httpd-php=”php:/usr/bin/php”
application/x-httpd-php4=”php:/usr/php4/bin/php”
application/x-httpd-php5=”php:/usr/bin/php”

;Handler for CGI-scripts
;x-suphp-cgi=”execute:!self”

Then open /etc/httpd/conf.d/suphp.conf and uncomment the below lines.

LoadModule suphp_module modules/mod_suphp.so
suPHP_Engine on
AddHandler x-httpd-php .php .php4 .php3 .php5 .phtml
suPHP_ConfigPath /etc
suPHP_UserGroup apache apache

For each VirtualHost you have to append the following lines, replacing username and group respectively

suPHP_Engine on
suPHP_UserGroup username group
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php

And now restart the apache server.

#service httpd restart

That’s it.

About

I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry from last 7 years.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud