Dobbiamo aver già installato Apache, MySQL e PHP.
Abbiamo anche bisogno di php-cli modulo installato in modo dettagliato.

I’m assuming you’ve already successfully installed Apache, MySQL and PHP. You will also need the php-cli module installed as detailed.

  1. Add the RepoForge repo if you don’t already have it.
    1. 32-bit:
    2. rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
    3. 64-bit:
    4. rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
  1. Install the packages
    1. yum install -y php-cli mod_suphp
  1. Edit /etc/suphp.conf and adjust lines 25 and 28 respectively
    1. x-httpd-php=”php:/usr/bin/php-cgi”
    2. x-suphp-cgi=”execute:!self”

     

  2. Set PHP session directory group ownership permission
    1. groupadd phpsession
    2. chgrp phpsession /var/lib/php/session

     

  3. 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
    1. suPHP_Engine on
    2. suPHP_UserGroup username group
    3. AddHandler x-httpd-php .php .php3 .php4 .php5
    4. suPHP_AddHandler x-httpd-php

     

  4. 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
    1. usermod -a -G phpsession username

     

  5. 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
    1. find . * -type d -exec chmod 0755 {} +
    2. find . * -type f -exec chmod 0644 {} +