From aa33c34752bb88bfe95f33a5135a52e00381d593 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 12 Aug 2018 17:07:57 +0200 Subject: [PATCH] mod_php_install.sh: add support for legacy MySQL functions. --- mod_php_install.sh | 312 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 311 insertions(+), 1 deletion(-) diff --git a/mod_php_install.sh b/mod_php_install.sh index 51ed3e8..f354b4a 100755 --- a/mod_php_install.sh +++ b/mod_php_install.sh @@ -16,6 +16,7 @@ _srcdir=$(dirname $(realpath $0)) _pwd=`pwd` _PHP_FPM_SUPPORT=yes +_LEGACY_SQL_FUNCTION_SUPPORT=no _SYMLINK_PHP=no _SYMLINK_PHP_MAIN_VERSION=yes @@ -818,6 +819,44 @@ else fi + +if [[ $PHP_MAJOR_VERSION -ge 7 ]] ; then + echo "" + echo "" + echo -e "\033[32m--\033[m" + echo "" + echo -e "Install support for lagacy MySQL functions [ \033[33myes/no\033[m ]" + echo "" + echo "" + OK="" + while [ "X$OK" = "X" ] + do + echononl "Install lagacy MySQL functions support ? [ $_LEGACY_SQL_FUNCTION_SUPPORT ] " + read OK + __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` + if [ "X$OK" = "X" ]; then + OK=$_LEGACY_SQL_FUNCTION_SUPPORT + break + fi + if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then + OK=$__to_lower + break + fi + echo "" + echo -e "\t\033[31mWrong entry !! Try again..\033[m" + echo "" + OK= + done + if [ "$OK" = "yes" ]; then + LEGACY_SQL_FUNCTION_SUPPORT=true + else + LEGACY_SQL_FUNCTION_SUPPORT=false + fi +else + LEGACY_SQL_FUNCTION_SUPPORT=false +fi + + echo "" echo "" echo "" @@ -851,6 +890,11 @@ if $WITH_PHP_FPM_SUPPORT ; then echo " Activate FPM init script...: $ACTIVATE_PHP_FPM_INIT_SCRIPT" echo " Set umask 0002 for FPM.....: $SET_UMASK" fi +if [[ $PHP_MAJOR_VERSION -ge 7 ]]; then + echo "" + echo "Support legacy SQL functions..: $LEGACY_SQL_FUNCTION_SUPPORT" +fi +echo "" echo "Install with systemd Support..: $SYSTEMD_EXISTS" echo "" echo "Install with (apache) mod_php.: $WITH_MOD_PHP" @@ -2251,7 +2295,7 @@ if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echononl "\tphp.ini: extension=uri_template.so .." _extension="uri_template.so" - perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\napc.enable_cli = 1\n#" $PHP_INI_FILE + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else @@ -2316,6 +2360,7 @@ fi ## ----- + ## ----- ## - Install memcached ## ----- @@ -2568,6 +2613,150 @@ fi ## ----- + +## ----- +## - Install raphf +## ----- + +echononl "\tInstall 'raphf' via pecl.." +if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then + printf "\n" | ${PREFIX_PHP}/bin/pecl install raphf-1.1.2 > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + + echononl "\tphp.ini: extension=raphf .." + _extension="raphf.so" + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + else + echo_failed + fi + +else + printf "\n" | ${PREFIX_PHP}/bin/pecl install raphf > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + + echononl "\tphp.ini: extension=raphf .." + _extension="raphf.so" + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + else + echo_failed + fi +fi + +## ----- +## - END: Install raphf +## ----- + + + +## ----- +## - Install propro +## ----- + +echononl "\tInstall 'propro' via pecl.." +if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then + printf "\n" | ${PREFIX_PHP}/bin/pecl install propro-1.0.2 > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + + echononl "\tphp.ini: extension=propro .." + _extension="propro.so" + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + else + echo_failed + fi + +else + printf "\n" | ${PREFIX_PHP}/bin/pecl install propro > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + + echononl "\tphp.ini: extension=propro .." + _extension="propro.so" + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + else + echo_failed + fi +fi + +## ----- +## - END: Install propro +## ----- + + + +## ----- +## - Install pecl_http +## ----- + +echononl "\tInstall 'pecl_http' via pecl.." +if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then + printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http-2.6.0 > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + + echononl "\tphp.ini: extension=pecl_http .." + _extension="http.so" + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + else + echo_failed + fi + +else + printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + + echononl "\tphp.ini: extension=pecl_http .." + _extension="http.so" + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + else + echo_failed + fi +fi + +## ----- +## - END: Install pecl_http +## ----- + + ## ----- ## - Enable ldap.so ## ----- @@ -2586,9 +2775,130 @@ fi ## ----- +if $LEGACY_SQL_FUNCTION_SUPPORT ; then + ## - PHP legacy SQL functions support + ## - + echo "" + echo "" + echo -e "\t---" + echo -e "\t--- Install support for lagacy MySQL functions" + echo -e "\t---" + echo "" + + _lsf_src_dir="/usr/local/src/php-${PHP_MAIN_VERSION}_mysql" + + echononl "\tBackup existing directory '${_lsf_src_dir}'.." + if [[ -d "${_lsf_src_dir}" ]]; then + mv "$_lsf_src_dir" "${_lsf_src_dir}.$(date +%Y%m%d-%H%M)" > /dev/null 2> $tmp_err_msg + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + else + echo_skipped + fi + + echononl "\tCreate directory '$_lsf_src_dir'.." + mkdir "$_lsf_src_dir" > /dev/null 2> $tmp_err_msg + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tChange into directory '$_lsf_src_dir'.." + cd "$_lsf_src_dir" > /dev/null 2> $tmp_err_msg + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tClone 'https://github.com/php/pecl-database-mysql'.." + git clone https://github.com/php/pecl-database-mysql ${_lsf_src_dir}/mysql --recursive > $tmp_err_msg 2>&1 + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tChange into directory '${_lsf_src_dir}/mysql'.." + cd "${_lsf_src_dir}/mysql" > /dev/null 2> $tmp_err_msg + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tPrepare a PHP extension (SQL legazy functions) for compiling.." + phpize > $tmp_err_msg 2>&1 + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tConfigure PHP extension (SQL legazy functions).." + ./configure > $tmp_err_msg 2>&1 + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tCompile PHP extension (SQL legazy functions).." + make > $tmp_err_msg 2>&1 + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + echononl "\tInstall PHP extension (SQL legazy functions).." + make install > $tmp_err_msg 2>&1 + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + fi + + extension_lsf="$(find ${PREFIX_PHP}/lib/php/extensions -name mysql.so -print)" + + echononl "\tphp.ini: extension=\"$extension_lsf\" .." + if [[ -n "$extension_lsf" ]]; then + perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\n;extension=$extension_xdebug\n#" $PHP_INI_FILE + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + else + echo_skipped + warn "Extension library \"mysql.so\" not found!" + fi + +fi + + ## ----- ## - Install xdebug ## ----- +echo "" +echo "" +echo -e "\t---" +echo -e "\t--- Install PECL xdebug extension" +echo -e "\t---" +echo "" echononl "\tInstall xdebug via pecl.." if [[ "$PHP_MAIN_VERSION" = "5.4" ]] ; then