Setting Custom PHP Options with Your Own Custom php.ini File

1. In the same directory as the files you want to affect put this in the .htaccess file:
It will show PHP the path to your custom php.ini File.

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/cpanel_username/folder_name_if_any/php.ini
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>

If there is no .htaccess file you can create a new text file using the CPanel File Manager. Note that there is a dot at the beginning which makes it an invisible file.

If you don't see files that begin with a period (dot) then read How to Show Invisible Files in CPanel File Manager

Put the php.ini file in the directory specified in the .htaccess file.

The php.ini file is recursive unless overridden by another php.ini file.

Put PHP Option directives in the php.ini file.

Some common examples are:

post_max_size = 64M
upload_max_filesize =128M
max_input_time = -1
max_input_vars = 1000
PHP memory limit = 128MB


(-1 means unlimited)
  • PHP
  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

Change PHP version

In CPanel go to Software -> Select PHP Version.There you can select the version of PHP and...

Setting the PHP Timezone in the php.ini File

 If you get this error: Warning: date(): It is not safe to rely on the system's timezone...

How to see all PHP settings with a phpinfo.php File

This tutorial will show you how to make a phpinfo.php file.Create a new file using the file...

PHP 7 is Faster Than PHP 5.6

Try using the "Select PHP Version" feature in CPanel to switch to PHP 7.Be aware that this will...

MYSQL no longer supported in PHP 7

As of December 31 2018 PHP 5.6 is no longer supported with security updates.This means moving to...