Mobile app version of vmapp.org
Login or Join
Moriarity557

: How can you use Apache .htaccess to specify the location of the PHP binary on shared hosting? I'm using shared hosting, can create .htaccess and php.ini and have access to ssh. I have PHP 5.6

@Moriarity557

Posted in: #Apache #Apache2 #Htaccess #Php

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.?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Moriarity557

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme