Usually this happens in a suPHP environment. There could be few reasons why this could happen. We list here a few. The solution is intended for those with shell access.
chown your_username.your_username path_of_your_php_file
If that fixes only that file and not your entire php files, use the below command to change all the php files.
find . -type f -name “*.php” -exec chown username.username {} \;
find . -type d -exec chown username.username {} \;
Ignore “*.php” in the above command if it still errors out for a php file. If it still don’t fix, move on to other solutions below.
find . -name “*.php” -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
Often, you can do the above command without the -name “*.php” in the command.
cat /dev/null > /usr/local/apache/logs/error_log
If you know any other cases which require another solution for this, please comment here or edit the blog.
Related posts:
This is a insightful and helpful article. I have linked to it in hopes it may help some clients.
Thanks