Categories

Sunday 4 August 2013

How to install SuPHP on centos


   1. Add the RepoForge repo if you don't already have it.

        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

  2.  Install the packages

        yum install -y php-cli mod_suphp

  3.  Edit /etc/suphp.conf and adjust lines 25 and 28 respectively

        x-httpd-php="php:/usr/bin/php-cgi"
        x-suphp-cgi="execute:!self"

   4. Set PHP session directory group ownership permission

        groupadd phpsession
        chgrp phpsession /var/lib/php/session

  5.  For each VirtualHost you wish to operate under suPHP, you will need to add the following to their Apache config file in /etc/httpd/conf.d, 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

 6.   For each user operating under suPHP, you will need to add them to the phpsession group you just created otherwise they will get errors about session creation. Replace username respectively

        usermod -a -G phpsession username

    If you get a 500 Internal Server Error message, your PHP scripts and/or directories probably have incorrect permissions. You can reset all directories to rwxr-x-r-x (ie. 0755) and all files to rwxr--r-- (ie. 0644) by running the following at your HTML root

        find . * -type d -exec chmod 0755 {} +
        find . * -type f -exec chmod 0644 {} +

Ad