微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS7 源码安装PHP

CentOS7 源码编译安装PHP

准备工作:

下载PHP源码包

wget https://www.PHP.net/distributions/PHP-7.2.19.tar.gz             (官网下载慢可用百度网盘下载)

下载依赖工具:

# yum -y install gcc libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

配置PHP

#./configure --prefix=/usr/local/PHP7 --with-config-file-path=/usr/local/PHP7 --enable-sockets --enable-fpm --enable-cli --enable-mbstring --enable-pcntl --enable-soap --enable-opcache --disable-fileinfo --disable-rpath --with-MysqLi --with-pdo-MysqL --with-iconv-dir --with-openssl --with-fpm-user=www --with-fpm-group=www --with-curl --with-mhash --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-zip --with-zlib --enable-simplexml --with-libxml-dir 

编译安装:

#make  && make install

配置Nginx支持

cp PHP-7.2.19/PHP.ini-production /usr/local/PHP/PHP.ini # 复制 PHP.ini 文件到目录

vim /usr/local/Nginx/conf/Nginx.conf

http { server { location / { root html; index index.PHP index.html index.htm; } location ~ \.PHP$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ... }

重启PHP-fpm:

# pkill -9 PHP-fpm
# /usr/local/PHP7/sbin/PHP-fpm

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