LuManager自带的PHP在FastCGI模式是 5.2.17版,非FastCGI模式是 5.3.14版。由于360网盘的停服,已不敢再用那些免费的网盘,干脆自己搭个私有云。查了下相关资料准备先试试ownCloud ,ownCloud 目前最新版本是ownCloud 9.1.1,最低要求PHP5.4,所以必须要升级下PHP版本,开始折腾吧。
一开始参考这篇文章http://www.zijidelu.org/thread-51419-1-1.html试了几次,安装过程也没有错误提示,以为成功了,可重启Apache后通过探针测试还是5.3.14版。然后又参考http://www.zijidelu.org/thread-51549-1-1.html,折腾了半天终于成功了。安装过程中除了文中说的几个错误,我又遇到了几个新问题,最后都通过百度查资料,一个个的解决了。
言归正传,下面是方法:(阿里云 centos 6.5)
- 先去PHP官网获取要安装的PHP版本下载地址(http://php.net/downloads.php)
- 以root权限进入终端界面,下载php
1wget http : //php.net/get/php-5.6.27.tar.gz - 解压并安装,这里是关键,也是问题最多的地方
12345tar - zxvf php - 5.6.27.tar.gzcd php - 5.6.27. / configure -- prefix = / usr / local / php - with - apxs2 = / usr / local / apache / bin / apxs -- with - config - file - path = / usr / local / php / etc -- enable - opcache -- with - mysql = mysqlnd -- with - mysqli = mysqlnd -- with - pdo - mysql = mysqlnd -- enable - fileinfo -- with - mcrypt = / usr / local / libmcrypt -- with - iconv - dir = / usr / local -- with - freetype - dir -- with - jpeg - dir -- with - png - dir -- with - zlib -- with - libxml - dir = / usr -- enable - xml -- disable - rpath -- enable - bcmath -- enable - shmop -- enable - exif -- enable - sysvsem -- enable - inline - optimization -- with - curl -- enable - mbregex -- enable - mbstring -- with - gd -- enable - gd - native - ttf -- with - openssl -- with - mhash -- enable - pcntl -- enable - sockets -- with - xmlrpc -- enable - ftp -- with - gettext -- enable - zip -- enable - soap -- disable - ipv6 -- disable - debugmake ZEND_EXTRA_LIBS = '-liconv'make install
问题1:安装过程中出现 “Sorry, I cannot run apxs” 错误提示
解决方法:修改vi /usr/local/apache/bin/apxs文件,之后重新编译安装PHP
1vi / usr / local / apache / bin / apxs
将第一行这句
1#!/usr/sbin/perl -w
修改为
1#!/usr/bin/perl -w
问题2:执行“make ZEND_EXTRA_LIBS=’-liconv’”时出现错误提示“/usr/bin/ld: cannot find -liconv”
解决方法:安装libiconv库(下载页面 http://www.gnu.org/software/libiconv/),之后重新编译安装PHP
12345678wget http : //ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar - xzf libiconv - 1.14.tar.gzcd libiconv - 1.14. / configure -- prefix = / usr / localmakemake installln - s / usr / local / lib / libiconv . so / usr / libln - s / usr / local / lib / libiconv . so . 2 / usr / lib / libiconv . so . 2
问题3:运行PHP时报“Call to undefined function: mcrypt_module_open() ”错误
解决方法:安装libmcrypt(下载页面 ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt),之后重新编译安装PHP
1234567wget ftp : //mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gztar - zxvf libmcrypt - 2.5.7.tar.gzcd libmcrypt - 2.5.7. / configure -- prefix = / usr / local / libmcryptmakemake checkmake install - 检查apache下/usr/local/apache/modules是否有libphp5.so
- 复制配置文件
1cp php . ini - development / usr / local / php / etc / php . ini - 编辑php.ini,把include_path前面的分号删除,改成include_path = “/opt/php/lib/php”
1vi / usr / local / php / etc / php . ini - 重启apache
原文:https://www.mebox.cn/develop/929.html
收藏备用。