A php.ini file contains directives that control many aspects of PHP’s behavior. On ruachost.com, you can create custom php.ini files to override default PHP settings for your applications.
???? Why Use a Custom php.ini??
-
Adjust PHP limits (memory, upload size, execution time).
-
Enable or disable specific PHP extensions.
-
Configure error reporting for debugging.
-
Apply different settings to specific directories.
How Custom php.ini Files Work
-
By default, a custom php.ini affects only the directory where it is located.
-
You can create multiple php.ini files for different directories.
-
To apply one php.ini file to the entire site, reference it in
.htaccess.
Steps to Create a Custom php.ini File
Step 1: Log in to cPanel
-
Access your hosting account via cPanel.
-
Open File Manager.
Step 2: Navigate to the Target Directory
-
Go to the directory where you want to modify PHP behavior (e.g.,
/public_html).
Step 3: Create the php.ini File
-
Click File → New File.
-
Name the file
php.ini. -
Edit the file and add directives. Example:
memory_limit = 256M upload_max_filesize = 20M post_max_size = 20M max_execution_time = 60
Step 4: Save and Verify
-
Save changes.
-
Create a
phpinfo.phpfile in the same directory:<?php phpinfo(); ?> -
Load it in your browser and confirm the new settings are active.
Applying php.ini Site‑Wide
To apply one php.ini file across your site, add this line to .htaccess in your document root:
lsapi_phpini /home/username/public_html/php.ini
Replace username with your Ruachost account username.
Best Practices
-
Use moderate values to avoid resource overuse.
-
Keep backups of your php.ini files.
-
Test changes in a staging environment before applying to production.
-
Delete
phpinfo.phpafter verification for security.