Control Web Panel

WebPanel => PHP => Topic started by: dbmtr on January 03, 2022, 07:24:37 PM

Title: Php mail havent permission to phpmail.log
Post by: dbmtr on January 03, 2022, 07:24:37 PM
Hi All,

have following error "mail(/usr/local/apache/logs/phpmail.log): failed to open stream: Read-only file system"

should I change the log file permissions or should it happen automatically during the php-fpm build?

Best regards.
Title: Re: Php mail havent permission to phpmail.log
Post by: roade on March 08, 2022, 12:37:08 PM
Having the same problem since I switched to php-fpm.
How to fix this?
Title: Re: Php mail havent permission to phpmail.log
Post by: iraqiboy90 on March 08, 2022, 12:38:33 PM
Permission for this file on my system is:
-rw-rw-rw-. root root
Title: Re: Php mail havent permission to phpmail.log
Post by: roade on March 09, 2022, 08:32:17 AM
They already are - 777. 0 0
Title: Re: Php mail havent permission to phpmail.log
Post by: rcschaff on March 09, 2022, 09:50:27 PM
As root, do:

touch /usr/local/apache/logs/phpmail.log

See if you get an error
Title: Re: Php mail havent permission to phpmail.log
Post by: rcschaff on March 10, 2022, 07:07:54 AM
check the file /lib/systemd/system/php-fpm[version].service

Look for the line:  ProtectSystem=

Make sure it is set to false.

run the command " systemctl daemon-reload ", then restart php-fpm[version]
Title: Re: Php mail havent permission to phpmail.log
Post by: roade on March 10, 2022, 11:01:44 AM
That second suggestion seems to be a possible solution because read-only file system cannot be worked around with Unix permissions (chmod).
But is that a safe solution? If not, what are other options?
Title: Re: Php mail havent permission to phpmail.log
Post by: rcschaff on March 10, 2022, 12:12:29 PM
It's either that, or change the location of the phpmail.log to /var/log/php/phpmail.log

Either option would be fine, but the second would be most secure.