what socket file is specified in the php-fpm config?
I think this is what your asking for
from vi /etc/php-fpm.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Default Value: none
pid = /run/php-fpm/php-fpm.pid
I have tried changing it to
;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Default Value: none
pid = /var/run/php-fpm/php-fpm.pid
but I still get 502
[root@brnnetmonpro01 php-fpm]# pwd
/var/run/php-fpm
[root@- php-fpm]# ll
total 4
-rw-r–r--. 1 root root 5 Dec 3 17:14 php-fpm.pid
No, I mean the socket file. Like /run/php-fpm/php7.4-fpm.sock
How u upgrade php to 7.3?
I was in the same situation.
Issuing the commands
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
moved me one step further.
I don’t have errors on /var/log/nginx/error.log
Page on browser presents the following message:
Whoops, the web server could not write required files to the filesystem.
Running the following commands will fix the issue most of the time:
Cannot write to log file: “/opt/librenms/logs/librenms.log”
Make sure it exists and is writable, or change your LOG_DIR setting.
If using SELinux you may also need:
semanage fcontext -a -t httpd_sys_rw_content_t ‘/opt/librenms/logs/librenms.log(/.*)?’
restorecon -RFv /opt/librenms/logs/librenms.log
Check your log for more details. ( /opt/librenms/logs/librenms.log )
If that doesn’t fix the issue. You can find how to get help at https://docs.librenms.org/Support.
Run ./validate.php and it will show you the commands to fix permissions.
Thanks. I ran ./validate and here is the result:
./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.70.1
DB Schema | 2020_11_02_164331_add_powerstate_enum_to_vminfo (191)
PHP | 7.4.13
Python | 3.6.8
MySQL | 5.5.68-MariaDB
RRDTool | 1.4.8
SNMP | NET-SNMP 5.7.2
OpenSSL |
====================================
[OK] Composer Version: 2.0.7
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Time between this server and the mysql database is off
Mysql time 2020-12-03 17:17:14
PHP time 2020-12-03 18:17:14
[FAIL] MySQL Database collation is wrong: latin1 latin1_swedish_ci
[FIX]:
Check https://t.libren.ms/-zdwk for info on how to fix.
[OK] Database schema correct
[FAIL] You have no timezone set for php.
[FIX]:
http://php.net/manual/en/datetime.configuration.php#ini.date.timezone
Here is the permissions for librenms.log:
ll /opt/librenms/logs/ total 3186696 -rw-rw-r--. 1 librenms librenms 2198529 Dec 3 16:23 daily.log -rw-rw-r--. 1 librenms librenms 0 Jun 2 2020 discovery_wrapper.log -rw-rw-r--. 1 librenms librenms 3259143613 Dec 3 17:17 librenms.log -rw-rw-r--. 1 librenms librenms 0 Jun 2 2020 poller_wrapper.log -rw-rw-r--. 1 librenms librenms 0 Jun 2 2020 services_wrapper.log
on file /etc/php-fpm.d/www.conf I changed user and group from apache to librenms and I get to the login page.
sudo less /etc/php-fpm.d/www.conf
; Start a new pool named ‘www’.
; the variable $pool can be used in any directive and will be replaced by the
; pool name (‘www’ here)
[www]; Per pool prefix
; It only applies on the following directives:
; - ‘access.log’
; - ‘slowlog’
; - ‘listen’ (unixsocket)
; - ‘chroot’
; - ‘chdir’
; - ‘php_values’
; - ‘php_admin_values’
; When not set, the global prefix (or @php_fpm_prefix@) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user’s group
; will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
;user = apache
user = librenms
; RPM: Keep a group allowed to write in log dir.
;group = apache
group = librenms
Now the error is LDAP related:
PHP LDAP support missing
PHP does not support LDAP, please install or enable the PHP LDAP extension
Check your log for more details. (librenms.log)
If you need additional help, you can find how to get help at How to get help - LibreNMS Docs.
OK, installed php-ldap (is missing from the copy+paste guide), restart the services (well not actually, I reboot the damn thing) and we are back monitoring!
sudo yum install php-ldap
in
/etc/php-fpm.d/www.conf
I have this
127.0.0.1:9000
Think I should put that in nginx.conf then ?
Yes, for the listen
value
or change listen to the socket
Do you use SELinux? Have you checked your permissions for /opt/librenms/logs?
on file /etc/php-fpm.d/www.conf change user and group from apache to librenms
Example:
sudo less /etc/php-fpm.d/www.conf
; Start a new pool named ‘www’.
; the variable $pool can be used in any directive and will be replaced by the
; pool name (‘www’ here)
[www]; Per pool prefix
; It only applies on the following directives:
; - ‘access.log’
; - ‘slowlog’
; - ‘listen’ (unixsocket)
; - ‘chroot’
; - ‘chdir’
; - ‘php_values’
; - ‘php_admin_values’
; When not set, the global prefix (or @php_fpm_prefix@) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user’s group
; will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
;user = apache
user = librenms
; RPM: Keep a group allowed to write in log dir.
;group = apache
group = librenms
For reference I had to edit these 2 files.
vi /etc/php-fpm.conf
vi /etc/nginx/conf.d/librenms.conf
configure the sock link and restart the 2 services
systemctl restart php-fpm
systemctl restart nginx
If the service isn’t enabled you can run these command
systemctl enable --now nginx
systemctl enable --now php-fpm
I used this guide to upgrade PHP to 7.4
Careful with changing php-fpm to run as librenms if you have more than one website on this server.
The new install docs have you create a custom fpm config on a specific socket for LibreNMS running as the user. When using www, it is likely to be shared with other sites, so it should not run as librenms. Check the current install docs to see.
How do I switch to that? I have the same problem, but there’s no php v7.3 update available on my version of the librenms VM I installed.
Following this guide: https://www.tecmint.com/install-php-7-in-centos-7/, disabling the webtatic repo, and then doing a yum update
on my Librenms VM allowed me to get the new version of PHP.
I then had the bad gateway
error, but enabling and then starting php-fpm
seems to have fixed the problem