Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: php-fpm restart failed - Debian 9 #1448

Open
ranrinc opened this issue Jan 17, 2018 · 35 comments
Open

Error: php-fpm restart failed - Debian 9 #1448

ranrinc opened this issue Jan 17, 2018 · 35 comments
Assignees

Comments

@ranrinc
Copy link

ranrinc commented Jan 17, 2018

Operating System (OS/VERSION):

Debian 9 (stretch)

VestaCP Version:

0.9.8

Installed Software (what you got with the installer):

Fresh install and doing update & upgrade. Also adding figlet and unzip

Steps to Reproduce:

restart php-fpm with Error: php-fpm restart failed

screen shot 2018-01-17 at 11 41 08 pm

Related Issues/Forum Threads:

Other Notes:

@abradabra
Copy link

for me on ubunti16.04 also this error.

@ranrinc
Copy link
Author

ranrinc commented Jan 19, 2018

I finally found a simple solutions for this problem.

@abradabra simply create this new ln.
ln -s /lib/systemd/system/php7.0-fpm.service /lib/systemd/system/php-fpm.service

Also to help other with 7.x problem I put my solutions here:
This work on Debian... Ubuntu will have different upgrade procedure.

To upgrade php7.0 fpm to 7.1 or 7.2 (my example is to upgrade to 7.1 fpm)

First of all do fpm upgrade (only for Debian)
Remove apt-get remove --auto-remove php7.0-fpm
apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update

apt install php7.1-apcu php7.1-bcmath php7.1-cli php7.1-curl php7.1-fpm php7.1-gd php7.1-intl php7.1-mcrypt php7.1-mbstring php7.1-mysql php7.1-soap php7.1-xml php7.1-zip

Move all your config files from your old /etc/php/7.0/fpm/pool.d/ folder to /etc/php/7.1/pool.d/
Go to cd /etc/php/7.0/ and delete all the folder accept for mods-available directory

edit /usr/local/vesta/conf/vesta.conf

Fixed this line to fpm7.1-fpm:
WEB_BACKEND='php7.1-fpm'

Created duplicate content for 7.1:
cp -r /usr/local/vesta/web/edit/server/php7.0-fpm /usr/local/vesta/web/edit/server/php7.1-fpm

Create new link for php7.1-fpm:
ln -s /lib/systemd/system/php7.1-fpm.service /lib/systemd/system/php-fpm.service

Copy web template for php7.1-fpm:
cp -r /usr/local/vesta/data/templates/web/php7.0-fpm /usr/local/vesta/data/templates/web/php7.2-fpm
cp -r /usr/local/vesta/data/templates/web/nginx/php-fpm /usr/local/vesta/data/templates/web/nginx/php7.1-fpm

REBOOT your system...

Thats it.. your vesta should now run the latest php your require to run without a problem.

I hope this help...

sources: https://forum.vestacp.com/viewtopic.php?f=11&t=15860&p=65691&hilit=PHP+FPM+pool#p65691

@Pleskan
Copy link

Pleskan commented Jan 19, 2018

@ranrinc, I've found a dirty workaround for this issue, because your approach doesn't work for me at all, unfortunately.
User would just hardcode existing version of php-fpm in /usr/local/vesta/func/domain.sh at line 87

pool=$(find -L /etc/php/7.1/ -type d \( -name "pool.d" -o -name "*fpm.d" \))

Then everything works fine.
@anton-reutov Pay your attension to this issue, please

@StoneLegion
Copy link

Having this issue too. Anyone recommend another working control panel?

@devilstars
Copy link

Same issue.
Ubuntu 16.04, php 7.1. Had to hardcode it like @Pleskan did.

@Ardakilic
Copy link

This also happened to me on Ubuntu 16.04. PHP version got bumped to PHP7.2 from PHP7.1 during updates (I guess php-fpm etc. meta packages were installed) during vesta setup, and this caused this error to appear.

Another alternative is to delete /etc/php/${unused_versions} folders (the pool.d folder actually) without need to alter the .sh code. So the find method only returns one config and it can go on its work. That's what I did anyways

@serghey-rodin Please check this. During the updates, when PHP bumps minor version, old versions' pool.d configurations are left there. It would be hard to dig this without knowledge

