A 500 Internal Server Error indicates that something went wrong on the server while executing a PHP script. On ruachost.com, this error is often caused by incorrect file permissions or invalid directives in .htaccess.
Common Causes
1. File and Directory Permissions
-
PHP scripts may fail if permissions are set incorrectly.
-
Typical errors include:
-
SoftException in Application.cpp: UID of script is smaller than min_uid -
Mismatch between target UID and UID of file -
File is writeable by others
-
Fix:
-
Directories should be set to
755. -
Files should be set to
644. -
Example commands:
cd public_html find . -type d -exec chmod -c 755 {} \; find . -type f -exec chmod -c 644 {} \; -
Do not change permissions on the
public_htmldirectory itself.
2. Invalid .htaccess Directives
-
Servers running PHP as a CGI binary cannot use
php_flagorphp_valuedirectives in.htaccess. -
Example error:
Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
Fix:
-
Move PHP directives into a custom
php.inifile. -
Remove or comment out invalid directives in
.htaccess.
3. Ownership Issues
-
Files owned by
rootornobodyinstead of your user account can trigger errors. -
Fix: Contact Ruachost Support to correct file ownership if needed.
4. Memory Limits
-
Scripts may exceed PHP memory limits.
-
Fix: Increase
memory_limitinphp.inior.user.ini.memory_limit = 256M
Troubleshooting Steps
-
Check error logs:
-
Shared hosting: view logs in cPanel → Metrics → Errors.
-
VPS/Dedicated: check
/usr/local/apache/logs/error_logor/usr/local/apache/logs/suphp_log.
-
-
Correct permissions using
755for directories and644for files. -
Review
.htaccessfor invalid PHP directives. -
Adjust memory limits if scripts are resource‑intensive.
-
Contact support if ownership issues persist.