VPS侦探论坛

 找回密码
 注册
查看: 5486|回复: 3

lnmpa 0.9需要升级php到5.4

[复制链接]
发表于 2013-10-18 18:18:43 | 显示全部楼层 |阅读模式

目前客户服务器装的是lnmpa 0.9,使用脚本升级到php5.4出现错误。信息忘记记录了,类似 libphp5.so没有找到。
搜索了一下,跟这个问题一样https://bbs.vpser.net/thread-5457-1-1.html

请问有好的解决方案吗?

[ 本帖最后由 RayKwok 于 2013-10-18 18:20 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2013-10-18 19:52:43 | 显示全部楼层


没具体的编译时的错误信息,没法说原因
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2013-10-18 20:22:57 | 显示全部楼层

我直接用安装包的脚本编辑安装错误如下:
  1. configure: WARNING: you should use --build, --host, --target
  2. configure: WARNING: unrecognized options: --enable-magic-quotes, --enable-safe-mode
  3. checking for grep that handles long lines and -e... /bin/grep
  4. checking for egrep... /bin/grep -E
  5. checking for a sed that does not truncate output... /bin/sed
  6. checking build system type... Invalid configuration `with-libevent-dir': machine `with-libevent' not recognized
  7. configure: error: /bin/sh ./config.sub with-libevent-dir failed
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2013-10-18 22:40:29 | 显示全部楼层



搞定,去除无效的参数

  1. #!/bin/bash
  2. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
  3. export PATH

  4. # Check if user is root
  5. if [ $(id -u) != "0" ]; then
  6.     echo "Error: You must be root to run this script, please use root to install lnmp"
  7.     exit 1
  8. fi

  9. clear
  10. echo "========================================================================="
  11. echo "Upgrade PHP for LNMPA,  Written by Licess"
  12. echo "========================================================================="
  13. echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux "
  14. echo ""
  15. echo "For more information please visit http://www.lnmp.org/"
  16. echo "========================================================================="
  17. cur_dir=$(pwd)

  18. if [ "$1" != "--help" ]; then

  19. old_php_version=`php -r 'echo PHP_VERSION;'`
  20. #echo $old_php_version

  21. #set php version

  22.     php_version=""
  23.     echo "Current PHP Version:$old_php_version"
  24.     echo "You can get version number from http://www.php.net/"
  25.     read -p "(Please input PHP Version you want):" php_version
  26.     if [ "$php_version" = "" ]; then
  27.         echo "Error: You must input php version!!"
  28.         exit 1
  29.     fi

  30.     if [ "$php_version" = "$old_php_version" ]; then
  31.         echo "Error: The upgrade PHP Version is the same as the old Version!!"
  32.         exit 1
  33.     fi
  34.     echo "==========================="

  35.     echo "You want to upgrade php version to $php_version"

  36.     echo "==========================="

  37.     get_char()
  38.     {
  39.     SAVEDSTTY=`stty -g`
  40.     stty -echo
  41.     stty cbreak
  42.     dd if=/dev/tty bs=1 count=1 2> /dev/null
  43.     stty -raw
  44.     stty echo
  45.     stty $SAVEDSTTY
  46.     }
  47.     echo ""
  48.     echo "Press any key to start...or Press Ctrl+c to cancel"
  49.     char=`get_char`

  50. echo "============================check files=================================="
  51. if [ -s php-$php_version.tar.gz ]; then
  52.   echo "php-$php_version.tar.gz [found]"
  53.   else
  54.   echo "Error: php-$php_version.tar.gz not found!!!download now......"
  55.   wget -c http://us2.php.net/distributions/php-$php_version.tar.gz
  56.   if [ $? -eq 0 ]; then
  57.     echo "Download php-$php_version.tar.gz successfully!"
  58.   else
  59.     echo "WARNING!May be the php version you input was wrong,please check!"
  60.     echo "PHP Version input was:"$php_version
  61.     sleep 5
  62.     exit 1
  63.   fi
  64. fi
  65. echo "============================check files=================================="

  66. #Backup old php version configure files
  67. echo "Backup old php version configure files......"
  68. /etc/init.d/httpd stop
  69. mkdir -p /root/phpconf
  70. cp /usr/local/php/etc/php.ini /root/phpconf/php.ini.old.bak
  71. rm -rf /usr/local/php/
  72. cp /usr/local/apache/modules/libphp5.so /root/phpconf/
  73. rm -f /usr/local/apache/modules/libphp5.so

  74. echo "Stoping Nginx..."
  75. /etc/init.d/nginx stop
  76. echo "Stoping MySQL..."
  77. /etc/init.d/mysql stop
  78. echo "Stoping Apache..."
  79. /etc/init.d/httpd stop
  80. if [ -s /etc/init.d/memceached ]; then
  81.   echo "Stoping Memcached..."
  82.   /etc/init.d/memcacehd stop
  83. fi

  84. cd $cur_dir
  85. echo "Starting install php......"
  86. if [ -s php-$php_version/ ]; then
  87. rm -rf php-$php_version/
  88. fi
  89. tar zxvf php-$php_version.tar.gz
  90. cd php-$php_version/
  91. ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo

  92. #rm -f libtool
  93. #cp /usr/local/apache/build/libtool .

  94. make ZEND_EXTRA_LIBS='-liconv'
  95. make install

  96. mkdir -p /usr/local/php/etc/
  97. rm -f /usr/local/php/etc/php.ini
  98. cp php.ini-production /usr/local/php/etc/php.ini

  99. # php extensions
  100. echo "Modify php.ini......"
  101. sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"\nextension = "memcache.so"\#' /usr/local/php/etc/php.ini
  102. sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini
  103. sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini
  104. sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini
  105. sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini
  106. sed -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
  107. sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini
  108. sed -i 's/register_long_arrays = On/;register_long_arrays = On/g' /usr/local/php/etc/php.ini
  109. sed -i 's/magic_quotes_gpc = On/;magic_quotes_gpc = On/g' /usr/local/php/etc/php.ini
  110. sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen/g' /usr/local/php/etc/php.ini

  111. echo "Install ZendGuardLoader for PHP 5.4"
  112. if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
  113.         wget -c http://downloads.zend.com/guard/6.0.0/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
  114.         tar zxvf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
  115.     mkdir -p /usr/local/zend/
  116.     cp ./ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so /usr/local/zend/
  117. else
  118.         wget -c http://downloads.zend.com/guard/6.0.0/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz
  119.     tar zxvf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz
  120.     mkdir -p /usr/local/zend/
  121.     cp ./ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so /usr/local/zend/
  122. fi

  123. echo "Write ZendGuardLoader to php.ini......"
  124. cat >>/usr/local/php/etc/php.ini<<EOF
  125. ;eaccelerator

  126. ;ionCube

  127. [Zend Optimizer]
  128. zend_extension=/usr/local/zend/ZendGuardLoader.so
  129. EOF

  130. echo "Checking php extensions files......"
  131. if [ -s memcache-2.2.7.tgz ]; then
  132.   echo "memcache-2.2.7.tgz [found]"
  133.   else
  134.   echo "Error: memcache-2.2.7.tgz not found!!!download now......"
  135.   wget -c http://pecl.php.net/get/memcache-2.2.7.tgz
  136. fi

  137. echo "Install php extensions......"
  138. tar zxvf memcache-2.2.7.tgz
  139. cd memcache-2.2.7/
  140. /usr/local/php/bin/phpize
  141. ./configure --with-php-config=/usr/local/php/bin/php-config
  142. make && make install
  143. cd ../

  144. echo "Starting Nginx..."
  145. /etc/init.d/nginx start
  146. echo "Starting MySQL..."
  147. /etc/init.d/mysql start
  148. echo "Starting Apache..."
  149. /etc/init.d/httpd start
  150. if [ -s /etc/init.d/memceached ]; then
  151.   echo "Starting Memcached..."
  152.   /etc/init.d/memcacehd start
  153. fi

  154. cd $cur_dir

  155. echo "========================================================================="
  156. echo "You have successfully upgrade PHP of LNMPA from $old_php_version to $php_version"
  157. echo "========================================================================="
  158. echo "LNMPA is tool to auto-compile & install Nginx+MySQL+PHP+Apache on Linux "
  159. echo "========================================================================="
  160. echo ""
  161. echo "For more information please visit http://www.lnmp.org/"
  162. echo ""
  163. echo "========================================================================="
  164. fi
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-15 16:24 , Processed in 0.026186 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表