@Skamasle
Copy link
Collaborator

Vesta actually not suport php upgrades, so if you upgrade php manually you need modify some files to let know vesta your new php version.

So if there are any changes like php7.0 to php7.x you need fix vesta

I try check this to do a automatic fix

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

If only someone can wrote up or help me with the know how, then surely I will create a special pages which can help people to change it. To-Date laravel will require 7.1, so we need to upgrade them. So far I have been trying to edit so many files without a 100% fixed problem regarding this issue.

Again hoping someone can give some guide for this issue.

e,g:
My configuration needed at this moment for ubuntu 16.04.5, running Nginx + phpfpm, mysql or upgrade mariadb (since this wont be working nicely with vesta either)

@dpeca
Copy link
Collaborator

dpeca commented Aug 27, 2018 via email

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@dpeca the problem that I'm having is not on nginx setting nor the PHP. Its more on vesta site, once the php being replace then vestacp doesnt work correctly in most of cases error on phpfpm and sometimes kill phpfpm once and for all. Again TPL is not the problem because its simply reedit the nginx conf and you will have the webserver running without a problem. Unless you are not intent to used VestaCP after that creation is OK however if you want to create new domain etc.. then vesta will get many problem and error.

@Skamasle
Copy link
Collaborator

I debug this issue

Install vesta in debian 9

Default php version is php 7.0

I upgrade to php 7.2 and yes vesta return errors when add domains and some orthers

The issue isnt from vesta, but vesta will can define than php use to fix this, in any case we can solve it after upgrade
The solution for this issue is easy

Just move ou waste files, so:

After upgrade we get two dirs:

/etc/php/7.0/fpm/pool.d
/etc/php/7.2/fpm/pool.d

Move out /etc/php/7.0/fpm/pool.d

mv /etc/php/7.0/fpm/pool.d /root

And move out /etc/init.d/php7.0-fpm

mv /etc/init.d/php7.0-fpm /root

Now vesta works fine before upgrade to php 7.2

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@Skamasle I try this method on previous version, however recently the error did appear on my vestaCP and if I'm not mistaken you wont be able to restart PHPFPM and sometime the error appear on your first try and it disappear after the 2nd try.

@Skamasle
Copy link
Collaborator

But you clean all old php files and the error persist ?

In my case this works fine, I can add new domains witout problems and of course, you need rebuild vhosts before upgrade and fix all if not you get some error 500 in old domains.

After clean all I not get any error when add or rebuild domain.

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

Here is what I did upon installing the upgrade:
cd /etc/alternatives/
Change the link from 7.0 to 7.1
ln -sf /usr/bin/php7.1 php && ln -sf /usr/share/man/man1/php7.1.1.gz php.1.gz && ln -sf /usr/bin/php-cgi7.1 php-cgi && ln -sf /usr/share/man/man1/php-cgi7.1.1.gz php-cgi.1.gz && ln -sf /usr/lib/cgi-bin/php7.1 php-cgi-bin

Remove php-fpm7.0 and create a new link
ln -sf /usr/sbin/php-fpm7.1 php-fpm

Remove php-fpm7.0 and create a new link
ln -sf /etc/init.d/php-fpm7.1 php-fpm

Replicate /etc/php/7.0/fpm/pool.d to /etc/php/7.1/fpm/pool.d and delete 7.0

And reboot.. please help me add more changes if you think, I'm missing a step.

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@Skamasle how do you rebuild the vhost?

@Ardakilic
Copy link

Ardakilic commented Aug 27, 2018

@Skamasle that removing old versions' files and folders is exactly what I've mentioned earlier, and I believe this should be considered as bug (or at least with something as "needs optimization" I believe). Because the correct pool is there and Vesta can't select the running, correct one. Or maybe the PHP selector should be there as default.

I only apt-update and upgrade on the Ubuntu 16.04 vps I've installed for my cousin, who isn't a developer at all, and this problem occurred.

I believe the pool definition with find method and the below line should be optimized, or at least maybe another way to check fpm pool version should be a better, and permanent solution I guess.

@Skamasle
Copy link
Collaborator

