Lab-tested: PHP 8.4.27 built-in server · 2 Dec 2026 · Reproduced and fixed in our lab
Fix Box — Try This First (10 Seconds)
A permission 500 means the server cannot read or write a file it needs. The log names the exact file.
- Reload once, then read the last PHP error log line.
- Look for “Permission denied” or “Failed opening required”.
- Fix that one file: files 644, folders 755. Then verify with curl.
The Exact Symptoms
Visitors see a blank page or a generic 500 message. Nothing on screen mentions permissions.
The log is specific, though. It names the file, the action that failed, and the line that tried it.
What We Reproduced in the Lab
Our test app loaded a config file with require. We set that file to mode 000, so nobody could read it.
The request returned HTTP/1.0 500 Internal Server Error. The log recorded two lines, in order:
PHP Warning: require(.../config.php): Failed to open stream: Permission denied
PHP Fatal error: Uncaught Error: Failed opening required '.../config.php'
A warning became a fatal because require cannot continue without the file. That is the whole failure.
The Fixes
Set the file back to a readable mode. In our lab, chmod 644 config.php was the entire fix.
The same request then returned HTTP/1.1 200 OK with the expected output. No code change was needed.
# Files readable by the web server, writable only by owner
find . -type f -exec chmod 644 {} \;
# Folders traversable and readable
find . -type d -exec chmod 755 {} \;
For WordPress, keep wp-config.php at 600 or 640 where your host allows it. Upload folders need write access for the web server user only.
Decision Table
| Log line contains | Cause | First fix |
|---|---|---|
| Permission denied + Failed opening required | Unreadable include/config file | chmod 644 that file |
| Permission denied + file_put_contents | Unwritable upload/cache folder | chmod 755, check owner |
| Permission denied + .htaccess | Server cannot read rules file | chmod 644 .htaccess |
| Operation not permitted | Wrong owner, not wrong mode | chown to web server user |
What Did Not Work
Setting everything to 777 also “worked” in a quick test, and that is exactly the problem. It removes the error by removing the protection.
We also tried restarting the server first. The status stayed 500, because the file mode did not change.
Prevention
Deploy with a fixed permission step, and never edit files as root on a site served by another user. Owner mismatches cause the same log lines.
Permission failures often arrive with plugin or theme changes. Compare with PHP 500 Error and WordPress 500 Error.
Check any live URL with the 500 Error Checker. If the layer is unclear, start from the pillar 500 Internal Server Error.
FAQ
What permissions should WordPress files have? 644 for files and 755 for folders is the standard baseline. Tighten wp-config.php further if your host allows.
Can wrong permissions cause 403 instead of 500? Yes. If the web server itself is blocked, you get 403; if PHP fails mid-script, you get 500.
Is 777 ever the right fix? No. It is a diagnostic shortcut at best. Find the owner or mode that is actually wrong.
How do I find the broken file fast? The error log names it. One reload plus one log read beats guessing.
Does ownership matter if modes look right? Yes. A 644 file owned by the wrong user can still fail on write paths.
Sources and date
Lab tests run 2 Dec 2026 on PHP 8.4.27. References checked live on the same date.
- RFC 9110 §15.6.1: https://www.rfc-editor.org/rfc/rfc9110.html
- MDN — 500: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/500
- PHP — chmod: https://www.php.net/manual/en/function.chmod.php
- WordPress — Common errors: https://wordpress.org/documentation/article/common-wordpress-errors/






Leave a Reply