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

  1. Log in to cPanel.

  2. Go to Software → Select PHP Version.

  3. 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_limit from 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_errors and set a secure error_log path

  • 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

  • Always back up your .htaccess and configuration before making changes.

  • Hardened settings may break poorly written scripts — test thoroughly.

  • For maximum security, upgrade to PHP 8.x whenever possible.

 
Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution