1, 下载php74,
sudo yum list installed|grep php
sudo yum remove php* -y
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum -y install php74 php74-php-devel
sudo yum install php74-php-fpm
php74 -v
2, 配置php.ini:
;cgi.fix_pathinfo=1
删除分号改为:cgi.fix_pathinfo=0
3, 配置nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
4, 启动php-fpm:
/opt/remi/php74/root/usr/sbin/php-fpm
5, 网页打开php文件出现No input file specified.
改PHP.ini中的doc_root行,打开ini文件注释掉此行
保证更改php.ini
首先保证php.ini的配置中把
;cgi.fix_pathinfo=1 改为
cgi.fix_pathinfo=0
重启PHP或PHP-FPM
在nginx.conf 找到:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改为:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
重启nginx【killall -9 nginx, systemctl restart nginx】解决
来源地址:https://blog.csdn.net/qq_49416650/article/details/129692759