I'm using shared hosting, can create .htaccess and php.ini and have access to ssh.
I have PHP 5.6 installed to ~/public_html/php56 and can use this path with ssh, cron and exec() but not on the web.
Apache uses php 5.4 because it's set in .htaccess:

AddHandler application/x-httpd-php54s .php

Is it possible to specify full php path using maybe AddHandler, Action, CGI etc.?

  • Are you on a shared host? If so, you can't the PHP version you're running.
    – John Conde
    Oct 22 '14 at 11:40
  • I can choose it by defining AddHandler application/x-httpd-php54\53\52 etc. but it uses root php installs
    – mu3
    Oct 22 '14 at 11:50
  • I used to be a web host and I can tell you that unless it is installed for global use, more than likely not. You would/may need access to files and directories that effect other sites and that would not be allowed for safety sake. Web hosts do not like single sites negatively effecting other sites.
    – closetnoc
    Oct 22 '14 at 16:00
  • @JohnConde It is possible. I am a web host and my customers can change their PHP version (e.g. PHP 5.3 or 5.4) Nov 7 '14 at 16:14
  • Can your customers define full PHP path in .htaccess?
    – mu3
    Nov 7 '14 at 16:31

Doing it through a .htaccess file while theoretically possible can cause issues and so many shared web hosts prevent that directive in .htaccess. However depending on the hosting panel they are using you may be able to specify the PHP version to use using the hosting panel itself. Both cPanel and Plesk have the ability to specify the PHP version to be used for the websites on the account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.