Re: [docker] error_log() not work
Lew Pitcher <[email protected]>
| Newsgroups | comp.lang.php |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
On Sat, 26 Nov 2022 16:48:24 +0100, SupaPlex wrote:
> Il 26/11/22 15:45, SupaPlex ha scritto:
>>
>> $ docker run xxx ls -ld /var/log drwxr-xr-x 1 root root 4096 Aug 23
>> 13:04 /var/log
>
> Furthermore
>
> file_put_contents('/var/log/error.log', 123);
>
> Output
>
> file_put_contents(/var/log/error.log): Failed to open stream: Permission
> denied
Not surprising, as, in your case, only root can create files in the /var/
log directory and the php process that attempts to file_put_contents()
to /var/log/error.log does not likely run as root.
Your ls listing shows
/var/log drwxr-xr-x 1 root root
which means that only processes run with effective userid of root can
update the directory with new or changed directory entries. That means
that /only root/ can create /var/log/error.log
To fix the problem, either change the permissions of /var/log to
permit your php process to write to it, or run your php process as root.
HTH
--
Lew Pitcher
"In Skills, We Trust"