InMotion Hosting Support Center

The PHP settings defined in your php.ini file are not recursive. What this means is that they do not modify settings in any child folders (which are subdirectories of the current directory).

Still confused, here's an example.

Let's say you have a php.ini file in your public_html folder. That php.ini file has the PHP memory_limit set to 256M. Only scripts that run directly in your public_html folder will have the memory_limit set to 256M. If you have a folder named public_html/employees, that "employees" folder will not be affected by the public_html/php.ini file, it would only be affected by a php.ini file located in its own folder, public_html/employees

If you have many folders, creating a php.ini file for each folder would be quite tedious. What you can do is update your .htaccess file to tell the server that the public_html/php.ini file should apply not only to public_html, but to any folders within that folder (such as public_html/employees or public_html/about-us). This is the definition of making your php.ini file recursive.

Update your suPHP_ConfigPath in your .htaccess file

Making your php.ini file affect all child folders as well is referred to as making the file "recursive". To make your public_html/php.ini file recursive, edit (or create the file if it doesn't exist) your public_html/.htaccess file and add the following code:

suPHP_ConfigPath /home/username/public_html

This line you entered is specifying the directory where the php.ini is located that you want to make recursive. Be sure to replace username with your cPanel username.

This change is immediate, so you should see the update right away.

How to Test your changes

After saving the changes, be sure to create a phpinfo page in one of your subdirectories and test the results. When looking at your phpinfo page, the "Loaded Configuration File" should reflect the php.ini file that you wanted to make recursive.

Troubleshooting errors

Important! If you add the recursive path to your php.ini and you get an error like the following, it is because the PHP version is not being rendered correctly.

Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with
message 'The PDO extension is required for this adapter but the
extension is not loaded' in
Stack trace: #0
Zend_Db_Adapter_Pdo_Abstract->setFetchMode(2) #1
Zend_Db_Adapter_Abstract->__construct(Array) #2
Zend_Db::factory('pdo_mysql', Array) #3
Enlight_Components_Db::factory('pdo_mysql', Array) #4 [internal
function]: Shopware_Bootstrap->initDb() #5
call_user_func(Array) #6
Enlight_Bootstrap->loadResource('Db') #7 /home/userna5/public_html/
on line 342 

AddHandler in htaccessThis is common with those who are using the PHP version switcher. To fix this error, check your .htaccess file in your home directory. Make sure the correct AddHandler is in the .htaccess and is not commented out. In the image to the right, the php 5.4 AddHandler is shown. If you are unable the fix this error please contact tech support and we can look at it for you.

Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
How Do I Increase the Number of Menus on My Website?
Getting Fatal error: Out of memory with Higher than required Memory
OpenCart email no order confirmations and contact form not working
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

n/a Points
2016-11-03 1:49 am

If i did .htaccess in main directory, then i can copy same thing and change path and upload to sub directory. So second .htaccess can override first .htaccess. In second .htaccess, it make website use custom php.ini. Not the global php.ini from main directory. Please advise.

31,539 Points
2016-11-03 1:16 pm
Yes, if you have a .htaccess file in a subfolder, you can override existing rules it is inheriting from the parent .htaccess file.

Thank you,
n/a Points
2016-09-04 8:17 pm

If suPHP_ConfigPath already exists in the htaccess file in the public_html directory, can I add redirect code or an ErrorDocument line into the same htaccess file? I tried doing this using the Cpanel Redirect tool, but got an error. Maybe the suPHP_ConfigPath needs to be the last statement?

Thanks in advance for any insights,


11,000 Points
2016-09-06 2:25 pm
I would do likewise. Try re-ordering the code in the .htaccess manually. If that doesn't work, you can always place a dedicated php.ini file in the directories they are required to affect. But I don't expect you should have a problem.
n/a Points
2016-07-01 11:32 am


I received Internal Server Error message when I tried to add the code in my .htaccess file. 

What do you reckon is the problem?



42,832 Points
2016-07-01 3:53 pm
Hello Tim,

There are number of possible causes to this problem. Can you give us any specific information on the account? Also, exactly what code did you use? If we can look at the issue then we may be able to troubleshoot it. We also have an article that discusses Internal Server errors If you have any further questions or comments, please let us know.

Arnel C.
n/a Points
2016-03-23 5:12 am


Can i make php.ini recursive in selected directories?For exampleIf suPHP_ConfigPath is configured to /home/username/public_html directory, can i create another customized php.ini in /home/username/public_html/manager to override the php value? (I still want /home/username/public_html/employee to use the php setting from the parent)

