Sign Up / Log In
Need help?
08456 171 171
Online Support Web Hosting

How to Make the php.ini File Recursive

In our article where is my php.ini file, we’ve covered how to locate and create a php.ini file. In this guide, we’ll go in-depth in making php.ini file recursive. But what does it mean?

What Does Recursive php.ini Mean

If you’re making a php.ini file recursive, any changes made to the php.ini will apply to the folder it is in but also to any subfolders too. By default, the settings defined in your php.ini file are not recursive. But you can resolve this by following the steps in this article.

Here’s a scenario to make it easier to understand.

Let’s say we have a subfolder named employees inside our public_html folder. If we make changes to the php.ini file in our public_html, those changes will only apply to scripts in our public_html folder.

The scripts in our employees’ subfolder will not change after making updates to the php.ini file in the public_html folder. The scripts inside our employees’ subfolder will use the server defaults for any PHP settings. Unless there is a separate php.ini file in the employee subfolder.

This can also be helpful if you want to have different PHP settings for various subfolders. If you want the same settings applied to all folders in your account, it can be tedious to copy the php.ini file into all those subfolders.

How to Make the php.ini File Recursive

You can make the php.ini file recursive by adding the following code to your .htaccess file. Follow the steps below:

  1. Access your File Manager.
  2. Navigate to your public_html folder, and locate the .htaccess file.
  3. Click on Edit on the top navigation bar.
  4. Enter the following code below:
    suPHP_ConfigPath /home/username/public_html

    Make sure to replace the username with your hosting username.
  5. Click the Save button to apply changes.

Changes will be applied immediately. You can check this by creating a php.info file in a subfolder you want to confirm the PHP configuration. If you need any further assistance in making your php.ini file recursive, please let us know. We’d love to help!

Was this helpful? Yes No 64% of people found this helpful.
we're
online
Need Help? Chat Now