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 mysql pcre-develyum -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、测试是否成功
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。