I have tried to create a customized php.ini some choosen directories, however, they do not override the setting. In the phpinfo page, the "Loaded Configuration File" still point to /home/username/public_html/php.ini

Doing following does the trick, but i am not sure whether it is a save/right thing to implement:

1)Create a htaccess file in the choosen directory(If file not exist).

2)Copy/Change the code to "suPHP_ConfigPath to /home/username/public_html/manager" in (1)

Now, the phpinfo in will show the setting updated.Any correct/right way to make php.ini recursive in selected directories?

Thank you.

11,000 Points
2016-03-23 8:45 am
The way I recommend is to make your php.ini file recursive and put a new php.ini file in the directories you want to exclude from the recursive path.
n/a Points
2016-03-23 10:25 pm

Hi christopherm,

Thanks for the reply.

My suPHP_ConfigPath is configured to the root(home/username/public_html), this is my where main site located. However, i have few directories set up for other website.

For example

home/username/public_html/support -

(above is a support website, ticket system)

home/username/public_html/forum -

(above is a forum website)

home/username/public_html/example2 -

(above contains second website)

Hence, i would like to to have different php setting for above directories.

If i create three seperate php.ini where 'suPUP_ConfigPath' in each php is set to-home/username/public_html/forum-home/username/public_html/support


and put above php.ini(s) to the correspond directory, it will overwrite the php setting in 


The way I recommend is to make your php.ini file recursive and put a new php.ini file in the directories you want to exclude from the recursive path.My mains site is located at (home/username/public_htm/) and my other websites(where i want to have customized php setting) are located in the subdirectories. It is impossible to exclude these directories from the root.

11,000 Points
2016-04-12 3:19 pm
Pardon me, I meant that the php.ini in the subdirectories should take priority over the recursive one.
n/a Points
2016-01-24 8:02 pm

I dont know Jack about PHP, and your 2 tutorials have allowed me to configure parameters that not even Hostgator support could deal with!

Huge Thank You!

n/a Points
2015-12-09 12:00 pm

Great!worked for me :)

n/a Points
2015-11-24 10:42 pm

Thank you man! You saved me from long time fixing this.

n/a Points
2015-10-11 9:19 am

Thanks! You saved my day :)

n/a Points
2015-05-24 12:59 pm

Thank you. After a lot of webs and forums I have solved my problem

Great job!!

n/a Points
2014-09-22 4:24 am

This does not work anymore with opencart. It will not send order emails.

Renamiong the php.ini to something else like php.ini.OLD solves the order email issue but it makes the backend solw and the site unstable.

43,761 Points
2014-09-22 7:17 am
Hello Sam,

The php.ini file is not made to work specifically with any CMS or program. It is simply a file where you are able to modify php settings for your account if the program or CMS you are running needs them. Simply, it is a way you can make changes that would otherwise need to be made on the server.

You may want to contact Live Support so they can provide you a copy of the most current server version of php.ini. Then you are able to go in and make any changes OpenCart may need.

Kindest Regards,
Scott M
n/a Points
2014-09-04 3:50 pm
Thanks very much
n/a Points
2014-06-12 2:03 am

Thanks, this article helped me solve a loss of menus (dropped entries > ~80) in WordPress.  This is a documented limitation.  I changed the max_input_vars to 5000 but did not see the effect until I made php.ini recursive.

2012-10-25 12:17 pm
Thanks, that article was helpful. I came to this article from another one,, in the section with the subtitle, "I made changes to the php.ini file, however I do not see the changes!" Perhaps you would want to add some copy there, to direct people to this article if they use suPHP, and to the other article if they use FastCGI.
n/a Points
2016-01-10 6:54 pm
I agree with 3abnwebmaster, in that this info needs to be more easily located.  I have a new VPS, and figuring out what applies to me, vs hosted systems is often a PIT*...I also discovered this...
but you need root acces to do it.  Arghhh... I miss having my own server!
2012-10-25 9:51 am
What if you are using FastCGI, not suPHP?
9,968 Points
2012-10-25 11:53 am
Hello 3abnwebmaster, thanks for the great question.

It didn't look like we had any information published on this particular topic, so I've gone ahead and created a new article for you explaining the process here:

Custom php.ini file per user with FastCGI

Please let us know if you have any further questions at all.

- Jacob

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

27 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!