• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Unable to start service: Unable to manage service by phpinimng

pulsarinformatique

New Pleskian
Server operating system version
Debian 11.7
Plesk version and microupdate number
18.0.52 update 3
HI
Following https://support.plesk.com/hc/en-us/articles/12377508651415 I'm trying to add PHP 7.1 on a Plesk Obsidian 18.0.52 update3 (Debian 11.7)

I downloaded https://www.php.net/distributions/php-7.1.24.tar.bz2 and passed the first stage of https://support.plesk.com/hc/en-us/articles/12377508651415 without any issue
On stage 2 I ran the commands :

plesk bin php_handler --add -displayname 7.1.24 -path /usr/local/php-7.1.24/bin/php-cgi -phpini /usr/local/lib/php.ini -type fastcgi -id 7.1.24-custom -clipath /usr/local/php-7.1.24/bin/php

and

plesk bin php_handler --add -displayname 7.1.24 -path /usr/local/php-7.1.24/sbin/php-fpm -phpini /usr/local/lib/php.in -type fpm -id 7.1.24-phpfpm -clipath /usr/local/php-7.1.24/bin/php -service php71fpm -poold /usr/local/php-7.1.24/etc/php-fpm.d

Then I could set PHP 7.1.24 to a plesk domain but from /admin/services/list when I try to run the PHP-FPM 7.1.24 service I get :

Unable to start service: Unable to manage service by phpinimng ('start', 'php71fpm'): Failed to start php71fpm.service: Unit php71fpm.service not found. Failed to start php71fpm service

What did I forget to avoid this error please?

thanks

cyril
 
I thought I simply created this service when I ran

plesk bin php_handler --add -displayname 7.1.24 -path /usr/local/php-7.1.24/sbin/php-fpm -phpini /usr/local/lib/php.ini -type fpm -id 7.1.24-phpfpm -clipath /usr/local/php-7.1.24/bin/php -service php71fpm -poold /usr/local/php-7.1.24/etc/php-fpm.d
 
As a matter of fact the php71fpm service hasn't been created with the "plesk bin php_handler --add" command.
Does it mean I should use an EXISTING service, but in this case which one please?

thanks
 
Indeed, the service is not created by the "handler" set-up. That only tells Plesk where to look for PHP, how to name it etc., but the PHP version that you wish to use has to be operational before you tell Plesk about it. So the issue seems to be with the installation of the custom PHP itself. You'll need to go back and check the installation steps. Once you have PHP installed you should be able to use it on the command line, e.g.
# <path/file of my custom php> -v
should return the version ID and there should also be configuration files like php.ini and php-fpm.conf for the custom version. A custom PHP version can exist on a server without Plesk knowing about it. The plesk bin php_handler only exists to link Plesk controls with that PHP version.
 
In /usr/local/php-7.1.24/bin if I run ./php -v I get :

PHP 7.1.24 (cli) (built: May 18 2023 14:07:44) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

and there is the php-config file in /usr/local/php-7.1.24/bin but no php.ini

Following https://support.plesk.com/hc/en-us/articles/12377508651415 I ran from the archive I retrived

cp php.ini-development /usr/local/lib/php.ini

so that the php.ini file is /usr/local/lib/php.ini

So what is this MISSING SERVICE ?

thanks
 
I've followed the same instructions on a Debian 11 test machine and could install PHP 7.1 without issues, including PHP-FPM. The only thing I noticed is that your binary path mismatches and your version is 7.1.24 while mine is 7.1.32. I used this command to register the handler:

plesk bin php_handler --add -displayname 7.1.32 -path /usr/local/php71/sbin/php-fpm -phpini /usr/local/lib/php.in -type fpm -id 71-phpfpm -clipath /usr/local/php71/bin/php -service php71fpm -poold /usr/local/php-71/etc/php-fpm.d

Please verify that you indeed have your binary in /usr/local/php-7.1.24/sbin/php-fpm as you used that path, and not in /usr/local/php-71/sbin/php-fpm. Else check that in /usr/local/php-7.1.24/sbin/php-fpm the binary is present and run the handler registration again.
 
yes on /admin/php-handler/list/ I too can see PHP FPM 7.1.24 BUT :

1- in /admin/services/list does the service started ?

2- if you try to run the domain on this php 7.1 does it work ?

2- and if you go to /cp/php/extensions/id/7.1.24-phpfpm (change the version) do you have the extensions displayed ? my page is empty

thanks
 
and of course when in try to start the php FPM 7.1.4 service from /admin/services/list I still get the error:

Unable to start service: Unable to manage service by phpinimng ('start', 'php71fpm'): Failed to start php71fpm.service: Unit php71fpm.service not found. Failed to start php71fpm service
 
You cannot start the service unless at least one website is using it. Once a website is using it, the service should automatically start. As shown above in my example I configured a website with it (screenshot shows it). Have you also used it in a website?
 
yes naturally but it just doesn't work
your screenshots don't show it is working either.

Can you please answer these 3 questions ?

1- in /admin/services/list is the service started ?

2- if you try to run the domain on this php 7.1 does it really work ?

2- and if you go to /cp/php/extensions/id/7.1.24-phpfpm (change the version) do you have the extensions displayed ? my page is empty

thanks
 
and FYI I redid the whole process with the 7.1.32 as you did :

cd ~
wget https://www.php.net/distributions/php-7.1.32.tar.bz2
tar -xvf php-7.1.32.tar.bz2
cd php-7.1.32
./configure --prefix /usr/local/php-7.1.32 --enable-fpm --with-fpm-group=www-data
make
make install
cp php.ini-development /usr/local/lib/php.ini

