[vmuser@vmservernumber ~]$ sudo chown vmuser:apache /home/httpd/html/checklog_log.txt
[vmuser@vmservernumber ~]$ ls -l /home/httpd/html/checklog_log.txt
-rw-rw-rw- 1 vmuser apache 3058 May 9 18:50 /home/httpd/html/checklog_log.txt
[vmuser@vmservernumber ~]$ sudo usermod -a -G WHMCS_MIA_3778 apache
[vmuser@vmservernumber ~]$ ls -l /home/httpd/html/checklog_log.txt
-rw-rw-rw- 1 vmuser apache 3058 May 9 18:50 /home/httpd/html/checklog_log.txt
[vmuser@vmservernumber ~]$
Check File Ownership:
- Ensure that the log file's group is set to a group that includes the web server user, or the log file's owner is the web server user itself.
- You can check the file's ownership and group with:
ls -l /home/httpd/html/checklog_log.txt
Change File Ownership:
If the web server user is
vmuser
and it should own the log file, you can change the ownership with:
sudo chown vmuser:apache /home/httpd/html/checklog_log.txt
If
apache
should not own the file but should be part of the group, make sure the file group is set to
apache
or another group that includes
apache
:
sudo chgrp apache /home/httpd/html/checklog_log.txt
Modify Group Membership:
Ensure the
apache
user is part of the group assigned to the file. This was supposedly handled by your hosting provider but verify it:
sudo usermod -a -G groupName apache
Replace
groupName
with the actual group name that should have access.
Adjust Permissions If Needed:
- If the above steps are correct and the issue persists, double-check the permissions. Although 664 should be adequate, ensuring the correct group ownership is crucial.
Use Error Handling in PHP:
Update your PHP error handling to provide more context or to handle issues without crashing:
if (!is_writable($file)) { // Log this error using another method or handle it accordingly error_log("