您的位置:首页 > 运维架构 > Linux

centos7 安装php-7.0.4

2016-03-19 13:44 585 查看
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 mysql 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/php-fpm /etc/init.d/php-fpm

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

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

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

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

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

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

保存以后

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

10、测试是否成功
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: