Linux常见问题

Linux环境

Nginx安装报错

configure编译错误

01-编译错误-20230518-266

make安装错误

02-make安装错误-20230518-475

解决方法

错误表示说没有找到error.log文件,没有办法设置日志文件环境变量,所以报错了。

那我们创建一个就好了,报错的路径在哪里,我们就在哪里创建一个日志文件。

1
2
mkdir -p /usr/local/nginx/logs/
touch /usr/local/nginx/logs/error.log

PHP-FPM启动报错

排查错误

启动PHP-FPM报错

1
Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.

查看PHP-FPM状态

查看状态是否报错,或者看看能不能从状态看出点问题来。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@ECS- bin]# systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2023-05-19 13:16:46 UTC; 8s ago
Process: 9963 ExecStart=/usr/sbin/php-fpm --nodaemonize (code=exited, status=78)
Main PID: 9963 (code=exited, status=78)

May 19 13:16:46 ECS-4214242469 systemd[1]: Starting The PHP FastCGI Process Manager...
May 19 13:16:46 ECS-4214242469 php-fpm[9963]: [19-May-2023 13:16:46] ERROR: [/etc/php-fpm.d/www.conf:126] value is NULL for a ZEND_INI_PARSER_ENTRY
May 19 13:16:46 ECS-4214242469 php-fpm[9963]: [19-May-2023 13:16:46] ERROR: Unable to include /etc/php-fpm.d/www.conf from /etc/php-fpm.conf at line 126
May 19 13:16:46 ECS-4214242469 php-fpm[9963]: [19-May-2023 13:16:46] ERROR: failed to load configuration file '/etc/php-fpm.conf'
May 19 13:16:46 ECS-4214242469 php-fpm[9963]: [19-May-2023 13:16:46] ERROR: FPM initialization failed
May 19 13:16:46 ECS-4214242469 systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
May 19 13:16:46 ECS-4214242469 systemd[1]: Failed to start The PHP FastCGI Process Manager.
May 19 13:16:46 ECS-4214242469 systemd[1]: Unit php-fpm.service entered failed state.
May 19 13:16:46 ECS-4214242469 systemd[1]: php-fpm.service failed.

查看详细日志

使用journalctl -xe命令来查看PHP-FPM日志,查看详细错误。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[root@ECS-429 bin]# journalctl -xe
May 19 12:50:58 ECS-4214242469 polkitd[578]: Unregistered Authentication Agent for unix-process:31844:27898409 (system bus name :1.278, object path /org/fr
May 19 12:52:28 ECS-4214242469 polkitd[578]: Registered Authentication Agent for unix-process:32471:27907496 (system bus name :1.279 [/usr/bin/pkttyagent -
May 19 12:52:28 ECS-4214242469 systemd[1]: Starting The PHP FastCGI Process Manager...
-- Subject: Unit php-fpm.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php-fpm.service has begun starting up.
May 19 12:52:28 ECS-4214242469 php-fpm[32477]: [19-May-2023 12:52:28] ALERT: [pool www] pm.min_spare_servers(5) and pm.max_spare_servers(35) cannot be grea
May 19 12:52:28 ECS-4214242469 php-fpm[32477]: [19-May-2023 12:52:28] ERROR: failed to post process the configuration
May 19 12:52:28 ECS-4214242469 php-fpm[32477]: [19-May-2023 12:52:28] ERROR: FPM initialization failed
May 19 12:52:28 ECS-4214242469 systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
May 19 12:52:28 ECS-4214242469 systemd[1]: Failed to start The PHP FastCGI Process Manager.
-- Subject: Unit php-fpm.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php-fpm.service has failed.
--
-- The result is failed.
May 19 12:52:28 ECS-4214242469 systemd[1]: Unit php-fpm.service entered failed state.
May 19 12:52:28 ECS-4214242469 systemd[1]: php-fpm.service failed.
May 19 12:52:28 ECS-4214242469 polkitd[578]: Unregistered Authentication Agent for unix-process:32471:27907496 (system bus name :1.279, object path /org/fr
May 19 12:54:03 ECS-4214242469 polkitd[578]: Registered Authentication Agent for unix-process:694:27916937 (system bus name :1.280 [/usr/bin/pkttyagent --n
May 19 12:54:03 ECS-4214242469 systemd[1]: Starting The PHP FastCGI Process Manager...
-- Subject: Unit php-fpm.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php-fpm.service has begun starting up.
May 19 12:54:03 ECS-4214242469 php-fpm[700]: [19-May-2023 12:54:03] ALERT: [pool www] pm.min_spare_servers(5) and pm.max_spare_servers(35) cannot be greate
May 19 12:54:03 ECS-4214242469 php-fpm[700]: [19-May-2023 12:54:03] ERROR: failed to post process the configuration
May 19 12:54:03 ECS-4214242469 php-fpm[700]: [19-May-2023 12:54:03] ERROR: FPM initialization failed
May 19 12:54:03 ECS-4214242469 systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
May 19 12:54:03 ECS-4214242469 polkitd[578]: Unregistered Authentication Agent for unix-process:694:27916937 (system bus name :1.280, object path /org/free
May 19 12:54:03 ECS-4214242469 systemd[1]: Failed to start The PHP FastCGI Process Manager.
-- Subject: Unit php-fpm.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php-fpm.service has failed.
--
-- The result is failed.
May 19 12:54:03 ECS-4214242469 systemd[1]: Unit php-fpm.service entered failed state.
May 19 12:54:03 ECS-4214242469 systemd[1]: php-fpm.service failed.

解决方法

从日志可以分析得到,是我的PHP-FPM配置出错了,是pm.min_spare_servers、pm.max_spare_servers、pm.max_children 之间的关系没有配置正确。

我在这半天之前,有修改过/etc/php-fpm.d/www.conf配置文件,但那时候没有生效,到现在才生效报错,真实奇怪。

我那时候修改了一下pm.max_children,以为只修改这个就好了,知道报错才知道,原来配置之间还有个关系,我都没留意到。

也即是:

pm.min_spare_servers < pm.max_children

pm.max_spare_servers < pm.max_children

MySQL数据库

远程MySQL导出数据出错

1
mysqldump: Got error: 2026: SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol when trying to connect

这个问题可能是由于 MySQL 客户端与服务器端使用的 TLS 版本不匹配所导致的。

解决问题

我使用的是Dbeaver出错了,我们更换Navicat Premium使用就可以解决这个问题。