Vadim Timoshenko2018-11-14 18:07:06
Vadim Timoshenko, 2018-11-14 18:07:06

502 NGINX error - how to run PHP-FPM?

Installed VDS on Ubuntu 18.04. I set up a bunch of Nginx + PHP-FPM + MySQL.
I get a 502 Bad Gateway error.
PHP-FPM service does not start even though it was installed.

PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

PHP-FPM says installed:
sudo apt-get install php-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-fpm is already the newest version (1:7.2+60ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I'm trying to run:
sudo service php-fpm start
Failed to start php-fpm.service: Unit php-fpm.service not found.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
xtress, 2018-11-14

But the service in Ubuntu is not called by the package name :)
Try `ls -la /etc/init.d/php*` - the output of this command will give a hint about the name of the service
In your case, it will most likely be started either by sudo service php7-fpm restart or by sudo service php7.2-fpm restart
Well, yes, 502 is not the fact that it is connected with an unlaunched fpm. You need to look at the nginx logs, there may be a hint

Alexey, 2018-12-25

or display a list of all services and find the one you need:
specifically in my case = php7.0-fpm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question