I not create any symblink link in any part @ranrinc

I think this inst a bug because vesta works fine in install, vesta was broken because you upgrade php, in some cases devs say vesta not support php upgrades officially.

In any case I think is bad update procedure, you need clean old files / backup it prefered before delete

Yes @Ardakilic I think the same, vesta need improve function when search correct php-fpm version and pools.

After upgrade vesta still search for old php-fpm version and fail:

service  php7.0-fpm restart
Job for php7.0-fpm.service failed because the control process exited with error code.
See "systemctl status php7.0-fpm.service" and "journalctl -xe" for details. 

But in my case if I clean all after upgrade vesta works fine and not return any error, so isnt vesta issue in primary part because vesta finds files that should not be there

@ranrinc v-rebuild-web-domains

@Skamasle
Copy link
Collaborator

I asing this to @anton-reutov he may decide if is or not a bug, but I still think is not a bug

@Pleskan
Copy link

Pleskan commented Aug 27, 2018

@Skamasle, You will broke the package management subsystem of the Debian distribution with your approach, won't you?!

@Ardakilic
Copy link

@Pleskan every time you install phpx.y from scratch, if the configuration files are not there, they will be created, so deleting, or moving the old versions's folders and files will not affect the stability of the system. They are leftovers and aren't used anyways.

@Skamasle
Copy link
Collaborator

@Pleskan Nothing is broken, but I recomend you a backup of that files, in any case if you upgrade php as @Ardakilic say that files are just "spam" you not need that because you may never use php 7.0 again, but if you downgrade that files will be regenerated again and if not you have a backup, but you get same issue, if you are in 7.2 and you downgrade to 7.0 you will need clean php 7.2 files in same way

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@Skamasle so basically remove or backup the old pool.d and then rebuild? Any tips on which files need to be clean/delete? Will have to try this method. I'm working on a new fresh server.

@Ardakilic
Copy link

@ranrinc I've backed up and deleted /etc/php/unused_versions (I'm using 7.1 now, so I've deleted (etc/php/7.0 and /etc/php/7.2 folders) and rebuilt the hosts, and it works nicely on my case.

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@Ardakilic did you uninstall the rest of the unused PHP? purge? or autoremove?

@Ardakilic
Copy link

@ranrinc I've removed php7.2 and other extension packages, then made apt autroremove, then autoclean to remove and wipe unused dependencies, then removed the folders, and then installed php7.1-packages. After that, vesta worked fine for me.

You can also use php7.2, however I needed mcrypt extension, so I'm stuck with PHP7.1.

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@Ardakilic alright.. thanks for the info.. will try.. BTW did you do purge too?

@Ardakilic
Copy link

@ranrinc Nah, I've just removed , not purged. Maybe the purge command removes these folders but I don't know to be honest.

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

@Skamasle @Ardakilic trying to create a perfect vestacp and still failing... running v-rebuild-web-domains with error messages. So it fail to rebuild.. creating new domain get error php-fpm

What I did:
Install fresh Vesta with Nginx-fpm, mysql
remove 7.0 by typing apt-get remove --autoremove php7*
remove /etc/php/7.0/
reboot

Out of luck.. the error exist

@Ardakilic
Copy link

Ardakilic commented Aug 27, 2018

@ranrinc
Here's what I did on Ubuntu 16.04:

apt-get remove php7.2-mbstring php7.2-bcmath php7.2-cli php7.2-curl php7.2-fpm php7.2-gd php7.2-intl php7.2-mysql php7.2-soap php7.2-xml php7.2-zip php7.2-zip
apt-get install php7.1-apcu php7.1-mbstring php7.1-bcmath php7.1-cli php7.1-curl php7.1-fpm php7.1-gd php7.1-intl php7.1-mcrypt php7.1-mysql php7.1-soap php7.1-xml php7.1-zip php7.1-memcache php7.1-memcached php7.1-zip
apt-get autoremove #remove unneded dependencies
apt-get autoclean #delete old installation files
rm -rf /etc/php/7.2 #backup first on another folder!
rm -rf /etc/php/7.0 #backup first on another folder!
service php7.1-fpm restart
service php7.1-fpm status #working
nginx -t #all okay
service nginx restart

