因要部署新的php应用阿里云的ECS服务上的php版本需要升级,因应对linux环境的php环境不太了解,不敢冒进操作,现运行着manits bu管理系统。
1.下载新版本php
http://php.net/downloads.php
下载地址:http://cn2.php.net/distributions/php-5.5.38.tar.gz
2.解压缩文件
tar -zxvf php-5.5.38.tar.gz
cd php-5.5.38
3.配置编译配置
./configure --prefix=/usr/local/php --with-mysql=/alidata/server/mysql --with-openssl --with-mysqli=/alidata/server/mysql/bin/mysql_config --with-zlib --with-libxml-dir=/usr --enable-xml --with-apxs2=/usr/sbin/apxs --with-mcrypt --with-iconv=/usr/local/lib
上面的配置我们使用了apxs,检测apxs,只要安装httpd-devel这个软件包,就会有apxs了。
# yum install httpd-devel –y
# rpm –ql httpd-devel | grep “apxs”
4.编译安装
在编译安装过程中出现如下错误
undefined reference to `libiconv_open
查看知道iconv路径在/usr/local/lib,在配置信息中增加: --with-iconv=/usr/local/lib
5.php配置文件地址
/usr/local/php/lib/php.ini
6.动态添加mbstring模块
进入php源码路径cd php-5.5.38/ext/mbstring执行/usr/local/php/bin/phpize命令,编辑mbstring,./configure --with-php-config=/usr/local/php/bin/php-config
make && make install,拷贝生成的mbstring.so到php.ini中extension_dir的路径中。
在php.ini中增加extension=mbstring.so
echo ‘extension=mbstring.so' >>/usr/local/php/lib/php.ini
7.重启apache服务
service httpd restart
重启apache php正常运行
参考文章:
http://www.linuxidc.com/Linux/2015-05/118062.htm
http://blog.chinaunix.net/uid-25266990-id-2915395.html
http://www.jb51.net/article/37741.htm
http://lihuan.blog.51cto.com/4391550/821448