Unable to create the pid file (/run/php-fpm/php-fpm pid no such file or directory)

I installed php8.1 on ubuntu 18.04 but getting problems. I am getting 502 Bad Gateway error. The error.log is giving following error:

2022/06/30 17:48:38 [crit] 2224#2224: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: _, request: "GET /w3_scalar.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "localhost

Other details are:

$ sudo nginx -t [sudo] password for zulfi: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

and

$ sudo systemctl restart php8.1-fpm ~$ sudo systemctl status nginx.service ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en Active: active (running) since Wed 2022-06-29 15:49:48 CDT; 1 day 2h ago Docs: man:nginx(8) Process: 2220 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code Process: 2010 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process Main PID: 2221 (nginx) Tasks: 13 (limit: 4915) CGroup: /system.slice/nginx.service ├─2221 nginx: master process /usr/sbin/nginx -g daemon on; master_pro ├─2224 nginx: worker process ├─2226 nginx: worker process ~$ journalctl -xe -- Unit systemd-hostnamed.service has finished starting up. -- -- The start-up result is RESULT. Jun 30 17:58:08 lc2530hz audit[20050]: AVC apparmor="ALLOWED" operation="connect Jun 30 17:58:08 lc2530hz audit[20050]: AVC apparmor="ALLOWED" operation="file_pe Jun 30 17:58:08 lc2530hz audit[20050]: AVC apparmor="ALLOWED" operation="file_pe Jun 30 17:58:08 lc2530hz audit[20050]: AVC apparmor="ALLOWED" operation="file_pe Jun 30 17:58:08 lc2530hz audit[20050]: AVC apparmor="ALLOWED" operation="file_pe Jun 30 17:58:08 lc2530hz kernel: audit: type=1400 audit(1656629888.891:266): app Jun 30 17:58:08 lc2530hz kernel: audit: type=1400 audit(1656629888.891:267): app Jun 30 17:58:08 lc2530hz kernel: audit: type=1400 audit(1656629888.891:268): app Jun 30 17:58:08 lc2530hz kernel: audit: type=1400 audit(1656629888.891:269): app Jun 30 17:58:08 lc2530hz kernel: audit: type=1400 audit(1656629888.891:270): app Jun 30 17:58:09 lc2530hz org.gnome.Nautilus[4167]: func=xmlSecCheckVersionExt:fi Jun 30 17:58:09 lc2530hz kernel: CPU4: Core temperature above threshold, cpu clo Jun 30 17:58:09 lc2530hz kernel: CPU10: Core temperature above threshold, cpu cl Jun 30 17:58:09 lc2530hz kernel: CPU4: Core temperature/speed normal Jun 30 17:58:09 lc2530hz kernel: CPU10: Core temperature/speed normal

Files information is:

