644 for files and 755 for directories is the correct pair on a cPanel server, but on a box running suEXEC it is not a style preference — Apache will not execute a PHP file that is writable by group or world, full stop. If a migration, restore, or FTP client’s default permissions left something looser, the request dies with a 500 and the error log shows SoftException in Application.cpp: File ... is writeable by group. This guide covers what suEXEC checks and why, how to read that error back to the exact offending path, and how to repair a WordPress document root without a blanket chmod -R 755 that creates new problems while fixing the old one.
What you’ll accomplish
- Understand the octal permission model well enough to read and set modes with confidence, not by copying a number.
- Know exactly what suEXEC checks on a request — ownership, and group/world write on the script and every directory above it — and why.
- Read a
SoftExceptionlog line and map it to the file or directory actually causing the refusal. - Apply the correct WordPress-on-cPanel baseline:
755directories,644files, and an honest answer onwp-config.php. - Repair a broken tree safely, with
findcommands that touch files and directories separately, never a single recursivechmod.
Prerequisites
- SSH access to the account, or WHM/root access if you are the host rather than the account owner. The
find-based repair works from either seat; readingsuexec_logdirectly needs root. - A cPanel account running suEXEC, suPHP (CGI-style, PHP runs as the account user), or PHP-FPM with a per-account pool (also runs as the account user). This does not apply to shared
mod_php/DSO hosting — see PHP-FPM and suEXEC on cPanel to confirm the handler. - The account’s cPanel username; every command below substitutes it for
<user>. - A recent backup before any bulk
chmod/chown— conservative as this repair is, a mistyped path scoped too high is exactly what a backup is for.
How it works
suEXEC exists because the alternative — mod_php running every account’s PHP as the same nobody or www-data user — means a vulnerability in any one plugin, anywhere on the box, can read every other tenant’s wp-config.php. suEXEC (and PHP-FPM with a per-account pool, which enforces the same idea differently) makes PHP run as the cPanel account’s own user, so a script can only touch files that user owns. For that isolation to mean anything, suEXEC must refuse a script a different user could have tampered with — exactly what group- or world-write permissions allow. Before executing anything, it checks:
- Ownership. The script must be owned by the user the request is configured to run as. A file left owned by
rootafter an SSH upload, or by a previous account’s UID after a restore, fails here regardless of its permission bits. - Write bits on the script. Not writable by group or world — only the owner may change it.
- Write bits on every directory above it. Apache walks from the script’s directory up to the document root (cPanel hardens this up to the home directory), applying the same rule at each level. One loose directory anywhere fails the whole request, even if the script itself is a clean
644. - No setuid/setgid. Either bit set is refused outright — suEXEC will not run something that could re-escalate its own privileges.
Fail any of those and the request never reaches PHP; Apache logs the specific reason and returns a 500 to the visitor.
The octal model, briefly. Each permission set is three digits — owner, group, other — and each digit sums read (4), write (2) and execute (1). 644 is owner rw- (6), group r-- (4), other r-- (4): only the owner can write, and nobody can execute it as a binary. 755 is owner rwx (7), group r-x (5), other r-x (5). Execute means something different by target: on a file, it lets the kernel run it as a program directly (irrelevant for PHP, which Apache hands to the interpreter). On a directory, execute is the search bit — it lets a process enter and reach a file inside by name, independent of whether it can list the contents. That is why directories need 755 and files only 644: without execute on every directory in the path, suEXEC cannot even reach the file to check it.
Step-by-step
1. Read the exact error and map it to a path. The message names the file directly, so resist the urge to guess:
grep -i "softexception" /usr/local/apache/logs/suexec_log | tail -20
[2026-08-19 09:14:02]: uid: (523/exampleuser) gid: (523/exampleuser) cmd: index.php
[2026-08-19 09:14:02]: SoftException in Application.cpp:265: file is writeable by group
suexec_log is root-only. Without root, cPanel’s Metrics → Errors page shows the same log filtered to your account’s username — look for the matching timestamp. If you have root but the path above isn’t right for your build, confirm the compiled-in log path rather than guessing:
httpd -V | grep -i suexec
-D SUEXEC_BIN="/usr/local/apache/bin/suexec"
The log entry names the offending file, but not its full path when suEXEC is refusing on a parent directory rather than the script itself — the next step covers that.
2. Confirm the actual mode and owner, don’t assume. Check the file suEXEC named, then walk the directory chain above it.
stat -c '%U:%G %a %n' /home/<user>/public_html/index.php
find /home/<user>/public_html -maxdepth 0 -printf '%m %u:%g %p\n'
exampleuser:exampleuser 664 /home/<user>/public_html/index.php
755 exampleuser:exampleuser /home/<user>/public_html
664 on the file is the tell — owner and group both writable, which is exactly what rule 2 above refuses.
3. Dry-run the audit before changing anything. These find commands only print; nothing is modified yet.
find /home/<user>/public_html -type f -perm /022 -print
find /home/<user>/public_html -type d -perm /022 -print
/home/<user>/public_html/index.php
/home/<user>/public_html/wp-content/uploads
-perm /022 matches anything with the group-write or other-write bit set — the exact condition suEXEC refuses. An empty result on either line means that category is already clean.
4. Apply the fix as two separate passes — never a single recursive chmod. Files and directories need different modes, so one chmod -R 755 . is wrong for every file in the tree. Run files and directories separately:
find /home/<user>/public_html -type f -exec chmod 644 {} \;
find /home/<user>/public_html -type d -exec chmod 755 {} \;
There is no output on success — confirm by re-running the dry-run audit from step 3 and expecting nothing back:
find /home/<user>/public_html -type f -perm /022 -print
find /home/<user>/public_html -type d -perm /022 -print
(no output)
5. Fix ownership, since suEXEC checks it independently of the mode. Files left owned by root (a common outcome of an SSH restore run as root, or an unzip done from a root shell) fail suEXEC’s ownership check even at a perfect 644.
find /home/<user>/public_html ! -user <user> -printf '%u %p\n' | head
chown -R <user>:<user> /home/<user>/public_html
root /home/<user>/public_html/wp-content/plugins/some-plugin/vendor/autoload.php
The first command lists what would need fixing; the chown -R applies it. Re-run the first line afterward and expect no output.
6. Set wp-config.php to the tighter mode. Under suEXEC or a per-account PHP-FPM pool, PHP already runs as the account owner, so the file only needs to be readable by that one user — 600 is the strictest correct answer, 640 the looser one some setups still need.
chmod 600 /home/<user>/public_html/wp-config.php
stat -c '%a %U:%G %n' /home/<user>/public_html/wp-config.php
600 exampleuser:exampleuser /home/<user>/public_html/wp-config.php
Consider 640 instead only when a different user needs to read the file — a WP-CLI cron job under a separate system account, a deploy or backup agent, a staging-sync tool. 600 breaks that silently, with no suEXEC error, because the failure is a plain PHP read denial before Apache is involved at all. If nothing but the account’s own PHP process reads wp-config.php, 600 is strictly better; if something does, set the group to that specific process’s group rather than loosening to 640 for everyone.
7. Leave wp-content/uploads at 755, not 777. This is the most common overcorrection. Under suEXEC or per-account PHP-FPM, the process writing the upload is the account owner, so owner-write in 755 is all that’s needed — group and world write are never required for WordPress to save a file. 777 means any other tenant’s compromised script, or anything an attacker places elsewhere on the box, can write there too.
stat -c '%a %U:%G %n' /home/<user>/public_html/wp-content/uploads
touch /home/<user>/public_html/wp-content/uploads/permcheck.txt && echo "write ok" && rm /home/<user>/public_html/wp-content/uploads/permcheck.txt
755 exampleuser:exampleuser /home/<user>/public_html/wp-content/uploads
write ok
If touch fails at 755, the problem is ownership, not the mode — go back to step 5.
8. Check the umask, or new files will regress the fix. A sweep fixes what exists today, not the next upload, plugin update, or cache write. A new file’s permissions come from 666 (files) or 777 (directories) minus the process’s umask. cPanel’s default FTP/SSH umask is 022, producing exactly 644/755 — but umask 002 produces 664/775, group-writable from creation.
umask
0022
If this returns 0002 for the account’s PHP-FPM pool or shell, that is the actual root cause, and re-running step 4 weekly is treating the symptom.
Validate it works
Confirm the tree is clean, then confirm the site itself.
find /home/<user>/public_html -type f -perm /022 -o -type d -perm /022 | wc -l
find /home/<user>/public_html ! -user <user> | wc -l
tail -5 /usr/local/apache/logs/suexec_log | grep -c softexception
0
0
0
Three zeros: no loose permissions, no ownership mismatch, no fresh SoftException entries. Then confirm the 500 is gone:
curl -sS -o /dev/null -w "%{http_code}\n" https://example.com/
200
Troubleshooting
Fixed everything under public_html and it’s still 500. suEXEC’s directory check goes above the docroot. Run ls -ld /home/<user> /home/<user>/public_html — the home directory itself must not be group- or world-writable (750 or 711 is typical; never 777), and a 750 home with the wrong group can break traversal on some configurations. Walk the full chain, not just the docroot down.
The fix holds for a day, then breaks again. Almost always the umask from step 8, or an FTP/SFTP client with its own default upload permission set looser than 644/755 in its preferences — check the client’s transfer settings, not just the server.
wp-config.php at 600 broke something that isn’t the website. A cron job, deploy step, or monitoring agent running as a different system user needs group-read and just lost it silently — no suEXEC log entry, because the failure is a plain PHP read denial, not a suEXEC refusal. Identify the process and either run it as the account user or set the file to 640 with the group set to that process’s group specifically.
Someone already ran chmod -R 777 to “make it work.” It usually does, briefly — until the account is scanned and a web shell lands in a now-world-writable directory. Undo it with the two-pass find in step 4; do not spot-fix just the erroring file, since a 777 sweep normally hit the whole tree.
Permissions are correct but ownership shows a stale numeric UID after a restore. Visible as a number instead of a username in ls -l. It is not itself a suEXEC violation if it happens to match, but it is fragile — the same chown -R <user>:<user> from step 5 corrects it.
When this is the wrong approach
None of this applies if the account runs shared mod_php or the DSO handler rather than suEXEC, suPHP, or a per-account PHP-FPM pool — there, PHP runs as the shared Apache user for every account, so there is no per-account ownership check, and a group-writable file will not produce a SoftException. Confirm the handler before chasing a suEXEC-shaped fix on a server that isn’t enforcing it — PHP-FPM and suEXEC on cPanel covers checking which one an account is on.
It also does not apply outside cPanel/EA4-shaped hosting: a containerized deployment where PHP-FPM runs as www-data and the account owner is a deploy pipeline, not a cPanel user, needs matching container-process UID to file UID instead. And if the 500 persists after every check above returns clean, the cause has moved past permissions — check error_log in the account’s logs/ directory for the underlying PHP fatal, since a clean suEXEC pass only proves the script was allowed to run, not that it ran correctly.
For the fuller hardening baseline beyond suEXEC specifically — blocking PHP execution inside uploads, secrets handling, a repeatable audit — see the cPanel file permission and ownership baseline. If a manual file move left ownership scrambled rather than permissions, fixing WordPress file ownership after a manual move covers that case, and WordPress file permission hardening covers the model independent of cPanel.
If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.