This is a useful guide for administrators who manage directadmin servers. Administrator sometimes wants to change the php handler to suphp instead of default mod_php. SUphp provides better protection to the server than mod_php as it runs the php scripts under the user account instead of default user apache.

 

DirectAdmin custom-build provides a very simple way to achieve this. Please follow the below steps to get this done.

 

cd /usr/local/directadmin/custombuild/
./build set php5_cgi yes
./build set php5_cli no
./build all d
./build rewrite_confs

 

Once suphp is installed on the server. The user will need to fix phpMyAdmin, Roundcube, and SquirrelMail.

 

 ./build roundcube
./build squirrelmail
./build phpmyadmin

 

Now administrators can fix the permissions of all the files and folders of the users.

 

 for i in `/bin/ls /usr/local/directadmin/data/users/` ; do chown -R $i.$i /home/$i/domains/* ; echo $i ;done 
for i in `/bin/ls /usr/local/directadmin/data/users/` ; do find /home/$i/domains/ -type f -exec chmod 644 {} \; ; echo $i ;done
for i in `/bin/ls /usr/local/directadmin/data/users/` ; do find /home/$i/domains/ -type d -exec chmod 755 {} \; ; echo $i ;done

 

One more thing to keep in mind -> Sometimes after installing suphp, websites on the server may not be working properly

 

Users can see the message "Apache is functioning normally" instead of actual websites.

 

To fix this issue follow the final step.

 

./build rewrite_confs

 

Possible errors

You might encounter the following issues:

 

Apache wouldn't start with the following message:

Starting httpd: httpd: Syntax error on line 17 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf/extra/httpd-phpmodules.conf: Cannot load /usr/lib/apache/mod_suphp.so into server: /usr/lib/apache/mod_suphp.so: cannot open shared object file: No such file or directory

 

The solution is very simple

 

./build suphp
./build rewrite_confs

 

Scripts wouldn't load in the browser with the following message:

 UID of script "/home/username/domains/domain.com/public_html/index.php" is smaller than min_uid

 

Was dit antwoord nuttig? 0 gebruikers vonden dit artikel nuttig (0 Stemmen)