{"id":295,"date":"2025-04-16T13:53:49","date_gmt":"2025-04-16T11:53:49","guid":{"rendered":"https:\/\/www.24x7serverguard.com\/blog\/?p=295"},"modified":"2025-04-16T13:55:50","modified_gmt":"2025-04-16T11:55:50","slug":"%f0%9f%94%90-how-to-fix-suphp-permission-issues-after-migrating-to-a-suphp-enabled-cpanel-server","status":"publish","type":"post","link":"https:\/\/www.24x7serverguard.com\/blog\/cpanel\/%f0%9f%94%90-how-to-fix-suphp-permission-issues-after-migrating-to-a-suphp-enabled-cpanel-server\/","title":{"rendered":"\ud83d\udd10 How to Fix suPHP Permission Issues After Migrating to a suPHP-Enabled cPanel Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When migrating a website from a <strong>non-suPHP<\/strong> server to a <strong>suPHP-enabled<\/strong> cPanel server, you may encounter <strong>permission and ownership errors<\/strong>. This happens because suPHP enforces stricter file and directory permissions for security purposes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide will help you identify the issue and fix it\u2014either manually for individual files or automatically for all users on the server.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u26a0\ufe0f Common Error After Migration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When accessing a domain, you may see a blank page or internal server error. To diagnose, tail the Apache error logs:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">tail <\/mark>-f \/usr\/local\/apache\/logs\/error_log<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You\u2019ll typically see something like this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">[error] SoftException in Application.cpp:601: Directory \u201c\/home\/user\/public_html\/test.php\u201d is writable by group.<br>[error] Premature end of script headers<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">:<\/mark><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd0d Understanding the Issue<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The error usually means that <strong>files or directories are too permissive<\/strong> (e.g., <code>777<\/code> permissions) or <strong>owned by the wrong user<\/strong> (like <code>nobody<\/code> instead of the cPanel user).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">cd <\/mark>\/home\/user\/public_html\/<br>ll | grep test.php<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Output:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">-rwxrwxrwx 1 nobody nobody 158 test.php<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 Fix it manually:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chmod <\/mark>644 test.php<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chown <\/mark>user:user test.php<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udee0\ufe0f Fix suPHP Permissions Server-Wide (Automatic Script for cPanel)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re dealing with multiple accounts, running fixes manually isn\u2019t practical. Here\u2019s a simple shell script that recursively <strong>corrects permissions and ownership<\/strong> for all user accounts on a cPanel server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udcc4 Step 1: Create the Script<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">vi \/root\/suphpfix.sh<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Paste the following content:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/bash<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">for <\/mark>user <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">in <\/mark>`ls \/var\/cpanel\/users`; do<br>  <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">echo <\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">\"Fixing permissions for:<\/mark> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">$user<\/mark>\"<br>  <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chown <\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}:${user}<\/mark> \/home\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}<\/mark>\/public_html<br>  <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chmod <\/mark>755 \/home\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}<\/mark>\/public_html<br>  find \/home\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}<\/mark>\/public_html -group nobody -print0 | xargs -0 <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chgrp <\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}<\/mark><br>  find \/home\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}<\/mark>\/public_html -<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">type <\/mark>f -print0 | xargs -0 <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chmod <\/mark>644<br>  find \/home\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">${user}<\/mark>\/public_html -<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">type <\/mark>d -print0 | xargs -0 <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chmod <\/mark>755<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">done<\/mark><br><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udd12 Step 2: Make It Executable<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">chmod <\/mark>u+x \/root\/suphpfix.sh<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u25b6\ufe0f Step 3: Run the Script<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash \/root\/suphpfix.sh<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This script loops through all cPanel users, adjusts ownership, and applies proper permissions (<code>755<\/code> for directories and <code>644<\/code> for files).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddef Final Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>suPHP<\/strong> ensures PHP scripts are executed as the file owner, not as the web server user (<code>nobody<\/code>), adding a layer of security.<\/li>\n\n\n\n<li>Avoid using <code>777<\/code> or group-writable permissions on files\/scripts.<\/li>\n\n\n\n<li>Always back up before applying bulk permission changes.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When migrating a website from a non-suPHP server to a suPHP-enabled cPanel server, you may encounter permission and ownership errors. This happens because suPHP enforces stricter file and directory permissions for security purposes. This guide will help you identify the issue and fix it\u2014either manually for individual files or automatically for all users on the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[285,279,286,284,287],"class_list":["post-295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel","tag-errorlog","tag-migration","tag-public_html","tag-suphp","tag-vi-root-suphpfix-sh"],"_links":{"self":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":1,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":296,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions\/296"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/media\/297"}],"wp:attachment":[{"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serverguard.com\/blog\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}