How to make php.ini file recursive

The PHP settings defined in your php.ini file are not means that they do not modify settings in any sub directories of the current directory .

For example.

Let’s assume you have a php.ini file in your public_html directory. That php.ini file has the PHP memory_limit set to 200M. Only programs that run straight in your public_html directory will have the memory_limit set to 200M. If you have a directory known as public_html/blog, that “blog” directory will not be suffering from the public_html/php.ini file, it would only be affected by a php.ini file placed in its own directory, public_html/blog.

If you have many files, creating a php.ini file for each directory would be quite boring.In that case you can upgrade your .htaccess file to tell the server that the public_html/php.ini file should implement not only to public_html, but to any folders within that directory (such as public_html/blog or public_html/sub-domain).

To make your public_html/php.ini file recursive, modify (or create the file if it doesn’t exist) your public_html/.htaccess file and add the following code:


The line you have entered is specifying the folder where the php.ini is placed that you want to make recursive.

Immediately,  you would see the upgrade right away.

Test your changes:

After saving the changes, be sure to create a phpinfo page in one of your sub directories and check the outcomes.