linux php-5.3.28版本升级到php-5.5.25

10 篇文章 0 订阅

为了方便,在linux环境下安装了lnmp集成环境,但是后来在项目中,由于php5.3版本不支持数组以 ['a','b'] 的形式书写,所以需要更新php到5.3以上版本。

lnmp中php是以config & make & make install 的方式安装,所以卸载的话就直接停止php服务(service php-fpm stop 这里启动了php-fpm),再将安装的php目录(/usr/local/php,看phpinfo()里都有信息)。

之后下载了最新的php-5.6.9.tar.gz,解压后 ./configure 后面的参数由之前php-5.3.28的phpinfo()打印的./configure信息。

这样./configure后会有警告,说 ‘--enable-magic-quotes’ 和 ‘--enable-safe-mode’不可用,原因是php-5.4之后就不支持,同样去处的还有:'–enable-discard-path','–enable-fastcgi','–enable-force-cgi-redirect','–with-curlwrappers';

之后再make,又报错:

/bin/bash /root/php-5.6.9/libtool --silent --preserve-dup-deps --mode=link cc -DPHP_ATOM_INC -I/root/php-5.6.9/include -I/root/php-5.6.9/main -I/root/php-5.6.9 -I/root/php-5.6.9/ext/date/lib -I/root/php-5.6.9/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/root/php-5.6.9/ext/mbstring/oniguruma -I/root/php-5.6.9/ext/mbstring/libmbfl -I/root/php-5.6.9/ext/mbstring/libmbfl/mbfl -I/usr/local/include -I/root/php-5.6.9/ext/sqlite3/libsqlite -I/root/php-5.6.9/ext/zip/lib -I/root/php-5.6.9/TSRM -I/root/php-5.6.9/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden   -o ext/opcache/opcache.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/php-5.6.9/modules -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib ext/opcache/ZendAccelerator.lo ext/opcache/zend_accelerator_blacklist.lo ext/opcache/zend_accelerator_debug.lo ext/opcache/zend_accelerator_hash.lo ext/opcache/zend_accelerator_module.lo ext/opcache/zend_persist.lo ext/opcache/zend_persist_calc.lo ext/opcache/zend_shared_alloc.lo ext/opcache/zend_accelerator_util_funcs.lo ext/opcache/shared_alloc_shm.lo ext/opcache/shared_alloc_mmap.lo ext/opcache/shared_alloc_posix.lo ext/opcache/Optimizer/zend_optimizer.lo
libtool: link: `ext/opcache/zend_accelerator_blacklist.lo' is not a valid libtool object
make: *** [ext/opcache/opcache.la] Error 1

大概意思是说 xxx.lo不是有效的libtool object。

我想opcache是个php扩张,正常安装的时候一般不会扩张出问题,很可能是php-5.6版本太新,我下载的安装包有问题,所以就下了个php-5.5.25版本的试下。

果然按照之前的方式安装下来能正常的make & make install。

安装好php后试下php -v:

root@precise64:/usr/local/nginx/conf# php -v
Zend Guard Loader requires Zend Engine API version 220090626.
The Zend Engine API version 220121212 which is installed, is newer.
Contact Zend Technologies at http://www.zend.com/ for a later version of Zend Guard Loader.

PHP 5.5.25 (cli) (built: May 20 2015 10:21:25)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

没问题,php安装成功。

接下来就是启动php-fpm服务,service php-fpm start,报错了,

root@precise64:~/php-5.5.25# service php-fpm start
Starting php-fpm [20-May-2015 10:23:40] ERROR: failed to open configuration file '/usr/local/php/etc/php-fpm.conf': No such file or directory (2)
[20-May-2015 10:23:40] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf'
[20-May-2015 10:23:40] ERROR: FPM initialization failed
 failed

说是不能导入php-fpm.conf文件,先查下这个/usr/local/php/etc/php-fpm.conf是不是存在,没有,就从原来的php-5.3.28中拷贝一份来,然后再启动就ok了。

root@precise64:/usr/local/php/etc# service php-fpm start
Starting php-fpm Zend Guard Loader requires Zend Engine API version 220090626.
The Zend Engine API version 220121212 which is installed, is newer.
Contact Zend Technologies at http://www.zend.com/ for a later version of Zend Guard Loader.

 done

查看下phpinfo()



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李昂的数字之旅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值