当前位置:网站首页>php7.4升级php8.0后重启系统网站访问异常问题
php7.4升级php8.0后重启系统网站访问异常问题
2022-07-19 16:27:00 【游戏编程】
安装完php8.0之后也禁用了旧版本php:
禁用php
sudo a2dismod php7.4
启用php
sudo a2enmod php8.0
也重启了php8.0-fpm服务:
sudo service php8.0-fpm restart
但访问网站报如下异常:
错误日志:
[proxy:error] [pid 304] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.4-fpm.sock (*) failed
[proxy_fcgi:error] [pid 304] [client ::1:50964] AH01079: failed to make connection to backend: httpd-UDS
发现使用的还是旧版本的php,最后发现是/etc/apache2/conf-enabled目录下使用的还是“php7.4-fpm.conf”,这个conf-enabled目录里都是快捷方式,是/etc/apache2/conf-available目录里文件的快捷方式。
所以,想办法给php8.0-fpm创建一个快捷方式,执行如下命令:
cd /etc/apache2/conf-enabled
ln -s ../conf-available/php8.0-fpm.conf php8.0-fpm.conf
删除旧版本的快捷方式:
rm php7.4-fpm.conf
然后执行以下命令,启动php8.0-fpm:
sudo service php8.0-fpm restart
再请求网站,即可正常访问。
隔天重启操作系统后还是报如下异常:

错误日志:
[proxy:error] [pid 304] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.0-fpm.sock (*) failed
[proxy_fcgi:error] [pid 304] [client ::1:50964] AH01079: failed to make connection to backend: httpd-UDS
最后发现需要手动启动php8.0-fpm服务,执行以下命令就可以了:
sudo service php8.0-fpm start
可能每次重启系统php默认是不开启的吧,那就加一个开机启动脚本,我使用的是Win10子系统,先在Win自启动目录(打开方式:Win+R=>运行=>shell:Startup)下创建一个bat脚本文件,然后在bat文件中调用ubuntu中的脚本文件,bat文件内容:
脚本作用,以管理员身份运行/etc/init.sh脚本,内容如下:
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",0)(window.close)&&exit
cd /d "%~dp0"
C:\Windows\System32\wsl.exe -d Ubuntu-20.04 -u root /etc/init.sh
再在/etc目录下创建了一个init.sh脚本文件,Win系统每次开机时自动执行以下命令:
sudo service mysql start
sudo service php8.0-fpm start
sudo service apache2 start
sudo service xrdp start
sleep 3 #注意注意注意,这里要等待一会儿,不然命令没执行完,窗口就关闭了
这样每次宿主系统重启时,就会自动启动ubuntu系统中的服务,使网站可以正常访问。
注意:上述Win10自启动目录里的脚本,需要在重启系统后登录账号才会执行。
作者:fengxingke
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- Software testing and application final review
- Lora and its modulation of IOT chip protocol
- 教你使用CANN将照片一键转换成卡通风格
- YUV 播放器
- 为 KubeSphere 集群启用免费的泛域名 SSL 证书并实现证书自动更新和分发
- 盒马“腰斩”,都怪侯毅话多?
- After resetting the computer, install MySQL 5.7.38 and msvcp120 is missing dll
- 2022年理财产品都有哪些种类?适合新手的是哪个?
- Read the source code ThreadLocal together
- windows下celery配置连接redis报错问题修复(TypeError: __init__() got an unexpected keyword argement )
猜你喜欢
Solution of webdriver click login failure
Is there a shortcut to the success of the test post? I tell you, the only shortcut is not to take detours
【软件测试】一两个月带出来的新测试人员,到底有多厉害?
There are 13 steps to install pychart, isn't it? (super detailed tutorial)
从门户时代到信息流时代,好内容反而被忽略了?
Are you still worried about the implementation plan change for Oracle database migration?
关于收发邮件中的一些概念解释(收件人 抄送人 密送人 回复 回复全部)
Distributed practice of Everbright Bank: database architecture transformation of China's largest payment platform
Summary of project experience - send it to the friends of the testing post who are doing the project
[software testing] test outline method - Test Case Writing
随机推荐
如何做好安全开发?
开源测试框架期末复习
跟着苹果不赚钱,2万亿“果链”弃“果”拥“特”
浏览器查看.md文件强烈推荐Markdown Viewer
CPU对存储器读写
教你使用CANN将照片一键转换成卡通风格
How to set database alarms
蔚小理,从难兄难弟到互相嫌弃
How to open an account for agricultural futures trading?
软件测试面试101问(附答案)
常见的跨域场景
再谈程序员学英语
Markdown beginner grammar summary
记一次爬取搜索引擎缩略图并保存到本地
vscode 保存设置配置参数到用户与工作区的区别
玩转时习知No.7 | 今年过节不学习,学习只学......
背包问题
激光雷达构建地图( 覆盖栅格建图)
js笔记十七:typescript项目的jest项目配置全过程
The first bullet of FPGA Development: vivado software installation, development, use and engineering establishment