If your application is still running on PHP 7.0 or earlier, it is important to harden your environment to reduce security risks. On ruachost.com, you can configure PHP settings directly in cPanel to improve security and performance.
Why Harden PHP?
-
PHP 7 and below are end‑of‑life and no longer receive official security updates.
-
Hardened settings reduce exposure to vulnerabilities.
-
Helps prevent exploits such as remote file inclusion, code injection, and information leakage.
Steps to Harden PHP in cPanel
Step 1: Check Your PHP Version
-
Log in to cPanel.
-
Go to Software → Select PHP Version.
-
Confirm the current version.
-
Ruachost supports multiple versions (4.4 through 8.4).
-
If possible, upgrade to PHP 8.x for better security.
-
Step 2: Configure PHP Settings
In cPanel → Select PHP Version → Options tab, adjust the following:
-
Remote connection settings
-
Disable remote file access:
-
Clear
allow_url_fopen -
Clear
allow_url_include
-
-
-
Script processing time
-
Limit execution time:
-
Set
max_input_time = 30 -
Set
max_execution_time = 30
-
-
-
Memory usage
-
Reduce memory limit:
-
Change
memory_limitfrom default (e.g., 768M) to a lower value (e.g., 128M–256M).
-
-
-
PHP exposure
-
Hide PHP version in headers:
-
Clear
expose_php
-
-
-
Error handling
-
Prevent information leakage:
-
Clear
display_errors -
Enable
log_errorsand set a secureerror_logpath
-
-
-
File uploads
-
Disable if not needed:
-
Clear
file_uploads
-
-
If required, set a reasonable
upload_max_filesize(e.g., 10M).
-
Step 3: Test Your Application
-
Visit your site and confirm functionality.
-
Check logs for errors.
-
Adjust settings as needed to balance security and usability.
Important Notes
|