Skip to main content

root php 5.6 and subfolder php7.0

Comments

8 comments

  • cPanelLauren
    This should be as easy as placing the appropriate .htaccess file in the folder this goes over basically the same thing you did. How are you testing the PHP version?
    0
  • bear
    I'm finding this issue as well. If the server default is still php 5.6 (i know, working on it), and a single site is set to use PHP7 via the PHP selector (which generates an .htaccess entry in the doc root), then any other folders within the doc tree for that account won't honor other .htaccess in other folders; not lower nor greater versions of php. Example: public_html --.htaccess: php 7.2 ---- new folder ------ .htaccess: php 5.6 PHPinfo in either folder says it's on 7.2 The only way to get it to work is if the site uses the system default and there's no .htaccess directive in the doc root. Is there no way to have the root dir use a "forced" php version and other folders within the same tree use some other "forced" lower version? This is a non-permanent fix while working on removing the scripts that require the old one while the other folder has the software that won't run on the old one...
    0
  • cPRex Jurassic Moderator
    @bear - can you let me know how you are setting up the PHP version in the subdirectory? Is this being done through the interface or by manually adjusting the .htaccess file on the machine?
    0
  • bear
    I guess I didn't explain well. If the server default is used, and not telling Cpanel to use something else, there is no htaccess entry in root, and other folders will see older/lower versions fine when added manually using the same CP generated code. As soon as I use Cpanel to change the PHP version, which adds info to the doc root htaccess in public_html, any manually added htaccess rules to folders below it like "public_html>new_folder" will not see any PHP version but the one CP added in the root. This was checked not only using phpinfo but by adding a quick script that would fail using PHP5.
    0
  • cPRex Jurassic Moderator
    To test this, I set up one domain using the default PHP version on the server. I then went into cPanel for the user, and changed the PHP version through MultiPHP Manger. I then created a subdomain inside public_html, and then used MultiPHP Manager, again though cPanel as the user, to change the PHP version to something different. All of that worked how I would expect and I didn't see it inherit the PHP values from the main .htaccess. It might be a good idea to submit a ticket to our team since it sounds like this could be an issue specific to your environment. If you do create a ticket, please post the number here so I can follow along and keep this thread updated.
    0
  • bear
    I didn't create a subdomain, so am adding this manually to the directory. If you access the subdomain via the main site: "domain.tld/sub", does it still work and see whatever version you'd set?
    0
  • bear
    Please disregard, I think I've determined how to workaround this. If it all pans out I'll post the result.
    0
  • cPRex Jurassic Moderator
    Cool - let us know!
    0

Please sign in to leave a comment.