我在 solus OS 上启动 php-fpm 服务时遇到了一些问题。看来这可能与 snmp 模块有关。
以下是有关该错误的一些信息:
~ $ sudo systemctl status php-fpm
Mot de passe :
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Mon 2021-04-12 11:34:02 CEST; 3min 52s ago
Process: 4958 ExecStart=/usr/sbin/php-fpm --nodaemonize --fpm-config /etc/php/php-fpm.conf (code=exited, status=0/SUCCESS)
Main PID: 4958 (code=exited, status=0/SUCCESS)
CPU: 69ms
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (SNMPv2-TM): At line 0 in (none)
avril 12 11:32:32 keynux-fab php-fpm[4958]: Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
avril 12 11:34:02 keynux-fab systemd[1]: php-fpm.service: start operation timed out. Terminating.
avril 12 11:34:02 keynux-fab systemd[1]: php-fpm.service: Failed with result 'timeout'.
avril 12 11:34:02 keynux-fab systemd[1]: Failed to start The PHP FastCGI Process Manager.
当我尝试独立启动 php-fpm 时:
~ $ sudo /usr/sbin/php-fpm --nodaemonize --fpm-config /etc/php/php-fpm.conf
Mot de passe :
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (IPV6-ICMP-MIB): At line 0 in (none)
Cannot find module (IPV6-MIB): At line 0 in (none)
Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
[12-Apr-2021 11:47:59] NOTICE: fpm is running, pid 5410
[12-Apr-2021 11:47:59] NOTICE: ready to handle connections
[12-Apr-2021 11:47:59] NOTICE: systemd monitor interval set to 10000ms
它似乎启动了,但是我在位于 /var/www/ 的所有 php 脚本上都得到了 403“访问被拒绝”当我这样做时我得到了相同的结果(访问被拒绝):
~ $ sudo systemctl edit php-fpm
然后输入:
### Editing /etc/systemd/system/php-fpm.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
Type=simple
然后
~ $ sudo systemctl daemon-reload
~ $ sudo systemctl start php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/php-fpm.service.d
└─override.conf
Active: active (running) since Mon 2021-04-12 11:57:13 CEST; 1s ago
Main PID: 5588 (php-fpm)
Tasks: 3 (limit: 9349)
Memory: 9.4M
CPU: 61ms
CGroup: /system.slice/php-fpm.service
├─5588 php-fpm: master process (/etc/php/php-fpm.conf)
├─5593 php-fpm: pool www
└─5594 php-fpm: pool www
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (IPV6-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (SNMPv2-TM): At line 0 in (none)
avril 12 11:57:13 keynux-fab php-fpm[5588]: Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
问题似乎是 php 无法在 /usr/share/snmp/mibs 中找到 mib。但是,所有 mib 都在这个文件夹中,所以我不知道为什么找不到它们。我尝试重新安装 net-snmp,但没有效果。
我能够在全新安装的 solus 上重现该问题:我所做的就是
- 安装 httpd 和 php。Php 运行正常
- 在 /etc/php/php.ini 中注释掉“extension=snmp”行
- 重新启动 httpd 和 php-fpm。php-fpm 服务失败,没有 snmp 错误。
- 取消注释 /etc/php/php.ini 中的“extension=snmp”行
- 重新启动httpd和php-fpm。php-fpm服务失败如上所述。
如果有人知道如何解决这个问题,那将会非常有帮助......我很乐意提供任何有用的日志。
php 版本是 7.3.26。我没有对默认的 php 配置做任何更改,也没有对 www 池配置做任何更改。我对配置所做的唯一更改是在 /etc/httpd/conf.d/httpd.conf 中:
LoadModule deflate_module lib64/httpd/mod_deflate.so
LoadModule rewrite_module lib64/httpd/mod_rewrite.so
LoadModule expires_module lib64/httpd/mod_expires.so
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 127.0.0.1
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www"
<Directory "/var/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
感谢您的帮助。