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.
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.
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.
Email: | support@WebHostingHub.com | Ticket: | Submit a Support Ticket |
---|---|---|---|
Call: | 757-416-6627 | Chat: | Click To Chat Now |
We value your feedback!
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.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!