|
@@ -63,8 +63,9 @@ make clean
|
|
|
./buildconf
|
|
|
[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir
|
|
|
[ "$PHP_cache" == '1' ] && PHP_cache_tmp='--enable-opcache' || PHP_cache_tmp='--disable-opcache'
|
|
|
-if [[ $Apache_version =~ ^[1-2]$ ]];then
|
|
|
+if [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then
|
|
|
./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \
|
|
|
+--with-config-file-scan-dir=$php_install_dir/etc/php.d \
|
|
|
--with-apxs2=$apache_install_dir/bin/apxs $PHP_cache_tmp --disable-fileinfo \
|
|
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
|
|
--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
|
|
@@ -75,6 +76,7 @@ if [[ $Apache_version =~ ^[1-2]$ ]];then
|
|
|
--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug
|
|
|
else
|
|
|
./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \
|
|
|
+--with-config-file-scan-dir=$php_install_dir/etc/php.d \
|
|
|
--with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm $PHP_cache_tmp --disable-fileinfo \
|
|
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
|
|
--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
|
|
@@ -102,6 +104,7 @@ fi
|
|
|
# wget -c http://pear.php.net/go-pear.phar
|
|
|
# $php_install_dir/bin/php go-pear.phar
|
|
|
|
|
|
+[ ! -e "$php_install_dir/etc/php.d" ] && mkdir -p $php_install_dir/etc/php.d
|
|
|
/bin/cp php.ini-production $php_install_dir/etc/php.ini
|
|
|
|
|
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini
|
|
@@ -118,25 +121,25 @@ sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/et
|
|
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini
|
|
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini
|
|
|
|
|
|
-if [ "$PHP_cache" == '1' ];then
|
|
|
- sed -i 's@^\[opcache\]@[opcache]\nzend_extension=opcache.so@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.enable=.*@opcache.enable=1@' $php_install_dir/etc/php.ini
|
|
|
- sed -i "s@^;opcache.memory_consumption.*@opcache.memory_consumption=$Memory_limit@" $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.interned_strings_buffer.*@opcache.interned_strings_buffer=8@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.max_accelerated_files.*@opcache.max_accelerated_files=4000@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.revalidate_freq.*@opcache.revalidate_freq=60@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.save_comments.*@opcache.save_comments=0@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.fast_shutdown.*@opcache.fast_shutdown=1@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.validate_timestamps.*@opcache.validate_timestamps=1@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.enable_cli.*@opcache.enable_cli=1@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.use_cwd.*@opcache.use_cwd=1@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^opcache.max_accelerated_files.*@opcache.max_accelerated_files=100000@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.max_wasted_percentage.*@opcache.max_wasted_percentage=5@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.consistency_checks.*@opcache.consistency_checks=0@' $php_install_dir/etc/php.ini
|
|
|
- sed -i 's@^;opcache.optimization_level.*@;opcache.optimization_level=0@' $php_install_dir/etc/php.ini
|
|
|
-fi
|
|
|
+[ "$PHP_cache" == '1' ] && cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
|
|
|
+[opcache]
|
|
|
+zend_extension=opcache.so
|
|
|
+opcache.enable=1
|
|
|
+opcache.enable_cli=1
|
|
|
+opcache.memory_consumption=$Memory_limit
|
|
|
+opcache.interned_strings_buffer=8
|
|
|
+opcache.max_accelerated_files=100000
|
|
|
+opcache.max_wasted_percentage=5
|
|
|
+opcache.use_cwd=1
|
|
|
+opcache.validate_timestamps=1
|
|
|
+opcache.revalidate_freq=60
|
|
|
+opcache.save_comments=0
|
|
|
+opcache.fast_shutdown=1
|
|
|
+opcache.consistency_checks=0
|
|
|
+;opcache.optimization_level=0
|
|
|
+EOF
|
|
|
|
|
|
-if [[ ! $Apache_version =~ ^[1-2]$ ]];then
|
|
|
+if [[ ! $Apache_version =~ ^[1-2]$ ]] && [ ! -e "$apache_install_dir/bin/apxs" ];then
|
|
|
# php-fpm Init Script
|
|
|
/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
|
|
|
chmod +x /etc/init.d/php-fpm
|
|
@@ -231,7 +234,7 @@ EOF
|
|
|
#[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf
|
|
|
service php-fpm start
|
|
|
|
|
|
-elif [[ $Apache_version =~ ^[1-2]$ ]];then
|
|
|
+elif [[ $Apache_version =~ ^[1-2]$ ]] || [ -e "$apache_install_dir/bin/apxs" ];then
|
|
|
service httpd restart
|
|
|
fi
|
|
|
cd ..
|