/etc/php/8.1/fpm/php-fpm.conf pid = /run/php/php8.1-fpm.pid error_log = /var/log/php8.1-fpm.log include=/etc/php/8.1/fpm/pool.d/*.conf /etc/php/8.1/fpm/pool.d/www.conf: user = www-data group = www-data listen = /run/php/php8.1-fpm.sock listen.group = www-data listen = 127.0.0.1:9000

Some body please guide me how to solve this bad Gateway 502 error when I execute my php file on browser using : //localhost/w3_scalar.php

Note the above file was running on php 7.4 Zulfi.

==Jul 3 2022 @Tom Yan :First command

$ systemctl status php8.1-fpm ● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor prese Active: active (running) since Sun 2022-07-03 16:58:24 CDT; 42min ago Docs: man:php-fpm8.1(8) Process: 2087 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/ph Main PID: 1921 (php-fpm8.1) Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/se Tasks: 3 (limit: 4915) CGroup: /system.slice/php8.1-fpm.service ├─1921 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf) ├─2079 php-fpm: pool www └─2085 php-fpm: pool www Jul 03 16:58:24 lc2530hz systemd[1]: Starting The PHP 8.1 FastCGI Process Manage Jul 03 16:58:24 lc2530hz systemd[1]: Started The PHP 8.1 FastCGI Process Manager

Second Command:

$ journalctl -bu php8.1-fpm Failed to parse boot descriptor 'u'

I found the following link: //stackoverflow.com/questions/51158830/nginx-connect-to-unix-var-run-php7-2-fpm-sock-failed-2-no-such-file-or-dir,

but it is not related to php8.1-fpm, somebody please guide me.

$ sudo ps aux | grep 'php' [sudo] password for zulfi: root 1921 0.0 0.1 454156 27524 ? Ss 16:58 0:00 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf) www-data 2079 0.0 0.0 456452 13896 ? S 16:58 0:00 php-fpm: pool www www-data 2085 0.0 0.0 456452 13896 ? S 16:58 0:00 php-fpm: pool www zulfi 13627 0.0 0.0 210984 6284 ? Sl 17:39 0:00 /usr/lib/libreoffice/program/oosplash --writer file:///home/zulfi/Linux_Forum_SC%20Tools/nginx/nginx%20for%20php8/502%20bad%20gateway%20connect%20problem8p1.odt zulfi 13646 99.7 2.7 2006652 443460 ? Rl 17:39 25:54 /usr/lib/libreoffice/program/soffice.bin --writer file:///home/zulfi/Linux_Forum_SC%20Tools/nginx/nginx%20for%20php8/502%20bad%20gateway%20connect%20problem8p1.odt --splash-pipe=5 zulfi 15893 0.0 0.0 14432 1116 pts/0 S+ 18:05 0:00 grep --color=auto php

Also: ~$ sudo systemctl is-active php8.1-fpm.service active

@Tom Yan

$ ls -l /var/ total 52 drwxr-xr-x 2 root root 4096 Jul 3 17:03 backups drwxr-xr-x 18 root root 4096 May 27 17:18 cache drwxrwsrwt 2 root whoopsie 4096 Jun 22 16:44 crash drwxr-xr-x 86 root root 4096 Feb 18 23:31 lib drwxrwsr-x 2 root staff 4096 Apr 24 2018 local lrwxrwxrwx 1 root root 9 Feb 8 2019 lock -> /run/lock drwxrwxr-x 18 root syslog 4096 Jul 3 17:03 log drwxrwsr-x 2 root mail 4096 Jul 24 2018 mail drwxrwsrwt 2 root whoopsie 4096 Jul 24 2018 metrics drwxr-xr-x 2 root root 4096 Jul 24 2018 opt lrwxrwxrwx 1 root root 4 Feb 8 2019 run -> /run drwxr-xr-x 21 root root 4096 Apr 12 23:08 snap drwxr-xr-x 7 root root 4096 Jul 24 2018 spool drwxrwxrwt 9 root root 4096 Jul 3 18:09 tmp drwxrwxrwx 3 root root 4096 May 23 2019 w

@Tom Yan

still getting: 2022/07/03 18:48:19 [crit] 2108#2108: *6 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: _, request: "GET /w3_static.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "localhost"

status:

$ sudo systemctl status /var/run/php/php8.1-fpm.sock [sudo] password for zulfi: Unit var-run-php-php8.1\x2dfpm.sock.mount could not be found.

My listen=listen = /run/php/php8.1-fpm.sock, should I change it to /var/run/php8.1-fpm.sock?

@Tom Yan,stat gives me error:

$stat /var/run/php/php8.1-fpm.sock stat: cannot stat '/var/run/php/php8.1-fpm.sock': No such file or directory

I have other versions also:

$ ls /etc/php 7.2 8.0 8.1

Are they creating problem? @Tom Yan ==July 4, 2022

~$ ls /var/run/ acpid.pid initctl snap.docker acpid.socket initramfs snapd-snap.socket alsa libvirt snapd.socket apache2 libvirtd.pid spice-vdagentd avahi-daemon lock sshd boltd log sshd.pid console-setup lvm sudo containerd lvmetad.pid systemd crond.pid mlocate.daily.lock teamviewerd.ipc crond.reboot mount teamviewerd.pid cups mysqld thermald dbus netns tmpfiles.d dhclient6-wlp2s0.pid network udev dhclient-wlp2s0.pid NetworkManager udisks2 dmeventd-client nginx.pid unattended-upgrades.lock dmeventd-server php user docker plymouth utmp docker.pid pppconfig uuidd docker.sock rsyslogd.pid wpa_supplicant ebtables.lock sendsigs.omit.d xtables.lock gdm3 shm gdm3.pid snapd

and

@lc2530hz:

~$ ls /var/run/php php8.1-fpm.pid

@lc2530hz:~$ Also www.conf has following addition:

listen.user = www-data

and listen = 127.0.0.1:9000 changed to:

listen = 127.0.0.1

Do I still need:

listen.owner = www-data

@Tom Yan, I am getting failed message:

$ sudo systemctl restart php8.1-fpm Job for php8.1-fpm.service failed because the control process exited with error code. See "systemctl status php8.1-fpm.service" and "journalctl -xe" for details. zulfi@lc2530hz:/etc/php/8.1/fpm/pool.d$ systemctl status php8.1-fpm.service ● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor prese Active: failed (Result: exit-code) since Mon 2022-07-04 18:26:53 CDT; 1min 54 Docs: man:php-fpm8.1(8)

and $ journalctl -xe Jul 04 18:28:48 lc2530hz kernel: CPU6: Package temperature above threshold, cpu Jul 04 18:28:48 lc2530hz kernel: CPU1: Package temperature above threshold, cpu Jul 04 18:28:48 lc2530hz kernel: CPU7: Pack

ag

Zulfi.

How do I enable FPM?

Enable PHP-FPM for multiple domains:.
Log into WHM..
Navigate to MultiPHP Manager..
In the bottom section, under Set PHP Version per Domain, scroll through your list of domains and click the checkbox to the left of each domain you want to enable PHP-FPM on..

How do I know if PHP

To find out php version installed on the server type any one of the following commands on your server. Open the terminal prompt and then type the following commands. Are you using php-fpm? Get php version using the php-fmp -v or php-fpm73 -v command.

How do I download PHP

How to Install PHP-FPM with Apache on Ubuntu 20.04.
Step 1: Add PPA for PHP 8.1. Add the ondrej/php which has PHP 8.1 package and other required PHP extensions. ... .
Step 2: Install PHP 8.1 FPM. ... .
Step 3: Install Apache. ... .
Step 4: Configure Apache with PHP-FPM. ... .
Step 6: Configure Apache Virtual Hosts. ... .
Step 7: Verify PHP-FPM with Apache..

What is PHP

Description. The PHP language is an Open Source general-purpose scripting language that is popular with web-developers who leverage its ability to create dynamically generated web pages. PHP-FPM is a PHP FastCGI implementation that controls process management, workers, and logging for PHP.

Postingan terbaru

LIHAT SEMUA