PHP7 Centos7环境下 安装

2025-05-14 16:31:25

1、安装源配置1.下载 epel 安装源wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm2. 安装epel 安装源rpm -Uvh epel-release-latest-7.noarch.rpm2.安装 webtatic 安装源rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm3.更新yum缓存yum makecache fast

PHP7 Centos7环境下 安装PHP7 Centos7环境下 安装

3、验证是否安装成功1.查看PHP版本php -v2.查看PHP安装的插件php -m

PHP7 Centos7环境下 安装

4、配置PHP-FPM(以socket方式)1.vi /etc/php-fpm.d/www.conf2.将listen = 127.0.0.1:9000改为:listen = /var/run/php-fpm/php-fpm.sock3.启动php-fpmsystemctl start php-fpm4.查看启动是否成功ps -ef | grep php-fpm

PHP7 Centos7环境下 安装

5、安装以及配置ngin垓矗梅吒x1.安装nginxyum install -y nginx2.验证nginx是否安装成功nginx -v3.整合nginx和php-fpmvi /etc/nginx/nginx.conf添加以下内容location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }4.重启nginxsystemctl restart nginx

PHP7 Centos7环境下 安装

6、以PHP-FPM方式运行PHP71.新建个php文件touch /usr/share/nginx/html/info.php2.添加以下内容:<?phpphpinfo();3.浏览器输入地址 http://127.0.0.1/info.php看到输出内容表示运行成功。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