php-fpm-7.4.0 can't access devices

A category for tips and tricks or off-topic things
jeanmarc
Posts: 1917
Joined: Thu Aug 29, 2013 7:16 am

php-fpm-7.4.0 can't access devices

Post by jeanmarc » Sun Dec 15, 2019 2:41 pm

Hello,
Just to warn that i am unable to get php-fpm-7.4.0 working with mN & 123s. It can't access any devices :cry:
I have submit a bug, i hope they find a solution.
Also, i have being bugged by this one.

Meanwhile i've downgraded.. If you find a trick, let us now !

jeanmarc
Posts: 1917
Joined: Thu Aug 29, 2013 7:16 am

Re: php-fpm-7.4.0 can't access devices

Post by jeanmarc » Wed Dec 18, 2019 11:31 am

:idea: i finally get it ;)

Due to the hardening options for systemd service units, you need to set PrivateDevices=false (In Arch, might be =no) in php-fpm.service.

Do so with systemctl edit --full php-fpm.service
Then systemctl daemon-reload & systemctl restart php-fpm

Now php-fpm have access to /dev but it can't write LCK files for com. apps. You also need to chmod 777 /var/lock/.

I shall rewrite "Help and debugger" and well as guide

jeanmarc
Posts: 1917
Joined: Thu Aug 29, 2013 7:16 am

Re: php-fpm-7.4.0 can't access devices

Post by jeanmarc » Wed Dec 18, 2019 5:36 pm

Well, judging from various point of views, it is not wise to chmod /var/lock/
If php can't invoke ttyUSB anymore i'am in trouble :think:

Mostie
Posts: 9
Joined: Sat Oct 31, 2015 5:34 pm

Re: php-fpm-7.4.0 can't access devices

Post by Mostie » Sat Dec 21, 2019 12:14 pm

updated my logger 2 weeks ago and I cant get it to work again, PHP was updated to version 7.4, I tried to re-install 7.3.8 but it does not work now and just shuts down, what version did you go back to?

Mostie
Posts: 9
Joined: Sat Oct 31, 2015 5:34 pm

Re: php-fpm-7.4.0 can't access devices

Post by Mostie » Sat Dec 21, 2019 12:21 pm

#* 21/12/2019 11:03:03 Starting 123Solar debug (1334)

PHP Notice: Undefined offset: 1 in /srv/http/123solar/scripts/123solar.php on line 223
PHP Notice: Undefined offset: 27 in /srv/http/123solar/scripts/123solar.php on line 225
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 50331656 bytes) in /srv/http/123solar/scripts/123solar.php on line 295

and I got this error, Aurora still works from the command line, I may have to do a fresh install with an earier version of PHP

Mostie
Posts: 9
Joined: Sat Oct 31, 2015 5:34 pm

Re: php-fpm-7.4.0 can't access devices

Post by Mostie » Sat Dec 21, 2019 4:42 pm

its working now, although i'm not sure what I did to fix it ;)

jeanmarc
Posts: 1917
Joined: Thu Aug 29, 2013 7:16 am

Re: php-fpm-7.4.0 can't access devices

Post by jeanmarc » Sat Dec 21, 2019 9:10 pm

I got all working with lastest PHP/PHP-FPM 7.4.1. Just need few more checks but so far the solution is :

Set to PrivateDevices=false in php-fpm.service and CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_CHOWN
systemctl edit --full php-fpm.service
systemctl daemon-reload & systemctl restart php-fpm

And if 'http' can't write in /var/lock/ (latest Arch have it set 755 by default)
set permissions to 777 via
cp /usr/lib/tmpfiles.d/legacy.conf /etc/tmpfiles.d/
nano /etc/tmpfiles.d/legacy.conf
reboot

jeanmarc
Posts: 1917
Joined: Thu Aug 29, 2013 7:16 am

Re: php-fpm-7.4.0 can't access devices

Post by jeanmarc » Sun Dec 22, 2019 9:34 am

So far so good 8-)
If you have app that need to write port lock as http user (like aurora or sdm), you may change it as it.

Mostie
Posts: 9
Joined: Sat Oct 31, 2015 5:34 pm

Re: php-fpm-7.4.0 can't access devices

Post by Mostie » Sun Dec 22, 2019 7:31 pm

so i had to do a fresh install :(

where do i change this ? CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_CHOWN

jeanmarc
Posts: 1917
Joined: Thu Aug 29, 2013 7:16 am

Re: php-fpm-7.4.0 can't access devices

Post by jeanmarc » Mon Dec 23, 2019 6:59 am

Also in php-fpm.service. it apply only for php 7.4

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest