Skip to content

Custom php.ini files

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.

  • 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.
  • 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.
  • Access your hosting account via cPanel.
  • Open File Manager.
  • Go to the directory where you want to modify PHP behavior (e.g., /public_html).
  1. Click File → New File.

  2. Name the file php.ini.

  3. Edit the file and add directives. Example:

    memory_limit = 256M
    upload_max_filesize = 20M
    post_max_size = 20M
    max_execution_time = 60
  • Save changes.

  • Create a phpinfo.php file in the same directory:

    <?php phpinfo(); ?>
  • Load it in your browser and confirm the new settings are active.

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.

  • 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.php after verification for security.