centos 6.5上安装php7,centos 6.5 编译安装PHP7

上一篇介绍了centos yum安装php,,今天银众网络介绍centos编译安装php7,写下安装步骤,我是在centos6.5 环境中编译的,如下:

下载地址http://cn2.php.net/distributions/php-7.0.5.tar.gz

安装编译所需的包,如遇见部分包找不到 请先执

yum install epel-release //扩展包更新包

yum update //更新yum源

然后在执行如下命令

yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg

libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel

glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl

curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel

openldap openldap-devel nss_ldap openldap-clients openldap-servers libmcrypt

libmcrypt-devel libXpm-devel

make & make install

执行编译命令

./configure --prefix=/etc/php/php-7.0.13 --enable-fpm

--with-mcrypt=/usr/local/libmcrypt --with-zlib --enable-mbstring --enable-pcntl

--with-openssl --enable-soap --with-pear --with-png-dir --with-pcre-regex

--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd

--with-mysql-sock=/var/lib/mysq/mysql.sock --with-gd --with-jpeg-dir=/usr/lib

--enable-gd-native-ttf --with-gettext --with-curl --enable-sockets

--enable-bcmath --enable-xml --with-bz2 --enable-zip

--with-freetype-dir=/usr/include/freetype2/

上述命令中需要注意的是

--with-mysqli 参数 指定的是 mysql所在的bin 文件路径如:/usr/bin/mysql_config

--with-freetype-dir 指定的路径 是 /usr/include/freetype2/ 如果你是yum 安装的 freetype2

的话

其他的根据你自己实际需要增删即可

配置文件

# cp php.ini-development php.ini

# cp /etc/php/php-7.0.13/etc/php-fpm.conf.default

/etc/php/php-7.0.13/etc/php-fpm.conf

# cp /etc/php/php-7.0.13/etc/php-fpm.d/www.conf.default

/etc/php/php-7.0.13/etc/php-fpm.d/www.conf

# cp -R ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置

启动

# /etc/init.d/php-fpm

设置权限,并添加服务

chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm

以后可以使用如下命令管理php-fpm了

service php-fpm start

service php-fpm stop

service php-fpm restart

service php-fpm reload

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值