In our article on Updating Local PHP Settings, we covered how to create a php.ini file and how to modify your php.ini file. In this article, we'll go a little more in depth about making that php.ini file recursive.

Recursive php.ini Explained

When you make a php.ini file recursive, changes made to the php.ini will affect not only the folder it is in but any child folders inside that folder as well. By default the php.ini file is not recursive but this can be easily remedied following the steps we'll go over later in this article.

To make things a bit easier to understand, let's suppose we have a sub folder named staff inside our public_html folder. If we make changes to the php.ini file in the public_html, those changes will only affect scripts in the public_html folder. Any scripts in our "staff" sub folder will not be affected by the php.ini in the public_html folder. The "staff" sub folder will fall back to the server defaults for php configuration unless there is a separate php.ini file in the "staff" folder. While this can be helpful if you want to have different php configurations for various folders, if you want the same settings for all folders in your account, it could become quite tedious to copy the php.ini file into all those sub folders.

Making php.ini Recursive

By adding the following code to our .htaccess file, we can make the php.ini file in our public_html folder recursive so the changes will take affect in all child folders as well:

suPHP_ConfigPath /home/username/public_html

Make sure you replace "username" with your actual cPanel username.

If you do not have an .htaccess file in your public_html you can simply create an .htaccess file using your cPanel File Manager and add the code. 

The changes you just made should be immediate. You can check this by placing a php.info file in your sub folder to verify the php configuration settings for that sub folder.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

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

Related Questions

Here are a few questions related to this article that our customers have asked:
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 757-416-6627 Chat: Click To Chat Now

Ask the Community

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

Not a Customer?

Get web hosting from a company that is here to help.
}