DirectAdmin / Switching a direct admin server to suphp server

  • Sunny
  • 4000 Views
  • 0 Comment
  • No tags

You can convert your cli Direct Admin server to suphp server by following below steps.

Step: 01
cd /usr/local/directadmin/custombuild

Step: 02

Open options.conf and make following changes in it
Replace
php5_cli=yes
php5_cgi=no
with
php5_cli=no
php5_cgi=yes

Step: 03

Then
./build update
./build all d

Note: All logs for suPhp are stored in: /var/log/suphp.log

Step: 04

cd /usr/local/directadmin/scripts/custom && \
wget http://65.99.205.78/active-neubox/user_destroy_pre.sh && \
wget http://65.99.205.78/active-neubox/user_create_post.sh && \
chmod 755 /usr/local/directadmin/scripts/custom/*.sh && \
chown diradmin:diradmin /usr/local/directadmin/scripts/custom/*.sh

Step: 05

Execute following one liner to create php.ini file for each user.
1
    
ls -l /home | grep '^d' | awk '{system("username="$3" /usr/local/directadmin/scripts/custom/user_create_post.sh")}' 2>/dev/null

Step: 06

Copy VirtualHost templates to custom directory so they are not overwritten when DirectAdmin updates and do Step: 07 on each copied file.
1
    
cp /usr/local/directadmin/data/templates/virtual_host2* /usr/local/directadmin/data/templates/custom/

Step: 07

Open each file in /usr/local/directadmin/data/templates/custom/ and insert following
1
    
SetEnv PHP_INI_SCAN_DIR /usr/local/directadmin/data/users/|USER|/php/

between
1
    
|*if SUPHP="1"|

and
1
    
|*endif|

Step: 08

Rewrite httpd configs for current users

cd /usr/local/directadmin/custombuild
1
    
./build rewrite_confs

You will get "Internal Server Error" for many sites becuase of permissions and php flgs in .htaccess file.

Note: After swithcing to suphp, php will no longer a apache module and so you can’t control php variables with .htaccess. If you do so, it will result in "Internal Server Error".

If you get any “Internal Server Error” messages, check the suphp.log to see why.
Usually, things like writeable by “all” or “group” or having the incorrect ownership of the file or php flags in .htaccess file would cause this.

To easy up the permission things download the permission fixer from following script and execute it.
1
    
wget http://65.99.205.78/active-neubox/fix_perm.sh

Also you can find out all “.htaccess” file which contains php flags by following one liner.
1
    
find /home/*/domains/*/public_html -name ".htaccess" | xargs grep "php_"

Note: You can easily automate replacing php flags from .htaccess using sed

Don’t for get to set open_base dir in server wide php.ini file. The server wide open base dir should be like following
1
    
open_basedir = /var/www/html/:/tmp/:/etc/virtual/

 

0 Comments
Leave a comment
OUR SERVICES
OUR TECHNOLOGIES