View RSS Feed

admin

DirectAdmin + mod_fcgid + php fastcgi

Rate this Entry
โดย เมื่อ 5th February 2010 เวลา 13:34:39 (1996 เปิดอ่าน)
ก่อนอื่น copy & paste ตามสูตร

cd /usr/local/src
wget http://mirrors.issp.co.th/apache/httpd/mod_fcgid/mod_fcgid-2.3.5.tar.bz2
tar jxf mod_fcgid-2.3.5.tar.bz2
cd mod_fcgid-2.3.5
APXS=/usr/sbin/apxs ./configure.apxs && make && make install
chmod 755 -R /var/lib/httpd
mkdir /fcgi
ไปที่ /usr/local/directadmin/custombuild/
เปิดไฟล์ options.conf แก้ php5_cgi=yes ส่วน php อันอื่น no ให้หมด
แล้วสั่ง ./build php จนเสร็จ
แล้วเปิดไฟล์ /etc/httpd/conf/extra/httpd-info.conf
เพิ่มไอ้นี่ต่อท้าย
LoadModule fcgid_module /usr/lib/apache/mod_fcgid.so

SharememPath /var/run/fcgid_shm
SocketPath /var/lib/httpd/fcgid/sock



<IfModule mod_fcgid.c>
IdleTimeout 3600
ProcessLifeTime 7200
MaxProcessCount 128
DefaultMaxClassProcessCount 4
IPCConnectTimeout 60
IPCCommTimeout 90
DefaultInitEnv RAILS_ENV production
# DefaultInitEnv PHP_FCGI_CHILDREN 4
# MaxRequestsPerProcess 500

</IfModule>

<Directory "/home">
AllowOverride All
Options SymLinksIfOwnerMatch
Order allow,deny
Allow from all
<IfModule sapi_apache2.c>
php_admin_flag engine off

</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine off

</IfModule>

</Directory>
เสร็จแล้วเข้าไป folder /usr/local/directadmin/data/templates
เปิดไฟล์ที่ขึ้นต้นด้วย virtual_host2*.conf (มีทั้งหมด 4 ไฟล์)
ใน section เดิมที่เป็น PHP ทั้งหมด ให้ comment ไว้ จะได้ประมาณนี้
|*if CLI="1"|
# php_admin_flag engine |PHP|
#
# php_admin_flag safe_mode |SAFE_MODE|
#
# php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f |USER|@|DOMAIN|'
|*endif|
|*if OPEN_BASEDIR="ON"|
# php_admin_value open_basedir |OPEN_BASEDIR_PATH|
|*endif|
|*if SUPHP="1"|
# suPHP_Engine |PHP|
# suPHP_UserGroup |USER| |GROUP|
|*endif|
แล้วแทรกไอ้นี่เข้าไปด้านบนของไอ้เมื่อกี้
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI

</Files>

</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper "/fcgi/|USER|/public_html/fcgid.sh" .php
Options +ExecCGI
allow from all

</Files>

</IfModule>
แล้วเข้าไป folder /usr/local/directadmin/scripts/custom/
สร้างไฟล์ชื่อ fcgid.sh ใส่ข้อมูลตามนี้
#!/bin/sh
export PHP_FCGI_MAX_REQUESTS=0
exec /usr/local/php5/bin/php-cgi
ใน folder เดียวกัน สร้างไฟล์ชื่อ domain_create_post.sh ใส่ข้อมูลตามนี้
#!/bin/sh

mkdir -p /fcgi/${username}/public_html
cp /usr/local/directadmin/scripts/custom/fcgid.sh /fcgi/${username}/public_html/fcgid.sh && chmod 0700 /fcgi/${username}/public_html/fcgid.sh
cp /usr/local/directadmin/scripts/custom/php.ini /fcgi/${username}/public_html/php.ini
perl -pi -w -e "s/PHPCFG_BASEDIR/\/home\/${username}\//g;" /fcgi/${username}/public_html/php.ini
chown -R ${username}:${username} /fcgi/${username}
echo "`date` ${domain} created " >> /var/log/directadmin/domain_create.log
แล้วสั่ง copy file php.ini มาใส่ไว้ใน /usr/local/directadmin/scripts/custom/php.ini
เปิดไฟล์ /usr/local/directadmin/scripts/custom/php.ini ที่ก๊อปมาเมื่อกี้ แล้วหา open_basedir
ซึ่งปกติมันจะ comment ไว้ ให้แก้เป็นประมาณนี้
Code:
open_basedir = PHPCFG_BASEDIR:/tmp:/var/tmp
เสร็จแล้วสั่ง chmod a+x /usr/local/directadmin/scripts/custom/*.sh
*** วิธีทั้งหมดไม่รับประกันผล และควรใช้กับเครื่องเพิ่งลงใหม่เท่านั้น


ที่มา icez network
ป้ายกำกับ: directadmin, fastcgi, install, PHP Coding เพิ่ม / แก้ไข ป้ายกำกับ
หัวข้อ
How To , Linux , Software

ความคิดเห็น

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31