pull/121/head
midoks 3 years ago
parent b12816a502
commit a5f0c851a4
  1. 194
      plugins/php-yum/conf/php7.ini
  2. 194
      plugins/php-yum/conf/php8.ini
  3. 17
      plugins/php-yum/conf/www.conf
  4. 53
      plugins/php-yum/index.py
  5. 16
      plugins/php-yum/init.d/php.service.tpl
  6. 154
      plugins/php-yum/init.d/php.tpl
  7. 139
      plugins/php-yum/init.d/php52.tpl
  8. 89
      plugins/php-yum/versions/71/install.sh
  9. 90
      plugins/php-yum/versions/72/install.sh
  10. 94
      plugins/php-yum/versions/73/install.sh

@ -1,194 +0,0 @@
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
max_input_vars = 1000
memory_limit = 128M
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 20M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
always_populate_raw_post_data=-1
file_uploads = On
upload_tmp_dir = "{$SERVER_PATH}/php/tmp/upload"
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
disable_functions = exec,passthru,shell_exec,system,popen,parse_ini_file,show_source
[CLI Server]
cli_server.color = On
[Date]
date.timezone = PRC
[filter]
[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encoding = ISO-8859-1
iconv.output_encoding = ISO-8859-1
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = On
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.save_path = "{$SERVER_PATH}/php/tmp/session"
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatibility_mode = Off
mssql.secure_connection = Off
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="{$SERVER_PATH}/php/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1

@ -1,194 +0,0 @@
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
max_input_vars = 1000
memory_limit = 128M
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 20M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
always_populate_raw_post_data=-1
file_uploads = On
upload_tmp_dir = "{$SERVER_PATH}/php/tmp/upload"
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
disable_functions = exec,passthru,shell_exec,system,popen,parse_ini_file,show_source
[CLI Server]
cli_server.color = On
[Date]
date.timezone = PRC
[filter]
[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encoding = ISO-8859-1
iconv.output_encoding = ISO-8859-1
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = On
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.save_path = "{$SERVER_PATH}/php/tmp/session"
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatibility_mode = Off
mssql.secure_connection = Off
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="{$SERVER_PATH}/php/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[ldap]
ldap.max_links = -1

@ -1,15 +1,20 @@
[www]
user = {$PHP_USER}
group = {$PHP_GROUP}
listen = /tmp/php-cgi-{$PHP_VERSION}.sock
listen = /var/opt/remi/php{$PHP_VERSION}/run/php-fpm/www.sock
listen.owner = {$PHP_USER}
listen.group = {$PHP_GROUP}
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.status_path = /phpfpm_status_{$PHP_VERSION}
request_terminate_timeout = 100
request_slowlog_timeout = 30
slowlog = {$SERVER_PATH}/php/{$PHP_VERSION}/var/log/www-slow.log
/var/opt/remi/php{$PHP_VERSION}/log/php-fpm/www-error.log
slowlog = /var/opt/remi/php{$PHP_VERSION}/log/php-fpm/www-slow.log
php_admin_flag[log_errors] = on
php_admin_value[error_log] = /var/opt/remi/php{$PHP_VERSION}/log/php-fpm/error.log

@ -28,18 +28,12 @@ def getPluginName():
return 'php-yum'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return '/etc/opt/remi'
def getInitDFile(version):
if app_debug:
return '/tmp/' + getPluginName()
return '/etc/init.d/' + getPluginName() + version
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getArgs():
@ -148,11 +142,8 @@ def makeOpenrestyConf():
for x in phpversions:
dfile = sdir + '/web_conf/php/conf/enable-php-' + x + '.conf'
if not os.path.exists(dfile):
if x == '00':
mw.writeFile(dfile, 'set $PHP_ENV 0;')
else:
w_content = contentReplace(tpl_content, x)
mw.writeFile(dfile, w_content)
w_content = contentReplace(tpl_content, x)
mw.writeFile(dfile, w_content)
# php-fpm status
for version in phpversions:
@ -164,15 +155,6 @@ def makeOpenrestyConf():
mw.writeFile(dfile, content)
def phpPrependFile(version):
app_start = getServerDir() + '/app_start.php'
if not os.path.exists(app_start):
tpl = getPluginDir() + '/conf/app_start.php'
content = mw.readFile(tpl)
content = contentReplace(content, version)
mw.writeFile(app_start, content)
def phpFpmReplace(version):
desc_php_fpm = getServerDir() + '/' + version + '/etc/php-fpm.conf'
if not os.path.exists(desc_php_fpm):
@ -188,39 +170,34 @@ def phpFpmReplace(version):
def phpFpmWwwReplace(version):
service_php_fpm_dir = getServerDir() + '/' + version + '/etc/php-fpm.d/'
service_php_fpm_dir = getServerDir() + '/php' + version + '/php-fpm.d/'
if not os.path.exists(service_php_fpm_dir):
os.mkdir(service_php_fpm_dir)
service_php_fpmwww = service_php_fpm_dir + '/www.conf'
if not os.path.exists(service_php_fpmwww):
if os.path.exists(service_php_fpmwww):
# 原来文件备份
mw.execShell('mw ' + service_php_fpmwww +
' ' + service_php_fpmwww + '.bak')
service_php_fpm_mw = service_php_fpm_dir + '/mw.conf'
if not os.path.exists(service_php_fpm_mw):
tpl_php_fpmwww = getPluginDir() + '/conf/www.conf'
content = mw.readFile(tpl_php_fpmwww)
content = contentReplace(content, version)
mw.writeFile(service_php_fpmwww, content)
mw.writeFile(service_php_fpm_mw, content)
def getFpmConfFile(version):
return getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
def makePhpIni(version):
dst_ini = mw.getServerDir() + '/php/' + version + '/php.ini'
if not os.path.exists(dst_ini):
src_ini = getPluginDir() + '/conf/php' + version[0:1] + '.ini'
# shutil.copyfile(s_ini, d_ini)
content = mw.readFile(src_ini)
content = contentReplace(content, version)
mw.writeFile(dst_ini, content)
def initReplace(version):
# makeOpenrestyConf()
# makePhpIni(version)
# phpPrependFile(version)
# phpFpmWwwReplace(version)
phpFpmWwwReplace(version)
# phpFpmReplace(version)
# systemd
@ -429,7 +406,7 @@ def setMaxSize(version):
def getFpmConfig(version):
filefpm = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
filefpm = getFpmConfFile(version)
conf = mw.readFile(filefpm)
data = {}
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"

@ -1,16 +0,0 @@
# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades. If you want to customize,
# the best way is to use the "systemctl edit" command.
[Unit]
Description=The PHP {$VERSION} FastCGI Process Manager
After=network.target
[Service]
PIDFile={$SERVER_PATH}/php/{$VERSION}/var/run/php-fpm.pid
ExecStart={$SERVER_PATH}/php/{$VERSION}/sbin/php-fpm --nodaemonize --fpm-config {$SERVER_PATH}/php/{$VERSION}/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=false
[Install]
WantedBy=multi-user.target

@ -1,154 +0,0 @@
#! /bin/sh
# chkconfig: 2345 55 25
# description: PHP Service
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
prefix={$SERVER_PATH}/php/{$PHP_VERSION}
exec_prefix=${prefix}
php_fpm_BIN=${exec_prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN --daemonize $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-quit"
exit 1
else
echo " done"
fi
;;
status)
if [ ! -r $php_fpm_PID ] ; then
echo "php-fpm is stopped"
exit 0
fi
PID=`cat $php_fpm_PID`
if ps -p $PID | grep -q $PID; then
echo "php-fpm (pid $PID) is running..."
else
echo "php-fpm dead but pid file exists"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload|status}"
exit 1
;;
esac

@ -1,139 +0,0 @@
#! /bin/sh
php_fpm_BIN=/www/server/php/52/bin/php-cgi
php_fpm_CONF=/www/server/php/52/etc/php-fpm.conf
php_fpm_PID=/www/server/php/52/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php_fpm "
$php_fpm_BIN --fpm $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
stop)
echo -n "Shutting down php_fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
quit)
echo -n "Gracefully shutting down php_fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
logrotate)
echo -n "Re-opening php-fpm log file "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR1 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|quit|restart|reload|logrotate}"
exit 1
;;
esac

