5

I tried to install nginx and PHP7 with FPM using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04

When I try to access any .php file I get 502 Bad Gateway. When I try to restart php7.0-fpm, I get this:

sudo service php7.0-fpm restart
stop: Unknown instance: 
php7.0-fpm start/running, process 5379

My nginx config:

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

My server is Ubuntu Server 14.04

sotirov
  • 4,379

4 Answers4

4

Try to check your nginx's www.conf file and make sure the socket path is correct and socket file is present at that location while these services are running.

ie, /var/run/php/php7.0-fpm.sock or

/dev/shm/php-fpm-www.sock

try to start php-fpm from init.d

/etc/init.d/php-7.0.0-fpm start

and check your php.ini file also

add the following to the end of the file

[apc]
apc.write_lock = 1
apc.slam_defense = 0
1

It is likely that an older libpcre3 is installed and satisfies the dependency in the php7.0 package, but only the newer library package provides pcre_jit_stack_free.

If this is the case, do an apt-get install libpcre3, and you’re good to go.

Ref.: https://github.com/oerdnj/deb.sury.org/issues/372

1

I'd literally been fighting this for days, when I found the solution. It was a typo in /etc/nginx/sites-available/www (copied originally from ...sites-available/default and modified).

I'd overlooked this in both the file itself and the /var/log/nginx/error.log --even though the error log was clear

connect to unix: /var/run/php/php7.0-fpm-sock failed (2: No such file or directory)

The connection line should have read unix: /var/run/php/php7.0-fpm.sock.

Duh.

Zanna
  • 72,312
0

I installed from a guide which used php7.0-fpm-sock ,which I copied pasted into nginx.conf. Making the change to php7.2-fpm-sock solved the issue for me. Would have commented, but i can't do that yet.

uberdave
  • 131