failed to start php fpm service unit php fpm service not found
Drupal Русскоязычное сообщество
поставил на Debian 8 сервер Nginx + PHP7 + PHP7.0-FPM, статика работает, а обращение к php-файлам даёт ошибку 502.
почитав /var/log/nginx/site.com.error.log я понял что ошибка с сокетом:
2016 / 08 / 19 05:05: 32 [ error ] 1392 #1392: *15 connect() to unix:/var/run/php7.0-fpm.sock failed (111: Connection refused) while connecting to upstream, client: 88.88.88.88, server: site.com, request: «GET /index.php HTTP/1.1», upstream: «fastcgi://unix:/var/run/php7.0-fpm.sock:», host: «site.com»
но в интернете пояснили, что возможно не запущен процесс обработки запросов, то есть php7.0-fpm, я проверил так и убедился что пхп-фпм не запускается:
Лучший ответ
Комментарии
может поиск процесса неправильный. вот так что-то видно
вот код /etc/init.d/php7-fpm
# Author: Ondrej Sury
# Adapted to php7-fpm by @B..joh..en
# Load the VERBOSE setting and other rcS variables
. / lib / init / vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. / lib / lsb / init-functions
# Don’t run if we are running upstart
if init_is_upstart; then
exit 1
fi
#
# Function to check the correctness of the config file
#
do_check ( )
<
/ usr / local / lib / php7-fpm-checkconf || return 1
return 0
>
pool настраивали?
По правде говоря у меня с сокетом тоже траблы были и было лень разбираться и запускал через tcp
В бложике есть устаревший материал, но настройки fpm и пула там в принципе актуальны.
pool не упоминался в мануалах, я не знаю что это такое
вот как настроена связка Nginx + php7.0-fpm
pid = / var / run / php7-fpm.pid
error_log = / var / log / php7-fpm. log
include = / usr / local / php7 / etc / php-fpm.d /*.conf
# cat /usr/local/php7/etc/php-fpm.d/www.conf
[www]
user = www-data
group = www-data
listen = /var/run/php7.0-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
вот конфиг хоста site.com
access_log / var / log / nginx / site.com.access. log main;
error_log / var / log / nginx / site.com.error. log ;
/ \. <
deny all;
access_log off;
log_not_found off;
>
>
в этом файле я эту строку правил и еще по-моему одну из эти раскомментировал:
user = www-data
group = www-data
ну теперь я исправил слушать сокет:
listen = /var/run/php7.0-fpm.sock
рестарт сервиса
service php7-fpm restart
ПРОБЛЕМ НЕ РЕШИЛАСЬ
снёс php7 со всеми зависимостями, и php тоже снес так
apt-get purge php7
apt-get remove php*
и поставил php5-fpm одной строкой из одного мануала на моем сайте.
подкорректировал /etc/nginx/fastcgi_params (изменив адрес сокета на /var/run/php5-fpm.sock),
и сайт нормально стал работать
спасибо за ссылку. пытаюсь заново на новой впсине.
вообще меня смущала и сейчас опять появляется следующая проблема:
после запуска команды автора http://kubanga.ru/obnovlenie-php-56-do-php-7-v-debian-jessie-na-vds-digi.
«Устанавливаем php7
apt-get install php7.0-fpm php7.0-gd php7.0-pgsql php7.0-apcu php7.0-curl»
все ставится но в конце вот что сообщвет:
но ввсе вроде есть, просто вопрос сконфигурировано ли?
что тут не так? пользователя я создал. группу ему дал
в смысле в одну? я проверял, скопированные строки вставлял в sublime и с пробелами было все нормально.
в debian 7 был apc, а в debian8 apcu
в конфигурации apc
Когда с седьмого дебиана на восьмой переходил было неожиданностью)
после установки сервера по неполной инструкции, я увидел ошибку
The website encountered an unexpected error. Please try again later.
просмотрев логи ошибок nginx (файл ошибок сайта не был прописан в хосте, поэтому именно нгиникс):
я стал гуглить и понял, что надо доставить пакеты работы php7.0-fpm с базами mysql:
после установки модулей для работы с бд, я опять увидел то же сообщение и в ошибках нгиникс были новые ошибки:
PHP message: Error: Class ‘DOMDocument’ not found in core / lib / Drupal / Component / Utility / Html.php on line 284
это предполагает установку php7.0-xml как я понял
после всех этих действий мой сайт открылся на Debian 8 Nginx + PHP7.0-FPM + mysql
спасибо михаил.спейс за рабочий мануал
Я в с соседней теме писал про php7.0-xml, тоже была такая беда.
php-fpm cannot start on CentOS 7 #151
Comments
roblambell commented Sep 26, 2016 •
/lib/init/vars.sh is included in fpm-init.j2 but does not exist on CentOS Linux 7 (Core).
Current pre_tasks to get this working
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
geerlingguy commented Sep 26, 2016
Hmm. the Travis build begs to differ: https://travis-ci.org/geerlingguy/ansible-role-php (see first test under centos7).
I’m running a few CentOS 7 servers using FPM with either Nginx or Apache (also, Drupal VM is set to use FPM by default) without any issues. I start from the CentOS minimal x86_46 ISO in all cases. maybe the environment your using doesn’t have the same layout as a minimal server install?
roblambell commented Sep 26, 2016
I’ve created a new install from the ISO, and a docker centos:7 image container, getting the same result. /lib/init does not exist on either for me.
geerlingguy commented Sep 26, 2016
roblambell commented Sep 27, 2016
Unfortunately not part of the initscripts package.
I’m installing php from source and the task which copies the template is not covered by those tests, it’s in install-from-source.yml: «Ensure php-fpm init script is installed.»
geerlingguy commented Nov 21, 2016
The package installer should install the php-fpm init script/unit file :/
2autunni commented Dec 9, 2016
Same problem, solved adding
to variable «php_packages»
jyaworski commented Feb 16, 2018
@geerlingguy I’ve reproduced this on Amazon Linux 2. I’m compiling from source with systemd enabled in configure.
jyaworski commented Feb 16, 2018
When you compile with systemd, a unit file is generated per here:
Instead of a template, when compiling from source it may be better to copy the init file or service file from here.
jserpapinto commented Jul 23, 2018
Got this error too in a Vagrant machine with your image: geerlingguy/centos7
I’m also adding epel repo from your other role.
phpMyAdmin
Ну а php5-fpm у тебя стоит?
Ну логи очевидно пишут обратное. Либо ты его поставил в не дефолт.
Покажите вывод файла /etc/php/fpm-php
Значит у php-fpm нет прав для создания файла. Иначе он бы его создал. Для этого есть опция
Ой блин, сори. Прав 660, конечно же более чем достаточно. За 666 меня сейчас предадут здесь анафеме 🙂
А там что? Пользователя и группу то я не вижу. Смотрите что указано в user и group в подключаемых конфигах и делайте так
Нашел его на SO. Пробуйте, все должно работать. В ответе также прилагается ссылка на этот баг. Серьезная дыра как для 2014 была 🙂 http://stackoverflow.com/questions/23443398/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied/23487409#23487409
Так, стоп. А до этого какой конфиг вы мне скидывали?! Вы же изначально хотели через сокет
Failed to restart php5-fpm.service: Unit php5-fpm.service failed to load: No such file or directory.
Не страшно, я если честно нуб в centOS. Попробуйте service php-fpm restart просто, без указания версии (5).
И с этим тоже не ясно. На listen.* вешаете www-data, а юзаете от юзера apache, вас это не смущает? 🙂
До этого я показывал php-fpm.conf.
А в нем включение:
А, ну вот удалите/закомментируйте все user/group/listen/listen.owner/listen.group/listen.mode параметры из этих трех файлов. После этого создайте файл назовите_как_хотите.conf в /etc/php-fpm.d/ с содержимым из моего последнего ответа, и рестарните php-fpm. Вот возможные варианты рестарта 🙂
Пробую запустить от пользователя nginx
Feb 24 22:22:20 localhost.localnet php-fpm[10759]: [24-Feb-2016 22:22:20] ERROR: [/etc/php-fpm.d/web.conf:1] unknown entry ‘user’
Да, сори я блок второпях забыл в начале поставить 🙂 Вот целиком
Только лучше блок по имени пользователя назовите, чтобы не путаться потом, если еще будете создавать. То есть
Feb 24 22:41:05 localhost.localnet php-fpm[10886]: [24-Feb-2016 22:41:05] ALERT: [pool web] the process manager is missing (static, dynamic or ondemand)
А в чем сообствено разница?
Выбор того, как менеджер процессов будет контролировать создание дочерних процессов. Возможные значения: static, ondemand, dynamic. Этот параметр является обязательным.
Может свяжимся по jabber/skype/vk/telegramm?
Извините, ничем из данного списка не пользуюсь. Моя почта (мой_ник@gmail.com). Да и помогаю только здесь, на форуме 🙂 Сделайте все по списку из предпоследнего моего комментария, и будет вам счастье 🙂
Вроде все сделал, но:
Feb 24 23:07:18 localhost.localnet php-fpm[11228]: [24-Feb-2016 23:07:18] ALERT: [pool www] user has not been defined
Эх. Блок www где находится? Правильно, в вашем файле etc/php-fpm.d/ww_w.conf, что вы уже скидывали. Там у вас стоит пользователь apache, все верно? Что это за пользователь apache и почему вы вообще от него запускаете? Ему позволено выполнять root-действия от sudo? Если user has not been defined, то либо пользователя нет вообще, либо он не в root-группе. Одно из двух. Почему вы не стартуете от стандартного пользователя www-data? Все равно у вас мастер-процесс будет от root’а, а все дочерние от указанного пользователя. Стартуйте от www-data (группа та же), тем паче что у вас и nginx от него пашет
https://gist.github.com/KennyDalglish/74c44a4b3e7c34e0cf28
Стартуйте от www-data (группа та же), тем паче что у вас и nginx от него пашет
Failed to start The PHP 7.0 FastCGI Process Manager
i have problem with php7 when i run this command i get the error
sudo systemctl status php7.0-fpm.service
4 Answers 4
You probably must do this
In my case, previous php7.2-fpm configuration cause problem:
so i deleted directory, and reinstall solve the problem.
(if this is not first time, then backup below php fpm configuration)
I had this issue on Fedora 33. I simply uninstalled php and httpd
This solved my issue
I had upgraded the PHP version form 7.1 to 7.3. I had to kill the running PHP fpm process of 7.1 first before initiating 7.3
Get the process id from the following command:
Not the answer you’re looking for? Browse other questions tagged php ubuntu or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.9.16.40232
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Try to start php-fpm7.0 #392
Comments
makz27 commented Dec 9, 2016
Since the 1.0.0 image, when i provision the vm the script try to start php-fpm7.0 but it doesn’t exist because now it’s php-fpm7.1
==> homstead: Failed to restart php7.0-fpm.service: Unit php7.0-fpm.service not found.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
makz27 commented Dec 9, 2016
I forced the homestead update to 4.0.0 it worked, thank you.
svpernova09 commented Dec 9, 2016
If you’re using Homestead per project or have homestead in a global composer.json You’ll want to make sure you have it set to «^4.0»
mtpultz commented Dec 14, 2016 •
@svpernova09 apparently if we aren’t quite ready to adopt PHP 7.1 we can use v3.1.0 of laravel/homestead, but this seems to cause the same kind of error:
Do you have any suggestions? I’ve followed that post’s instructions for a per project installation.
svpernova09 commented Dec 14, 2016
You’ll need to lock the version of the box down to a previous version by adding
mtpultz commented Dec 14, 2016 •
svpernova09 commented Dec 14, 2016
Box 1.0.0 & 1.0.1 are both PHP 7.1. 0.6.0 Was the last version with PHP 7.0.
giovannipds commented Dec 20, 2016
dPhantum commented Nov 9, 2017
I tried above and nothing worked and was getting error:
homestead-7: Failed to restart php7.2-fpm.service: Unit php7.2-fpm.service not found.
After a little digging..
There is an issue in the [homestead-install]/scripts/homestead.rb script that does not validate if the script exists prior to adding it to the execution stack. It blindly adds it.
If you edit that file and remove for the version of php that does not exist for you.
Verfiy in linux if not installed by:
and you don’t see that version installed it is complaining about (i.e. php7.2-fpm)
Then if you edit the file scripts/homestead.rb and remove the references, it will proceed and complete the data creation scripts, which is where it fails before running them.
You see the blind assignment for example
line 231:
s.inline = «sudo service nginx restart; sudo service php5.6-fpm restart; sudo service php7.0-fpm restart; sudo service php7.1-fpm restart; sudo service php7.2-fpm restart;»
In my case it is 7.2, so I removed it to look like:
s.inline = «sudo service nginx restart; sudo service php5.6-fpm restart; sudo service php7.0-fpm restart; sudo service php7.1-fpm restart»
line 330:
s.inline = «service php5.6-fpm restart; service php7.0-fpm restart; service php7.1-fpm restart;service php7.2-fpm restart;»
to look like:
s.inline = «service php5.6-fpm restart; service php7.0-fpm restart; service php7.1-fpm restart;»
It will not die for the false reference and you should be able to continue your work, without wasting hours/days trying to look for a solution, when perhaps in a work panic.