记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。
 
0

Centos7 安装PHP7

发表者:admin分类:Devops2016-01-05 23:27:47 阅读[2072]
PHP终于要迎接PHP7的时代了,现在的稳定版本是PHP5.6,而PHP官方表示终止PHP5.7及PHP6发布,下一个PHP版本是7。

PHP7开发版的源代码以phpng已经在git上公布也有一段时间了,简单介绍一下在CentOS7安装phpng的方法。

前期准备

查看bison及re2c

安装PHP7需要bison及re2c。

# rpm -qa | grep bison
bison-2.7-4.el7.x86_64

# rpm -qa | grep re2c

安装re2c

# cd /tmp
# wget http://sourceforge.net/projects/re2c/files/re2c/0.14.3/re2c-0.14.3.tar.gz
# tar -xzvf re2c-0.14.3.tar.gz
# cd re2c-0.14.3
# ./configure --prefix=/usr/local/bin
# make
# make install

安装phpng

# git clone https://git.php.net/repository/php-src.git
# cd php-src
# git branch phpng
# git checkout phpng
# ./buildconf
# ./configure --prefix=/opt/php7
# make
# make test
# make install
# cp php.ini-production /opt/php7/lib/php.ini

配置php.ini文件

max_execution_time=600
memory_limit=128M
error_reporting=0
display_errors=0
log_errors=0
user_ini.filename=
realpath_cache_size=2M
cgi.check_shebang_line=0
 
zend_extension=opcache.so
opcache.enable_cli=1
opcache.save_comments=0
opcache.fast_shutdown=1
opcache.validate_timestamps=1
opcache.revalidate_freq=60
opcache.use_cwd=1
opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=5
opcache.memory_consumption=128
opcache.consistency_checks=0

查看PHP版本

# cd /opt/php7/bin
# ./php -v
PHP 7.0.0-dev (cli) (built: Sep  2 2015 17:33:52) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies

常见错误

configure: error: xml2-config not found. Please check your libxml2 installation.
# yum -y install libxml2 libxml2-devel

结语

参照URL如下



转载请标明出处【Centos7 安装PHP7】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论