centos7 安装php-7.0.4

 

1、在安装目录中 wget http://cn2.php.net/distributions/php-7.0.4.tar.gz 下载php7.0.4版本

 

2、解压 tar zxvf php-7.0.4.tar.gz

3、进入解压后的文件:cd php-7.0.4

4、编译:

./configure --prefix=/usr/local/php \
 --with-curl \
 --with-freetype-dir \
 --with-gd \
 --with-gettext \
 --with-iconv-dir \
 --with-kerberos \
 --with-libdir=lib64 \
 --with-libxml-dir \
 --with-mysqli \
 --with-openssl \
 --with-pcre-regex \
 --with-pdo-mysql \
 --with-pdo-sqlite \
 --with-pear \
 --with-png-dir \
 --with-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip

5、安装依赖:

 

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre-devel

yum -y install curl-devel

 

yum -y install libxslt-devel

yum -y install gcc

yum -y install openssl openssl-devel 

6、安装: make &&  make install

7、配置文件

# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

8、把php-fpm设置为开机自启,方法是:

在/etc/rc.local 文件中加入一行:/etc/init.d/php-fpm start

然后赋权:chmod +x /etc/rc.local

9、把php添加到全局路径里面,添加方法:

vim /etc/profile 在最后一行加入一句

export PATH="/usr/local/php/bin:$PATH"

保存以后

输入命令:source /etc/profile 立即生效

10、测试是否成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值