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

来源:互联网 发布:淘宝店铺不显示导航栏 编辑:程序博客网 时间:2024/06/03 18:11

为了方便,在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()



0 0
原创粉丝点击