Installare suPHP su Centos 6
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.
- 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
- Install the packages
- yum install -y php-cli mod_suphp
- Edit /etc/suphp.conf and adjust lines 25 and 28 respectively
- x-httpd-php=”php:/usr/bin/php-cgi”
- x-suphp-cgi=”execute:!self”
- Set PHP session directory group ownership permission
- groupadd phpsession
- chgrp phpsession /var/lib/php/session
- 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
- 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 {} +