@ -1,89 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.1.33
PHP_VER=71
Install_php()
{
#------------------------ install start ------------------------------------#
echo "安装php-${version} ..." > $install_tmp
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libiconv.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
fi
OPTIONS=''
if [ $sysName == 'Darwin' ]; then
OPTIONS='--without-iconv'
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old"
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib"
OPTIONS="${OPTIONS} --with-curl"
fi
if [ ! -d $serverPath/php/71 ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/71 \
--exec-prefix=$serverPath/php/71 \
--with-config-file-path=$serverPath/php/71/etc \
--with-zlib-dir=$serverPath/lib/zlib \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-zip \
--enable-mbstring \
--enable-simplexml \
--enable-ftp \
--enable-sockets \
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm
make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
$serverPath/php/init.d/php71 stop
rm -rf $serverPath/php/71
echo "卸载php-${version}..." > $install_tmp
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi

@ -1,90 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.2.31
PHP_VER=72
Install_php()
{
#------------------------ install start ------------------------------------#
echo "安装php-${version} ..." > $install_tmp
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libiconv.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
fi
OPTIONS=''
if [ $sysName == 'Darwin' ]; then
OPTIONS='--without-iconv'
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old"
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib"
OPTIONS="${OPTIONS} --with-curl"
fi
if [ ! -d $serverPath/php/72 ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/72 \
--exec-prefix=$serverPath/php/72 \
--with-config-file-path=$serverPath/php/72/etc \
--with-zlib-dir=$serverPath/lib/zlib \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-zip \
--enable-mbstring \
--enable-simplexml \
--enable-sockets \
--enable-ftp \
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm
make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
$serverPath/php/init.d/php72 stop
rm -rf $serverPath/php/72
echo "卸载php-${version}..." > $install_tmp
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi

@ -1,94 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.3.33
PHP_VER=73
Install_php()
{
#------------------------ install start ------------------------------------#
echo "安装php-${version} ..." > $install_tmp
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libiconv.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libzip.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
fi
OPTIONS=''
if [ $sysName == 'Darwin' ]; then
OPTIONS='--without-iconv'
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
# OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
# OPTIONS="${OPTIONS} --enable-zip"
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old"
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib"
OPTIONS="${OPTIONS} --with-curl"
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
fi
if [ ! -d $serverPath/php/73 ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/73 \
--exec-prefix=$serverPath/php/73 \
--with-config-file-path=$serverPath/php/73/etc \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-mbstring \
--with-zlib-dir=$serverPath/lib/zlib \
--enable-ftp \
--enable-sockets \
--enable-simplexml \
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm
make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
$serverPath/php/init.d/php73 stop
rm -rf $serverPath/php/73
echo "卸载php-${version}..." > $install_tmp
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi
Loading…
Cancel
Save