plesk bin php_handler --add -displayname 7.1.32 -path /usr/local/php-7.1.32/sbin/php-fpm -phpini /usr/local/lib/php.ini -type fpm -id 7134-phpfpm -clipath /usr/local/php-7.1.32/bin/php -service php7134fpm -poold /usr/local/php-7.1.32/etc/php-fpm.d

cd /usr/local/php-7.1.32/etc
cp php-fpm.conf.default php-fpm.conf

I attached a website to the 7.1.32
went to /admin/services/list and tried to start the PHP-FPM 7.1.32 service and got :
Unable to start service: Unable to manage service by phpinimng ('start', 'php7134fpm'): Failed to start php7134fpm.service: Unit php7134fpm.service not found. Failed to start php7134fpm service
 
Thank you for being persistent. I have re-created this again and was able to reproduce your situation. Previously I did not check whether a website can actually use that PHP, but stopped checking when I saw that Plesk recognized the version and did not throw any errors there.

I have now tried to figure out why the service cannot be started. It is missing from /lib/systemd/system while Plesk PHP-FPM versions are present at that location even if they are not in use. What I was not able to solve is why that part is missing. I tried to trick the test system into starting that service by copying the systemd files and editing their content to match the PHP 7.1 set-up. Plesk then recognized the service, but obviously the service could not be started but times out. The same is happening on the command line when not using Plesk. So very likely it is a set-up issue of that PHP.

The syslog does not show anything relevant but the start attempt and a timeout.

I could not find any issue with the configuration settings in Plesk. Plesk recognizes the configuration files, it makes the PHP version selectable etc., it also seems to try to start the service, just that the service we tell it in the handler command is not there. I did install and remove handlers several times, with and without proper .ini file, with and without .conf files. I also made sure that the required FPM conf files exist for the domains used for tests. But still no success.

The CGI variant works without issues. PHP 7.1 CGI works.

My preliminary conclusion is that in the installation process something might be missing for the FastCGI manager. My knowledge does not reach far enough to go beyond this point. The question is if it works at all or if it might be an incompatibility with that Debian. Not sure about that.
 
I got a solution thanks to some extra advice form a colleague who pointed out that we should check that the PID file in the unit files must match the PID file in the php-fpm configuration file. Please hold, I'll formulate what needs to be done here soon.
 
Here's how to get it to work.

Previous installation steps were correct, but we overlooked the hint in section 2.2 of instructions that a unit file needs to be created manually.

1) Become root, e.g. su. All following commands need to be done as root.

2) Change to /lib/systemd/system

3) Create a file named <servicename>.service, e.g php71fpm.service. The servicename must match what you have entered as a servicename in the Plesk handler, so that Plesk knows which service to start. If you named your service php7134fpm for Plesk, the filename would need to be php7134.fpm
Into that file put this content:
Code:
[Unit]
Description=The PHP 7.1 FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/run/php71fpm.pid
EnvironmentFile=-/etc/default/php71fpm
ExecStart=/usr/local/php71/sbin/php-fpm --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
PrivateDevices=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictNamespaces=true
[Install]
WantedBy=multi-user.target

4) Create a directory <servicename>.service.d and descend into it, e.g.
Code:
mkdir php71fpm.service.d
cd php71fpm.service.d

5) In <servicename>.service.de create two files:
5a) respawn.conf with this content:
Code:
[Service]
Restart=on-failure
RestartSec=5
and limit_nofile.conf with this content:
Code:
[Service]
LimitNOFILE=8192

6) In your PHP-FPM configuration file directory (probably /usr/local/php71/etc) edit the file php-fpm.conf and make sure that in the section "[Global]" the line
Code:
pid = run/php71fpm.pid
shows the correct .pid file. This must be the same that is set in the <servicename>.service file (PIDFile=/run/php71fpm.pid).

Afterwards you should be able to select the handler in Plesk, apply it and the service will start.
 
Thanks Peter for getting deeper in the issue.
With your help I was able to start the service but

1- if you try to run the domain on this php 7.1 does it really work ? I mean I created a dummy myphp71.com domain, assigned PHP 7.1.32 FPM to it and try to load http://myphp71.com in a browser (of course I set my local hosts file so that the website can be found) I got a 503 / Service Temporarily Unavailable error

2- and if you go to /cp/php/extensions/id/7132-phpfpm (change the version) do you have the extensions displayed ? the EXTENSIONS tab is empty. The PHP.ini tab is correctly set.

thanks
 
CORRECTION : the 7.1 site does work BUT if you go to /cp/php/extensions/id/7132-phpfpm (change the version if needed) do you have the extensions displayed ? My EXTENSIONS tab is empty. The PHP.ini tab is correctly set though

thanks

cyril
 
1 - if you try to run the domain on this php 7.1 does it really work ? I mean I created a dummy myphp71.com domain, assigned PHP 7.1.32 FPM to it and try to load http://myphp71.com in a browser (of course I set my local hosts file so that the website can be found) I got a 503 / Service Temporarily Unavailable error
I am sure it works. I've tested it by running PHP on the site. If you get a 503, it can be for various reasons, including a still not perfect installation. As a rule of thumb: When you click the phpinfo() link to the right of the selector and it displays the page, it will also work for the website itself.

2- and if you go to /cp/php/extensions/id/7132-phpfpm (change the version) do you have the extensions displayed ? the EXTENSIONS tab is empty. The PHP.ini tab is correctly set.
I do not know whether it should display anything there for custom PHP. The PHP version is not maintained by Plesk, so I guess there is nothing to display. At the moment I cannot test it, because my test installation from above would need to be rebuild once again which I cannot do at the moment.
 
Back
Top