Author Topic: Php mail havent permission to phpmail.log  (Read 4703 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Php mail havent permission to phpmail.log
« 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.

Offline
*
Re: Php mail havent permission to phpmail.log
« Reply #1 on: March 08, 2022, 12:37:08 PM »
Having the same problem since I switched to php-fpm.
How to fix this?

Offline
***
Re: Php mail havent permission to phpmail.log
« Reply #2 on: March 08, 2022, 12:38:33 PM »
Permission for this file on my system is:
-rw-rw-rw-. root root

Offline
*
Re: Php mail havent permission to phpmail.log
« Reply #3 on: March 09, 2022, 08:32:17 AM »
They already are - 777. 0 0

Offline
****
Re: Php mail havent permission to phpmail.log
« Reply #4 on: March 09, 2022, 09:50:27 PM »
As root, do:

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

See if you get an error
Google Hangouts:  rcschaff82@gmail.com

Offline
****
Re: Php mail havent permission to phpmail.log
« Reply #5 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]
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: Php mail havent permission to phpmail.log
« Reply #6 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?

Offline
****
Re: Php mail havent permission to phpmail.log
« Reply #7 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.
Google Hangouts:  rcschaff82@gmail.com