PHP Inheritance Logic & Recursive Checking?
I'm trying to learn the basics about setting up PHP versions and how those are inherited in cPanel. But some things do not add up. Here are the places where you can define the PHP version:
- System (Global)
- Main Domain (located in public HTML folder)
- Addon Domains and Subdomains (can have their own root folders or be subfolders of public_html)
- system1
- system1/main-domain2
- system1/main-domain2/addon-domain3
- system1/main-domain2/subdomain3
- system1/addon-domain3
- system1/subdomain3
- The 3. and 4. are straightforward since addon-domain3 and subdomain3 will inherit the version from main-domain2.
- The 5. and 6. addon-domain3 and subdomain3 should inherit from system1, not from main-domain2, but your documentation states that it will inherit from main-domain2. See the table at the bottom of the page, sub6.example.com specifically.
-
In general, PHP doesn't care about domains and subdomains - it doesn't have any knowledge of that structure, so it would just read the data from the system or a local .htaccess if present. The Tweak Settings value does control this a bit and is more designed for performance improvements on busy sites to keep Apache and PHP from reading multiple levels deep into the structure to figure it out. But yes, your example is correct for addon-domain3. 0 -
Thank you Rex! So the last table row (column "Effective PHP version") in the PHP Inheritance doc is not correct and instead of 7.0 should be 5.6. 0 -
The description for the .htaccess recursive depth check setting has two flaws: [QUOTE]The maximum number of directories deep to look for .htaccess files when doing .htaccess checks. Values higher than 100 are discouraged.
- This option only checks for AddHandler directives in the .htaccess, and how deep will it go. It doesn't ignore other content of .htaccess files nor how deep the system will take these files into consideration. Because of that some people may confuse it with the AllowOverride directive's functionality - to define where and how deep the system will take .htaccess files into consideration. Specify that this check is only for the AddHandler directive.
- Values higher than 10 will slow down your server, as stated in the documentation, but the description says 100.
0 -
I agree with all of the above. I created the following cases: CPANEL-43448 for the WHM interface change from 100 to 10 DOC-19820 for the documentation page to fix the table DOC-19821 for the AddHandler clarification Thanks so much for pointing these out! 0 -
It is my pleasure! In case you open up a job spot that benefits from this kind of service feel free to let me know. :) This is only my 3rd week with the software. The challenge is to thoroughly plow through the entire WHM/cPanel interface and documentation in one month. I have one more thing I want to clarify about the "Depth to recurse for .htaccess checks" setting: - If it's set to "1" then only the root folder of a domain will be checked for the AddHandler directive.
- If it's set to "0" then the system will not check for the presence of the AddHandler directive.
- If this option is set to "0", in other words, to not check for the AddHandler directive, what happens when you set the PHP version of a domain through WHM/cPanel MultiPHP Manager that adds the AddHandler directive to that domain's .htaccess?
- I presume this setting is completely different than the recursive check setting and it does check the domain root's .htaccess for the AddHandler directive.
- This MultiPHP Manager's setting will also comment out any other custom-added AddHandler directives by the user? So basically the recursive check setting is only for the user-added AddHandler directives?
- Also, if you set the PHP version through the MultiPHP Manager and recursive check to "1", then it is basically the same thing. The first adds the AddHandler and the second one will be useless since it only checks the root folder for the user-added AddHandler, which is commented out. So then either set it in the MultiPHP Manager or add it manually to the .htaccess? Or if you want to make use of MultiPHP Manager, which is advised, recursive check becomes useful only with the value "2" or higher?
0 -
Note on how these two settings interact should be on both the settings' interface and documentation pages. 0 -
In the docs, we say you should enter a number greater than zero. As you've discovered, allowing zero wouldn't really make any sense, but the interface does seem to take that. I've created case CPANEL-43449 to ensure we don't allow "0" to be entered into the manual entry box there. 0 -
Good. Can you please take a second to confirm if I was correct on those 4 previous matters? Thank you. 0 -
Well, number 1 would be negated once the case is resolved. For number 2, the root .htaccess will always get checked no matter what "Yes" to 3 and 4. 0 -
I'm probably boring everyone already, but it's still unclear to me about the recursive check setting. Here are the two statements from the documentation: - This setting allows you to specify the maximum number of directories deep to look for .htaccess files when you change the PHP handler.
- This setting also comments out any AddHandler directive lines in your users" .htaccess files that change how the system handles PHP.
0 -
cPanel has a block of code inside every .htaccess file present on the server. You'll see it formatted like this: # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php81" package as the default "PHP" programming language. AddHandler application/x-httpd-ea-php81 .php .php8 .phtml # php -- END cPanel-generated handler, do not edit so that's where we'd make the changes. It's only going to comment out cPanel-generated code, so manual entries in another area of the file will still work properly. 0 -
- This setting allows you to specify the maximum number of directories deep to look for .htaccess files when you change the PHP handler.
- This setting also comments out any AddHandler directive lines in your users" .htaccess files that change how the system handles PHP.
Don't you think these two can be misleading? Suggestions to fix this:- ...when you change the PHP handler via the MultiPHP Manager interface.
- ...comments out AddHandler directive added via the MultiPHP Manager interface in your users" .htaccess files that change how the system handles PHP.
- [COLOR=rgb(184, 49, 47)]Recursive check is basically an off switch for considering cPanel-generated AddHandler directives below the specified depth.
- [COLOR=rgb(184, 49, 47)]It ONLY CHECKS for cPanel-generated directives and COMMENTS OUT the ones below the specified depth.
- [COLOR=rgb(184, 49, 47)]It DOESN'T CHECK or COMMENTS OUT the manually added directives.
- [COLOR=rgb(184, 49, 47)]So when users manually add directives they will be applied?
0 -
Yes, that all seems correct to me! 0 -
But what is the root from which the search begins? [QUOTE] For example, if the /home/user/public_html directory is your document root, and 2 is the value for this setting, the system searches the following directories for .htaccess files: /home/user/public_html /home/user/public_html/directory1 /home/user/public_html/directory2 The system does not search the /home/user/public_html/directory1/directorya.
- If I change the PHP handler for my main domain /home/user/public_html via MultiPHP Manager and also change it for my addon domain /home/user/public_html/directory1 and set the value to "1", addon-domain gets commented out, making the MultiPHP Manager setting useless for domains with deeper roots.
- Does only the main domain's document root get searched or any domain's root? For example, my addon domain roots are /home/user/web/site1, /home/user/web/site2. Do these also count as roots for this search? Does the search restart with each (sub)domain's root?
0 -
I would expect the search to start with the main domain on the account, which would always be /home/username/public_html. If you have a scenario created on your system where you can reproduce an issue, could you submit a ticket to our team so we can do more direct testing? 0 -
But what about addon/sub domains that are not subfolders of /home/username/public_html? How does the search progress in this case? 0 -
The "start" is whatever the docroot is for the domain. If that happens to be /home/user/sub, then that's the "root" where it would start counting. 0
Please sign in to leave a comment.
Comments
18 comments