Install suPHP Using EasyApache
Configure suPHP
Verify The Configuration
It’s important to pick a maintenance window that is less intrusive on your users or customers. The rebuild of Apache to support suPHP can cause down time. So be sure to send out a friendly email to your customers.
Install suPHP Using EasyApache
There are two ways to launch the EasyApache program. The first one is through SSH and the other via WHM. I prefer SSH so the rest of this guide will be based on that method. So go ahead and remote into the server as user root. Once logged in, run the easyapache script as such
/scripts/easyapache
The first textual screen that pops up will say the following: “Please choose a profile to load.” Simply hit the Tab key twice. The textual box “Start customizing based on profile” will become highlighted. At which point will hit the Enter key on your keyboard. Once you hit Enter, you will be presented with another screen. This time the screen says: “Please choose which apache to build.” Simply hit the Tab key once and then hit Enter again.
There are two more screen to go and we’re done. After hitting the Enter key above, another screen will pop up. This time it says: Please choose which main PHP versions (if any) to build.” Hit the Tab key once and then the Enter key. Follow the same instructions for the screen with title “Please choose which specific PHP version(s) to build.” The next screen, however, is very important. This is where we get to pick the suPHP module that we are building. Once you hit Enter in the previous step, the screen “Short Options List” comes up. Go ahead and hit the Tab key a few times until “Exhaustive Options List” is highlighted then press Enter. Scroll down the list of options until you cursor is on the entry “Mod SuPHP…”. Hit the Space key once to check the box. Hit the Tab key once then Enter, then select “Save and Build”. Answer Yes to all questions
At this point the build has started. Wait for the build to complete. It’s important that no one uses WHM while the build is in progress. The build takes about 20 minutes to complete depending on server resources. Once the build is finished, proceed to step 2 below.
Configure suPHP
This is an important step because it formally enables suPHP. Simply run the following command
/usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1
We’re essentially telling it that we want PHP version 5 running on suPHP and SUEXEC. To verify that command has taken effect run the following command. The output should be indentical:
# /usr/local/cpanel/bin/rebuild_phpconf –current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled
So far so good! Now go ahead and restart Apache by running the following command:
/scripts/restartsrv_httpd
Verify The Configuration
At this point all should be working fine. But it’s prudent to keep an eye on the suPHP log file as that’s where errors and warnings show up. The suPHP log file is located here:
/usr/local/apache/logs/suphp_log
Most errors are related to permissions on PHP files. suPHP is very picky about permission and / or file ownership so be sure your PHP files have permission 755 and are owned by the same user account. You can change permission on any file using the following command:
chmod 755
You can also change file ownership using the chown command:
chown user.user
Additional information:
After installing suPHP and before changing the PHP handler from your default one to suPHP, there are a few configuration options that need to be checked.
1) Check if the suPHP module is correctly loaded in the Apache configuration file.
# LoadModule suphp_module libexec/mod_suphp.so
2) Run the below scripts to double check the server settings:
# /scripts/postsuexecinstall
# /scripts/chownpublichtmls
3) Lets check the permissions now.
If there are files with either 777 or 666 permission inside the document root, you are most likely to get Internal Server Errors.
find /home/*/public_html/ -perm 777 -exec ls {} \;
find /home/*/public_html/ -perm 777 -exec ls {} \;
Set 755 and 644 respectively, for the files that gets listed in the above command.
4) Check the CGI scripts as well
# /scripts/fixsuexeccgiscripts
5) Last but not the least, make sure that there are no php_flags in the domain’s .htaccess file.
# grep -iRl php /home/*/public_html/.htaccess
If you want to use php flags for the domains, create a custom php.ini file and place it in the domain’s web root.
No comments:
Post a Comment