cd /usr/local/directadmin/data/templates
cp virtual_host2*.conf custom
cd custom
添加下方代码至virtual_host2*.conf文件中的“<VirtualHost |IP|:|PORT_80| |MULTI_IP|>”类似这个下方即可
SetEnv PHP_INI_SCAN_DIR /usr/local/directadmin/data/users/|USER|/php/
vi /usr/local/directadmin/scripts/custom/user_create_post.sh
#!/bin/sh
HOME=/home/$username
OBD=”${HOME}/:/tmp:/var/tmp:/usr/local/lib/php/”
P=/usr/local/directadmin/data/users/$username
if [ ! -e ${P}/php ]; then
mkdir ${P}/php
fi
PI=${P}/php/php.ini
cp -f /usr/local/lib/php.ini.template ${PI}
TMP=”perl -pi -e ‘s#open_basedir = OBD#open_basedir = ${OBD}#’ ${PI}”
eval $TMP
TMP=”perl -pi -e ‘s#HOME#${HOME}#’ ${PI}”
eval $TMP
exit 0;
vi /usr/local/lib/php.ini.template
[PHP]
open_basedir = OBD
mail.log = HOME/.php/php-mail.log
vi add_php_ini.sh(任意位置)
#!/bin/sh
for i in `ls /usr/local/directadmin/data/users`; do
{
username=$i /usr/local/directadmin/scripts/custom/user_create_post.sh
};
done;
exit 0;
./user_create_post.sh
./add_php_ini.sh
test