And the issue on my case was fixed.

You can see the installed packages with something like this on Debian/Ubuntu:

apt list --installed |grep -i php

@ranrinc
Copy link
Author

ranrinc commented Aug 27, 2018

well.. this is my solutions unsure whether it will work for you guys.
Additional step is to clean up /etc/init.d/ by remove php7.0-fpm and renew ln -sf /etc/init.d/php7.1-fpm php-fpm and reboot.. Now vesta seems to work.

Also need to reinstall phpmyadmin

@Skamasle
Copy link
Collaborator

I not understand why you remove php* this will remove all php versions in your server

Remove /etC/init.d/php-7.0-fpm is essential to make this work, I say that in my first response with solution

@mehargags
Copy link

Are we anywhere with the solution yet?

I had been trying for months to have multiple PHP-FPMs with Nginx only (Apache-less) VestaCP but this dreaded vestacp Error: php-fpm pool doesn't exist is a curse that I can't fix.

I run many servers with Multi PHP-FPMs (no Vesta) and would love to have VestaCP integrated solution for this.

@abradabra
Copy link

#1795

@hiephanoi
Copy link

I finally found a simple solutions for this problem.

@abradabra simply create this new ln.
ln -s /lib/systemd/system/php7.0-fpm.service /lib/systemd/system/php-fpm.service

Also to help other with 7.x problem I put my solutions here:
This work on Debian... Ubuntu will have different upgrade procedure.

To upgrade php7.0 fpm to 7.1 or 7.2 (my example is to upgrade to 7.1 fpm)

First of all do fpm upgrade (only for Debian)
Remove apt-get remove --auto-remove php7.0-fpm
apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update

apt install php7.1-apcu php7.1-bcmath php7.1-cli php7.1-curl php7.1-fpm php7.1-gd php7.1-intl php7.1-mcrypt php7.1-mbstring php7.1-mysql php7.1-soap php7.1-xml php7.1-zip

Move all your config files from your old /etc/php/7.0/fpm/pool.d/ folder to /etc/php/7.1/pool.d/
Go to cd /etc/php/7.0/ and delete all the folder accept for mods-available directory

edit /usr/local/vesta/conf/vesta.conf

Fixed this line to fpm7.1-fpm:
WEB_BACKEND='php7.1-fpm'

Created duplicate content for 7.1:
cp -r /usr/local/vesta/web/edit/server/php7.0-fpm /usr/local/vesta/web/edit/server/php7.1-fpm

Create new link for php7.1-fpm:
ln -s /lib/systemd/system/php7.1-fpm.service /lib/systemd/system/php-fpm.service

Copy web template for php7.1-fpm:
cp -r /usr/local/vesta/data/templates/web/php7.0-fpm /usr/local/vesta/data/templates/web/php7.2-fpm
cp -r /usr/local/vesta/data/templates/web/nginx/php-fpm /usr/local/vesta/data/templates/web/nginx/php7.1-fpm

REBOOT your system...

Thats it.. your vesta should now run the latest php your require to run without a problem.

I hope this help...

sources: https://forum.vestacp.com/viewtopic.php?f=11&t=15860&p=65691&hilit=PHP+FPM+pool#p65691

Thank U

@ranrinc, I've found a dirty workaround for this issue, because your approach doesn't work for me at all, unfortunately.
User would just hardcode existing version of php-fpm in /usr/local/vesta/func/domain.sh at line 87

pool=$(find -L /etc/php/7.1/ -type d \( -name "pool.d" -o -name "*fpm.d" \))

Then everything works fine.
@anton-reutov Pay your attension to this issue, please

Thank U so much ! i was do success

@jams008
Copy link

jams008 commented May 19, 2022

@ranrinc, I've found a dirty workaround for this issue, because your approach doesn't work for me at all, unfortunately. User would just hardcode existing version of php-fpm in /usr/local/vesta/func/domain.sh at line 87

pool=$(find -L /etc/php/7.1/ -type d \( -name "pool.d" -o -name "*fpm.d" \))

Then everything works fine. @anton-reutov Pay your attension to this issue, please

Work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests