How can I make my php.ini file recursive ?
Written by Brad MarkleThe 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 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).
Updating your suPHP_ConfigPath value 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.
Testing 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.
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
/home/userna5/public_html/shop/engine/Library/Zend/Db/Adapter/Pdo/Abstract.php:342
Stack trace: #0
/home/userna5/public_html/shop/engine/Library/Zend/Db/Adapter/Abstract.php(247):
Zend_Db_Adapter_Pdo_Abstract->setFetchMode(2) #1
/home/userna5/public_html/shop/engine/Library/Zend/Db.php(270):
Zend_Db_Adapter_Abstract->__construct(Array) #2
/home/userna5/public_html/shop/engine/Library/Enlight/Components/Db.php(96):
Zend_Db::factory('pdo_mysql', Array) #3
/home/userna5/public_html/shop/engine/Shopware/Bootstrap.php(154):
Enlight_Components_Db::factory('pdo_mysql', Array) #4 [internal
function]: Shopware_Bootstrap->initDb() #5
/home/userna5/public_html/shop/engine/Library/Enlight/Bootstrap.php(304):
call_user_func(Array) #6
/home/userna5/public_html/shop/engine/Library/Enlight/Bootstrap.php(258):
Enlight_Bootstrap->loadResource('Db') #7 /home/userna5/public_html/
in
/home/userna5/public_html/shop/engine/Library/Zend/Db/Adapter/Pdo/Abstract.php
on line 342
This 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.
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
Latest Questions
Need more Help?
Search
Ask the Community!
Current Customers
| Chat: | Click to Chat Now | E-mail: | support@InMotionHosting.com |
|---|---|---|---|
| Call: | 888-321-HOST (4678) | Ticket: | Submit a Support Ticket |

