diff --git a/plugins/mysql-community/conf/my8.0.cnf b/plugins/mysql-community/conf/my8.0.cnf index 388b397eb..02c484b44 100644 --- a/plugins/mysql-community/conf/my8.0.cnf +++ b/plugins/mysql-community/conf/my8.0.cnf @@ -8,7 +8,8 @@ default-character-set = UTF8MB4 [mysqld] !include {$SERVER_APP_PATH}/etc/mode/classic.cnf -authentication_policy=mysql_native_password +authentication_policy=caching_sha2_password + pid-file = {$SERVER_APP_PATH}/data/mysql.pid user = mysql port = 33206 diff --git a/plugins/mysql-community/index.py b/plugins/mysql-community/index.py index b9283a12d..eded6c1be 100755 --- a/plugins/mysql-community/index.py +++ b/plugins/mysql-community/index.py @@ -130,6 +130,11 @@ def getAuthPolicy(): tmp = re.search(rep, content) if tmp: return tmp.groups()[0].strip() + + rep2 = r'default-authentication-plugin\s*=\s*(.*)' + tmp2 = re.search(rep, content) + if tmp2: + return tmp2.groups()[0].strip() # caching_sha2_password return 'mysql_native_password' diff --git a/plugins/mysql-community/install.sh b/plugins/mysql-community/install.sh index 35e594f48..4689daac5 100755 --- a/plugins/mysql-community/install.sh +++ b/plugins/mysql-community/install.sh @@ -10,15 +10,18 @@ serverPath=$(dirname "$rootPath") # https://dev.mysql.com/downloads/mysql/ # https://downloads.mysql.com/archives/community/ +# SHOW VARIABLES LIKE 'default_authentication_plugin'; +# SELECT user, host, plugin FROM mysql.user; +# default_authentication_plugin=caching_sha2_password # /www/server/mysql-community/bin/mysqld --basedir=/www/server/mysql-community --datadir=/www/server/mysql-community/data --initialize-insecure --explicit_defaults_for_timestamp - -# cd /www/server/mdserver-web/plugins/mysql-community && bash install.sh install 8.0 -# cd /www/server/mdserver-web/plugins/mysql-community && bash install.sh uninstall 8.0 -# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-community/index.py start 5.7 -# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-community/index.py fix_db_access -# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py do_full_sync {"db":"xxx","sign":"","begin":1} +# source bin/activate +# cd /www/server/mdserver-web/plugins/mysql-community && bash install.sh install 9.0 +# cd /www/server/mdserver-web/plugins/mysql-community && bash install.sh uninstall 9.0 +# cd /www/server/mdserver-web && python3 plugins/mysql-community/index.py start 8.0 +# cd /www/server/mdserver-web && python3 plugins/mysql-community/index.py fix_db_access +# cd /www/server/mdserver-web && python3 plugins/mysql/index.py do_full_sync {"db":"xxx","sign":"","begin":1} action=$1 type=$2 diff --git a/plugins/php-apt/conf/app_start.php b/plugins/php-apt/conf/app_start.php index 8a21a7cd4..5d1b7ce8c 100644 --- a/plugins/php-apt/conf/app_start.php +++ b/plugins/php-apt/conf/app_start.php @@ -1,7 +1,7 @@ save_run($xhprof_data, 'xhprof_foo'); + $run_id = $xhprof_runs->save_run($xhprof_data, 'xhprof_foo'); - $profiler_url = sprintf('http://{$LOCAL_IP}:5858/index.php?run=%s&source=xhprof_foo', $run_id); - echo ""; - // echo 'Profiler output'; + $profiler_url = sprintf('http://{$LOCAL_IP}:5858/index.php?run=%s&source=xhprof_foo', $run_id); + // echo ""; + + $style_css = 'position:fixed;bottom: 0px;right: 0px;z-index: 100000000;color: red;background-color: black;padding: 0px;margin: 0px;'; + echo 'XHProf分析结果'; } if (extension_loaded('xhprof') - && isset($_GET[XHProf_Name]) && $_GET[XHProf_Name] == 'ok' && - (!in_array($_SERVER['SCRIPT_NAME'], array('/xhprof_html/callgraph.php', - '/xhprof_html/index.php')))) { - app_xhprof_start(); - include_once $_SERVER['SCRIPT_FILENAME']; - app_xhprof_end(); - exit; + && isset($_GET[XHProf_Name]) && $_GET[XHProf_Name] == 'ok' && + (! in_array($_SERVER['SCRIPT_NAME'], ['/xhprof_html/callgraph.php', + '/xhprof_html/index.php']))) { + app_xhprof_start(); + include_once $_SERVER['SCRIPT_FILENAME']; + app_xhprof_end(); + exit; } ?> diff --git a/plugins/php-apt/index_php_apt.py b/plugins/php-apt/index_php_apt.py index c6b4301b0..15eaed2b6 100755 --- a/plugins/php-apt/index_php_apt.py +++ b/plugins/php-apt/index_php_apt.py @@ -140,8 +140,7 @@ def libConfCommon(version): phplib = json.loads(mw.readFile(libpath)) libs = [] - tasks = mw.M('tasks').where( - "status!=?", ('1',)).field('status,name').select() + tasks = mw.M('tasks').where("status!=?", ('1',)).field('status,name').select() for lib in phplib: lib['task'] = '1' for task in tasks: diff --git a/plugins/php-apt/versions/all_test.sh b/plugins/php-apt/versions/all_test.sh index bd5b241d4..975893121 100644 --- a/plugins/php-apt/versions/all_test.sh +++ b/plugins/php-apt/versions/all_test.sh @@ -19,7 +19,7 @@ serverPath=$(dirname "$rootPath") # cd /www/server/mdserver-web/plugins/php-apt/versions && /bin/bash common.sh 7.1 install swoole -PHP_VER_LIST=(56 70 71 72 73 74 80 81) +PHP_VER_LIST=(56 70 71 72 73 74 80 81 82 83 84) for PHP_VER in ${PHP_VER_LIST[@]}; do echo "php${PHP_VER} -- start" if [ ! -d /www/server/php-apt/${PHP_VER} ];then @@ -31,7 +31,7 @@ done cd $curPath -PHP_VER_LIST_EXT=(56 70 71 72 73 74 80 81) +PHP_VER_LIST_EXT=(56 70 71 72 73 74 80 81 82 83 84) PHP_EXT_LIST=(ioncube pdo mysqlnd sqlite3 odbc opcache mcrypt fileinfo \ exif gd intl memcache memcached redis imagick xdebug xhprof \ swoole yaf phalcon yar mongodb yac solr seaslog mbstring zip zstd) diff --git a/plugins/php-yum/conf/app_start.php b/plugins/php-yum/conf/app_start.php index 8a21a7cd4..5d1b7ce8c 100644 --- a/plugins/php-yum/conf/app_start.php +++ b/plugins/php-yum/conf/app_start.php @@ -1,7 +1,7 @@ save_run($xhprof_data, 'xhprof_foo'); + $run_id = $xhprof_runs->save_run($xhprof_data, 'xhprof_foo'); - $profiler_url = sprintf('http://{$LOCAL_IP}:5858/index.php?run=%s&source=xhprof_foo', $run_id); - echo ""; - // echo 'Profiler output'; + $profiler_url = sprintf('http://{$LOCAL_IP}:5858/index.php?run=%s&source=xhprof_foo', $run_id); + // echo ""; + + $style_css = 'position:fixed;bottom: 0px;right: 0px;z-index: 100000000;color: red;background-color: black;padding: 0px;margin: 0px;'; + echo 'XHProf分析结果'; } if (extension_loaded('xhprof') - && isset($_GET[XHProf_Name]) && $_GET[XHProf_Name] == 'ok' && - (!in_array($_SERVER['SCRIPT_NAME'], array('/xhprof_html/callgraph.php', - '/xhprof_html/index.php')))) { - app_xhprof_start(); - include_once $_SERVER['SCRIPT_FILENAME']; - app_xhprof_end(); - exit; + && isset($_GET[XHProf_Name]) && $_GET[XHProf_Name] == 'ok' && + (! in_array($_SERVER['SCRIPT_NAME'], ['/xhprof_html/callgraph.php', + '/xhprof_html/index.php']))) { + app_xhprof_start(); + include_once $_SERVER['SCRIPT_FILENAME']; + app_xhprof_end(); + exit; } ?> diff --git a/plugins/php-yum/index_php_yum.py b/plugins/php-yum/index_php_yum.py index 17bae712b..07f623974 100755 --- a/plugins/php-yum/index_php_yum.py +++ b/plugins/php-yum/index_php_yum.py @@ -54,7 +54,7 @@ def getFpmConfFile(version): def getPhpSocket(version): path = getFpmConfFile(version) content = mw.readFile(path) - rep = 'listen\s*=\s*(.*)' + rep = r'listen\s*=\s*(.*)' tmp = re.search(rep, content) return tmp.groups()[0].strip() diff --git a/plugins/php/conf/app_start.php b/plugins/php/conf/app_start.php index cd9b3e011..c03b949d9 100644 --- a/plugins/php/conf/app_start.php +++ b/plugins/php/conf/app_start.php @@ -46,8 +46,7 @@ function app_xhprof_end() { if (extension_loaded('xhprof') && isset($_GET[XHProf_Name]) && $_GET[XHProf_Name] == 'ok' && - (! in_array($_SERVER['SCRIPT_NAME'], ['/xhprof_html/callgraph.php', - '/xhprof_html/index.php']))) { + (! in_array($_SERVER['SCRIPT_NAME'], array('/xhprof_html/callgraph.php','/xhprof_html/index.php')))) { app_xhprof_start(); register_shutdown_function('app_xhprof_end'); include_once $_SERVER['SCRIPT_FILENAME']; diff --git a/plugins/php/index_php.py b/plugins/php/index_php.py index 06a90a9c4..49edd6d0a 100755 --- a/plugins/php/index_php.py +++ b/plugins/php/index_php.py @@ -64,7 +64,7 @@ def status_progress(version): def getPhpSocket(version): path = getFpmConfFile(version) content = mw.readFile(path) - rep = 'listen\s*=\s*(.*)' + rep = r'listen\s*=\s*(.*)' tmp = re.search(rep, content) return tmp.groups()[0].strip() @@ -132,9 +132,17 @@ def libConfCommon(version): libpath = getPluginDir() + '/versions/phplib.conf' phplib = json.loads(mw.readFile(libpath)) + php_dir = getServerDir() + "/" + version + ext_dir = php_dir+"/lib/php/extensions" + + ext_list = os.listdir(ext_dir) + for sodir in ext_list: + if sodir.find("no-debug-non-zts") > -1: + ext_dir += "/"+ sodir + break + libs = [] - tasks = mw.M('tasks').where( - "status!=?", ('1',)).field('status,name').select() + tasks = mw.M('tasks').where("status!=?", ('1',)).field('status,name').select() for lib in phplib: lib['task'] = '1' for task in tasks: @@ -146,10 +154,15 @@ def libConfCommon(version): lib['task'] = task['status'] lib['phpversions'] = [] lib['phpversions'].append(tmp1[1]) - if phpini.find(lib['check']) == -1: - lib['status'] = False - else: + + lib['status'] = False + if phpini.find(lib['check']) > -1: lib['status'] = True + sofile = ext_dir+"/"+lib['check'] + # 自定义,比较特殊的方式 + if os.path.exists(sofile): + if os.path.getsize(sofile) == 7: + lib['status'] = True libs.append(lib) return libs diff --git a/plugins/php/info.json b/plugins/php/info.json index a70da2433..190affe28 100755 --- a/plugins/php/info.json +++ b/plugins/php/info.json @@ -6,7 +6,7 @@ "title": "PHP", "coexist": true, "versions": ["53","54","55","56","70","71","72","73","74","80","81","82","83","84"], - "updates": ["5.3.29","5.4.45","5.6.36","7.0.30","7.1.33","7.2.32","7.3.20","7.4.30","8.0.30","8.1.29","8.2.24","8.3.12","8.4.0"], + "updates": ["5.3.29","5.4.45","5.6.36","7.0.30","7.1.33","7.2.32","7.3.20","7.4.30","8.0.30","8.1.29","8.2.27","8.3.15","8.4.2"], "tip": "soft", "install_pre_inspection":true, "checks": "server/php/VERSION/bin/php", diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index 7516e0f04..3d9225a25 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -96,7 +96,6 @@ if [ "${SYS_ARCH}" == "aarch64" ];then OPTIONS="$OPTIONS --build=aarch64-unknown-linux-gnu --host=aarch64-unknown-linux-gnu" fi - if [ ! -d $serverPath/php/${PHP_VER} ];then export MYSQL_LIB_DIR=/usr/lib64/mysql diff --git a/plugins/php/versions/56/install.sh b/plugins/php/versions/56/install.sh index 85259ac0b..a811da0f6 100755 --- a/plugins/php/versions/56/install.sh +++ b/plugins/php/versions/56/install.sh @@ -115,7 +115,6 @@ if [ "${SYS_ARCH}" == "arm64" ] && [ "$sysName" == "Darwin" ] ;then cat ${curPath}/versions/${PHP_VER}/src/mkstemp.c > $sourcePath/php/php${PHP_VER}/ext/zip/lib/mkstemp.c fi - if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/${PHP_VER} \ diff --git a/plugins/php/versions/70/install.sh b/plugins/php/versions/70/install.sh index 2225bc953..fb6df9fac 100755 --- a/plugins/php/versions/70/install.sh +++ b/plugins/php/versions/70/install.sh @@ -103,12 +103,26 @@ if [ "${SYS_ARCH}" == "arm64" ] && [ "$sysName" == "Darwin" ] ;then cat ${curPath}/versions/${PHP_VER}/src/mkstemp.c > $sourcePath/php/php${PHP_VER}/ext/zip/lib/mkstemp.c fi +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/${PHP_VER} \ --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-mbstring \ diff --git a/plugins/php/versions/71/install.sh b/plugins/php/versions/71/install.sh index 9a1983fa9..5037b4baf 100755 --- a/plugins/php/versions/71/install.sh +++ b/plugins/php/versions/71/install.sh @@ -105,12 +105,26 @@ if [ "${SYS_ARCH}" == "arm64" ] && [ "$sysName" == "Darwin" ] ;then cat ${curPath}/versions/${PHP_VER}/src/mkstemp.c > $sourcePath/php/php${PHP_VER}/ext/zip/lib/mkstemp.c fi +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/${PHP_VER} \ --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-mbstring \ diff --git a/plugins/php/versions/72/install.sh b/plugins/php/versions/72/install.sh index dbddba573..0cdb32623 100755 --- a/plugins/php/versions/72/install.sh +++ b/plugins/php/versions/72/install.sh @@ -101,12 +101,26 @@ if [ "${SYS_ARCH}" == "arm64" ];then echo "cat ${curPath}/versions/${PHP_VER}/src/reentrancy.c > $sourcePath/php/php${PHP_VER}/main/reentrancy.c" fi +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/${PHP_VER} \ --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-mbstring \ diff --git a/plugins/php/versions/73/install.sh b/plugins/php/versions/73/install.sh index eef39686d..26442d240 100755 --- a/plugins/php/versions/73/install.sh +++ b/plugins/php/versions/73/install.sh @@ -105,12 +105,26 @@ else fi # ----- cpu end ------ +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} ./configure --prefix=$serverPath/php/${PHP_VER} \ --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-ftp \ diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh index 2520d135f..550738326 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -108,6 +108,19 @@ else fi # ----- cpu end ------ +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && make clean ./configure \ @@ -115,6 +128,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-ftp \ diff --git a/plugins/php/versions/80/install.sh b/plugins/php/versions/80/install.sh index 9550c8bfa..70422c6b4 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -108,6 +108,19 @@ fi # echo "$sourcePath/php/php${PHP_VER}" +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} ./buildconf --force @@ -116,6 +129,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-ftp \ diff --git a/plugins/php/versions/81/install.sh b/plugins/php/versions/81/install.sh index 72714ac12..8e985772f 100755 --- a/plugins/php/versions/81/install.sh +++ b/plugins/php/versions/81/install.sh @@ -101,6 +101,19 @@ fi echo "$sourcePath/php/php${PHP_VER}" +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} ./configure \ @@ -108,6 +121,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-ftp \ diff --git a/plugins/php/versions/82/install.sh b/plugins/php/versions/82/install.sh index 3170c203c..4a7198739 100755 --- a/plugins/php/versions/82/install.sh +++ b/plugins/php/versions/82/install.sh @@ -102,6 +102,19 @@ else fi # ----- cpu end ------ +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + # echo "$sourcePath/php/php${PHP_VER}" if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} @@ -110,6 +123,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-mbstring \ diff --git a/plugins/php/versions/83/install.sh b/plugins/php/versions/83/install.sh index 79f06f552..c40bd6121 100755 --- a/plugins/php/versions/83/install.sh +++ b/plugins/php/versions/83/install.sh @@ -102,8 +102,20 @@ else fi # ----- cpu end ------ -echo "$sourcePath/php/php${PHP_VER}" +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + +# echo "$sourcePath/php/php${PHP_VER}" if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} ./configure \ @@ -111,6 +123,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-mbstring \ diff --git a/plugins/php/versions/84/install.sh b/plugins/php/versions/84/install.sh index 715a227aa..f5ec7b389 100755 --- a/plugins/php/versions/84/install.sh +++ b/plugins/php/versions/84/install.sh @@ -94,6 +94,19 @@ fi # OPTIONS="${OPTIONS} --enable-debug" # OPTIONS="${OPTIONS} --enable-dtrace" +if [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" +else + OPTIONS="$OPTIONS --with-openssl" +fi + echo "$sourcePath/php/php${PHP_VER}" if [ ! -d $serverPath/php/${PHP_VER} ];then @@ -104,8 +117,10 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --exec-prefix=$serverPath/php/${PHP_VER} \ --with-config-file-path=$serverPath/php/${PHP_VER}/etc \ --enable-mysqlnd \ + --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ + --with-mysqlnd-ssl \ --enable-mbstring \ --enable-ftp \ --enable-sockets \ diff --git a/plugins/php/versions/common/mysql_xdevapi.sh b/plugins/php/versions/common/mysql_xdevapi.sh new file mode 100755 index 000000000..4905f78a1 --- /dev/null +++ b/plugins/php/versions/common/mysql_xdevapi.sh @@ -0,0 +1,110 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH=$PATH:/opt/homebrew/bin + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php +SYS_ARCH=`arch` +LIBNAME=mysql_xdevapi +LIBV=8.0.30 +sysName=`uname` +actionType=$1 +version=$2 + + +LIB_PATH_NAME=lib/php +if [ -d $serverPath/php/${version}/lib64 ];then + LIB_PATH_NAME=lib64 +fi + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + isInstall=`cat $serverPath/php/${version}/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + + if [ ! -f "$extFile" ];then + + php_lib=$sourcePath/php_lib + mkdir -p $php_lib + if [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then + if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then + wget --no-check-certificate -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib/${LIBNAME}-${LIBV} + + OPTIONS="" + if [ "${SYS_ARCH}" == "aarch64" ] && [ "$version" -lt "56" ];then + OPTIONS="$OPTIONS --build=aarch64-unknown-linux-gnu --host=aarch64-unknown-linux-gnu" + fi + + $serverPath/php/$version/bin/phpize + ./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS + make clean && make && make install && make clean + + cd $php_lib && rm -rf $php_lib/${LIBNAME}-${LIBV} + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + + cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + echo "php-$version not install ${LIBNAME}, Plese select other version!" + return + fi + + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/common/openssl.sh b/plugins/php/versions/common/openssl.sh index 60f447db6..2813eff2a 100755 --- a/plugins/php/versions/common/openssl.sh +++ b/plugins/php/versions/common/openssl.sh @@ -34,106 +34,24 @@ fi Install_lib() { + if [ "$version" -lt "70" ];then + bash $curPath/openssl_low_version.sh $actionType $version + return + fi + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` if [ "${isInstall}" != "" ];then echo "php-$version 已安装${LIBNAME},请选择其它版本!" return fi - - # cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh - if [ "$version" -lt "81" ];then - cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh - fi - - if [ "$version" -gt "82" ];then - cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh - fi - - if [ "$sysName" == "Darwin" ] ;then - BREW_DIR=`which brew` - BREW_DIR=${BREW_DIR/\/bin\/brew/} - - LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` - export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig - fi if [ ! -f "$extFile" ];then - - if [ ! -d $sourcePath/php${version}/ext ];then - cd ${rootPath}/plugins/php && /bin/bash ${rootPath}/plugins/php/versions/${version}/install.sh install - fi - - cd $sourcePath/php${version}/ext/${LIBNAME} - - if [ ! -f "config.m4" ];then - mv config0.m4 config.m4 - fi - - OPTIONS="" - if [ "${SYS_ARCH}" == "aarch64" ] && [ "$version" -lt "56" ];then - OPTIONS="$OPTIONS --build=aarch64-unknown-linux-gnu --host=aarch64-unknown-linux-gnu" - fi - - # openssl_version=`pkg-config openssl --modversion` - # export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig - if [ "$version" -lt "81" ] && [ "$sysName" != "Darwin" ];then - export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$serverPath/lib/openssl10/lib/pkgconfig - fi - - # Darwin - # otool -L /Users/midoks/Desktop/mwdev/server/php/83/bin/php - # lldb /Users/midoks/Desktop/mwdev/server/php/83/bin/php -r 'phpinfo()' - # otool -L /Users/midoks/Desktop/mwdev/server/php/83/lib/php/extensions/no-debug-non-zts-20230831/openssl.so - # ldd /www/server/php/83/bin/php - - if [ "$version" -lt "84" ] && [ "$sysName" == "Darwin" ];then - BREW_DIR=`which brew` - BREW_DIR=${BREW_DIR/\/bin\/brew/} - LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` - OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" - export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig - export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" - export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" - - echo "$LIB_DEPEND_DIR/lib/pkgconfig" - fi - - if [ "$version" -ge "84" ] && [ "$sysName" == "Darwin" ];then - BREW_DIR=`which brew` - BREW_DIR=${BREW_DIR/\/bin\/brew/} - LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` - OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" - export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig - export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" - export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" - fi - - # if [ "$version" -gt "82" ] && [ "$sysName" == "Darwin" ];then - # export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig - # fi - - - $serverPath/php/$version/bin/phpize - # --with-openssl - echo "./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS" - ./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS - make clean && make && make install && make clean - - if [ -d $sourcePath/php${version} ];then - cd ${sourcePath} && rm -rf $sourcePath/php${version} - fi - - fi - - if [ ! -f "$extFile" ];then - echo "ERROR!" - return + echo "locked" > $extFile fi echo "" >> $serverPath/php/$version/etc/php.ini echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini - echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini if [ -f "/etc/ssl/certs/ca-certificates.crt" ];then echo "openssl.cafile=/etc/ssl/certs/ca-certificates.crt" >> $serverPath/php/$version/etc/php.ini elif [ -f "/etc/pki/tls/certs/ca-bundle.crt" ];then diff --git a/plugins/php/versions/common/openssl_bak.sh b/plugins/php/versions/common/openssl_bak.sh new file mode 100755 index 000000000..b011245cb --- /dev/null +++ b/plugins/php/versions/common/openssl_bak.sh @@ -0,0 +1,177 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH=$PATH:/opt/homebrew/bin + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php +SYS_ARCH=`arch` +actionType=$1 +version=$2 + +LIBNAME=openssl +LIBV=0 + +LIB_PATH_NAME=lib/php +if [ -d $serverPath/php/${version}/lib64 ];then + LIB_PATH_NAME=lib64 +fi + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + # cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh + if [ "$version" -lt "81" ];then + cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh + fi + + if [ "$version" -gt "82" ];then + cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh + fi + + if [ "$sysName" == "Darwin" ] ;then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + fi + + if [ ! -f "$extFile" ];then + + if [ ! -d $sourcePath/php${version}/ext ];then + cd ${rootPath}/plugins/php && /bin/bash ${rootPath}/plugins/php/versions/${version}/install.sh install + fi + + cd $sourcePath/php${version}/ext/${LIBNAME} + + if [ ! -f "config.m4" ];then + mv config0.m4 config.m4 + fi + + OPTIONS="" + if [ "${SYS_ARCH}" == "aarch64" ] && [ "$version" -lt "56" ];then + OPTIONS="$OPTIONS --build=aarch64-unknown-linux-gnu --host=aarch64-unknown-linux-gnu" + fi + + # openssl_version=`pkg-config openssl --modversion` + # export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig + if [ "$version" -lt "81" ] && [ "$sysName" != "Darwin" ];then + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$serverPath/lib/openssl10/lib/pkgconfig + fi + + # Darwin + # otool -L /Users/midoks/Desktop/mwdev/server/php/83/bin/php + # lldb /Users/midoks/Desktop/mwdev/server/php/83/bin/php -r 'phpinfo()' + # otool -L /Users/midoks/Desktop/mwdev/server/php/83/lib/php/extensions/no-debug-non-zts-20230831/openssl.so + # ldd /www/server/php/83/bin/php + + if [ "$version" -lt "84" ] && [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" + + echo "$LIB_DEPEND_DIR/lib/pkgconfig" + fi + + if [ "$version" -ge "84" ] && [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" + fi + + # if [ "$version" -gt "82" ] && [ "$sysName" == "Darwin" ];then + # export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig + # fi + + + $serverPath/php/$version/bin/phpize + # --with-openssl + echo "./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS" + ./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS + make clean && make && make install && make clean + + if [ -d $sourcePath/php${version} ];then + cd ${sourcePath} && rm -rf $sourcePath/php${version} + fi + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + if [ -f "/etc/ssl/certs/ca-certificates.crt" ];then + echo "openssl.cafile=/etc/ssl/certs/ca-certificates.crt" >> $serverPath/php/$version/etc/php.ini + elif [ -f "/etc/pki/tls/certs/ca-bundle.crt" ];then + echo "openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt" >> $serverPath/php/$version/etc/php.ini + fi + + cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/common/openssl_low_version.sh b/plugins/php/versions/common/openssl_low_version.sh new file mode 100755 index 000000000..b011245cb --- /dev/null +++ b/plugins/php/versions/common/openssl_low_version.sh @@ -0,0 +1,177 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH=$PATH:/opt/homebrew/bin + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php +SYS_ARCH=`arch` +actionType=$1 +version=$2 + +LIBNAME=openssl +LIBV=0 + +LIB_PATH_NAME=lib/php +if [ -d $serverPath/php/${version}/lib64 ];then + LIB_PATH_NAME=lib64 +fi + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + # cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh + if [ "$version" -lt "81" ];then + cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh + fi + + if [ "$version" -gt "82" ];then + cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh + fi + + if [ "$sysName" == "Darwin" ] ;then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + fi + + if [ ! -f "$extFile" ];then + + if [ ! -d $sourcePath/php${version}/ext ];then + cd ${rootPath}/plugins/php && /bin/bash ${rootPath}/plugins/php/versions/${version}/install.sh install + fi + + cd $sourcePath/php${version}/ext/${LIBNAME} + + if [ ! -f "config.m4" ];then + mv config0.m4 config.m4 + fi + + OPTIONS="" + if [ "${SYS_ARCH}" == "aarch64" ] && [ "$version" -lt "56" ];then + OPTIONS="$OPTIONS --build=aarch64-unknown-linux-gnu --host=aarch64-unknown-linux-gnu" + fi + + # openssl_version=`pkg-config openssl --modversion` + # export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig + if [ "$version" -lt "81" ] && [ "$sysName" != "Darwin" ];then + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$serverPath/lib/openssl10/lib/pkgconfig + fi + + # Darwin + # otool -L /Users/midoks/Desktop/mwdev/server/php/83/bin/php + # lldb /Users/midoks/Desktop/mwdev/server/php/83/bin/php -r 'phpinfo()' + # otool -L /Users/midoks/Desktop/mwdev/server/php/83/lib/php/extensions/no-debug-non-zts-20230831/openssl.so + # ldd /www/server/php/83/bin/php + + if [ "$version" -lt "84" ] && [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + LIB_DEPEND_DIR=`brew info openssl@1.0 | grep ${BREW_DIR}/Cellar/openssl@1.0 | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl@1.0)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" + + echo "$LIB_DEPEND_DIR/lib/pkgconfig" + fi + + if [ "$version" -ge "84" ] && [ "$sysName" == "Darwin" ];then + BREW_DIR=`which brew` + BREW_DIR=${BREW_DIR/\/bin\/brew/} + LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'` + OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)" + export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig + export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include" + export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz" + fi + + # if [ "$version" -gt "82" ] && [ "$sysName" == "Darwin" ];then + # export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig + # fi + + + $serverPath/php/$version/bin/phpize + # --with-openssl + echo "./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS" + ./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS + make clean && make && make install && make clean + + if [ -d $sourcePath/php${version} ];then + cd ${sourcePath} && rm -rf $sourcePath/php${version} + fi + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + if [ -f "/etc/ssl/certs/ca-certificates.crt" ];then + echo "openssl.cafile=/etc/ssl/certs/ca-certificates.crt" >> $serverPath/php/$version/etc/php.ini + elif [ -f "/etc/pki/tls/certs/ca-bundle.crt" ];then + echo "openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt" >> $serverPath/php/$version/etc/php.ini + fi + + cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index f81be4da5..3416ec051 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -149,6 +149,7 @@ { "name": "openssl", "versions": [ + "52", "53", "54", "55", @@ -165,7 +166,7 @@ "84" ], "type": "通用扩展", - "msg": "SSL!", + "msg": "SSL", "shell": "openssl.sh", "check": "openssl.so" }, @@ -187,6 +188,18 @@ "check": "mcrypt.so" }, { + "name": "mysql_xdevapi", + "versions": [ + "71", + "72", + "73" + ], + "type": "通用扩展", + "msg": "PHP71-73连接MySQL", + "shell": "mysql_xdevapi.sh", + "check": "mysql_xdevapi.so" + }, + { "name": "bcmath", "versions": [ "53", diff --git a/plugins/phpmyadmin/index.py b/plugins/phpmyadmin/index.py index 832c62ce4..8a5201505 100755 --- a/plugins/phpmyadmin/index.py +++ b/plugins/phpmyadmin/index.py @@ -13,6 +13,7 @@ if os.path.exists(web_dir): os.chdir(web_dir) import core.mw as mw +import thisdb from utils.site import sites as MwSites app_debug = False @@ -478,7 +479,7 @@ def pluginsDbSupport(): port = getPort() ip = '127.0.0.1' if not mw.isAppleSystem(): - ip = mw.getLocalIp() + ip = thisdb.getOption('server_ip') cfg = data['cfg'] auth = cfg['username']+':'+cfg['password'] diff --git a/web/core/mw.py b/web/core/mw.py index 15134c210..906811cf4 100644 --- a/web/core/mw.py +++ b/web/core/mw.py @@ -325,7 +325,7 @@ def readFile(filename): fp.close() return fBody except Exception as e: - print('readFile:',str(e)) + # print('readFile:',str(e)) return False def writeFile(filename, content, mode='w+'):