skip to Main Content

Using: Ubuntu 20.04
PHP starts failed because missing /var/run/php-fpm/php7.4-fpm.sock & /var/run/php-fpm/php7.4-fpm.pid.
Heres the details: (feedback from systemctl status php7.4-fpm.service)

● php-fpm7.4[3465899]:ERROR: unable to bind
listening socket for address ‘/var/run/php-fpm/php7.5-fpm.sock’: No such
file or directory (2)

● php-fpm7.4[3465899]:ERROR: unable to bind
listening socket for address ‘/run/php-fpm/php7.5-fpm.pid’: No such
file or directory (2)

I checked "/etc/php/7.4/fpm/pool.d/www.conf", but there is the following code in the file:

;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php7.4-fpm.sock

2

Answers


  1. Chosen as BEST ANSWER

    Type in:

    cd /run
    sudo mkdir php 
    sudo mkdir php7.4-fpm
    cd /etc/php/7.4/fpm/pool.d/
    cp www.conf www.conf.backup
    vi www.conf
    

    Find following code:
    line 36:

    listen = /run/php/php7.4-fpm.sock

    change it to:

    listen = 127.0.0.1:9000

    line 133:

    listen = /var/run/php-fpm/php7.4-fpm.sock

    Remove that line, save that file, and type in:

    sudo service php7.4-fpm stop
    sudo service php7.4-fpm start
    

    Thanks: @tkausl @dai007uk


  2. php-fpm7.4[3465899]:ERROR: unable to bind listening socket for address ‘/var/run/php-fpm/php7.5-fpm.sock’: No such file or directory

    First problem: it is searching for php7.5-fpm.sock instead of php7.4-fpm.sock

    But since you confirmed that your /etc/php/7.4/fpm/pool.d/www.conf indeed has listen = /var/run/php-fpm/php7.4-fpm.sock, I will just assume the php7.5-fpm.sock naming was handled/adjusted.

    Second problem: the .sock file does not exist when your FPM is running. To solve this, run the following:

    mkdir -p /var/run/php-fpm
    touch /var/run/php-fpm/php7.4-fpm.sock
    

    NOTE:
    If you get permission denied, you should use sudo for the above commands.

    Then restart your PHP-FPM service.

    Hope that helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search