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

support for using the phpbrew-fpm.service with multiple php versions #806

Open
bjo81 opened this issue Nov 2, 2016 · 3 comments
Open

support for using the phpbrew-fpm.service with multiple php versions #806

bjo81 opened this issue Nov 2, 2016 · 3 comments

Comments

@bjo81
Copy link

bjo81 commented Nov 2, 2016

If somebody wants to use php-fpm services with different php-versions, he has to modifiy the phpbrew-fpm.service for each version.

Other services like e.g. openvpn can get a parameter to its servicefile on the activation:

[Unit]
Description=OpenVPN connection to %I
After=syslog.target network.target network-online.target
Documentation=man:openvpn(8)

[Service]
PrivateTmp=true
Type=forking
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config %i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid --status-version 2
PIDFile=/run/openvpn@%i.pid

[Install]
WantedBy=multi-user.target

Adopted to phpbrew-fpm, someone could use systemctl enable phpbrew-fpm@5.6.27 for enabling/starting 5.6.27.

@tdgroot
Copy link

tdgroot commented Dec 17, 2016

As a workaround I just created my own service files and enabled them myself. It's just a bit more work when updating php versions but it gets the job done!

@evolbug
Copy link

evolbug commented Nov 6, 2018

This is quite an old ticket, but I wanted to add this as it's not implemented yet.
To create this kind of service I modified the existing phpbrew service:

Filename: phpbrew-fpm@.service (the @ is important, it indicates parametrised service)

[Unit]
Description=The PHPBrew FastCGI Process Manager
After=network.target

[Service]
Type=notify
PIDFile=/opt/phpbrew/php/%I/var/run/php-fpm.pid
ExecStart=/opt/phpbrew/php/%I/sbin/php-fpm --nodaemonize --fpm-config /opt/phpbrew/php/%I/etc/php-fpm.conf --pid /opt/phpbrew/php/%I/var/run/php-fpm.pid
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

To use: systemctl <cmd> phpbrew-fpm@<version>
e.g. systemctl start phpbrew-fpm@7.2

Works so far on my machine and you can also start multiple services at once, it will spawn them separately.

@netandreus
Copy link

netandreus commented Feb 13, 2019

Here is my version. For example, I installed phpbrew to user 'admin'.
File should be placed in /lib/systemd/system/phpbrew-fpm@.service

[Unit]
Description=The PHPBrew FastCGI Process Manager
After=network.target

[Service]
Type=simple
PIDFile=/home/admin/.phpbrew/php/php-%I/var/run/php-fpm.pid
ExecStart=/home/admin/.phpbrew/php/php-%I/sbin/php-fpm --nodaemonize --fpm-config /home/admin/.phpbrew/php/php-%I/etc/php-fpm.conf --pid /home/admin/.phpbrew/php/php-%I/var/run/php-fpm.pid
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

It's important to set Type=simple to avoid freeze, when service started. To reload file run:
sytemctl daemon-reload

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

5 participants