Author Topic: PHP version on specific website (htaccess)  (Read 27054 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
PHP version on specific website (htaccess)
« on: August 07, 2016, 12:14:44 PM »
Hi everyone!

I need enable the php 7.0.9 only in one site. I am try to use this sintax below, but without success. When i put this commands in htaccess the PHP 7.20 DEV appears. How can i enable 7.0.9 version?

thanks!
AddHandler application/x-httpd-php7 .php
AddType application/x-httpd-php7 .php5 .php4 .php .php3 .php2 .phtml

Offline
*
Re: PHP version on specific website (htaccess)
« Reply #1 on: August 18, 2016, 12:15:25 AM »
It is a tricky thing to get PHP version working, I have been beating my head around for few days, but finally I have found a kind of workaround.
I was however not able to make a different version of PHP as default and I think the Menu Item PHP Version Switcher is pretty much useless, or at least for me it was, even after many attempts I was unable to get it working.

But here is how I got things working


1. Goto PHP -> PHP Selector


2. Click Install Dependencies

3. Select all the versions that you may want to use for some website and Hit Start Compiler
It will take some time to compile, you can see the progress by typing  tail -f /var/log/php-selector-rebuild.log in your SSH terminal. Once it is completed, You are ready for the next step.


4. ADD PHPx Handler through .htaccess file where you want to change PHP version, remember the version you want to use must be compiled first using the above method.

in my case I wanted to use PHP7 so here is what I added to my .htaccess
AddHandler application/x-httpd-php7 .php .php5 .php4 .php3

for me that was all I needed to do and I was able to use PHP 7 under this directory.

Go ahead try, I hope it will work, if doesn't post back. maybe someone can help.

Have a Nice Day
« Last Edit: August 18, 2016, 12:20:14 AM by waryah »

Offline
*
Re: PHP version on specific website (htaccess)
« Reply #2 on: August 18, 2016, 12:21:39 AM »
oh, and don't forget restarting apache for this to work

Offline
*
Re: PHP version on specific website (htaccess)
« Reply #3 on: August 25, 2016, 07:46:40 AM »
btw, what is different betwen
Code: [Select]
AddHandler application/x-httpd-php7 .php .php5 .php4 .php3 with
Code: [Select]
AddHandler application/x-httpd-php7

Offline
*
Re: PHP version on specific website (htaccess)
« Reply #4 on: August 26, 2016, 07:37:25 AM »
well, I am not some guru, myself am pretty much just-get-it-done-guy but I would say
Code: [Select]
AddHandler application/x-httpd-php7 .php .php5 .php4 .php3tells Apache whilch file types (identified by extension .php .php5 etc) to be treated as PHP Applications or applications/x-httpd-php7

the other one is possible an incomplete command

that's my guess until someone posts a better response

Offline
*
Re: PHP version on specific website (htaccess)
« Reply #5 on: September 21, 2016, 09:37:05 AM »
Hello Waryah, your config not running in my server CWP version: 0.9.8.54

i'm use script on .htaccess
AddHandler application/x-httpd-php7 .php .php5 .php4 .php3

but dont' work

or script
AddHandler application/x-httpd-php7 .php
don't work again.

but, in CWP version: 0.9.8.14 ago it's work.
there is something wrong ?

Thanks