Page 1 of 6

VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Sep 27, 2016 7:28 am
by ScIT
Better way to solve it: viewtopic.php?f=41&t=17129

Hi!

As already discussed in thread viewtopic.php?f=11&t=12691 and viewtopic.php?f=10&t=12734 I published "my" solution for VestaCP with MultiPHP and PHPBrew. The Solution is based on a little rewrite of the idea from Peter Anikin (http://anikin.pw/all/multiversionnost-p ... s-vestacp/).

You can find the guide on our GITLab Server: https://git.scit.ch/rs/VestaCP-MultiPHP

After installation you should be able to choose the different PHP Versions inside of VestaCP -> WEB -> Domain -> Web Template (Apache2):
Image

After that you have to rebuild the user with v-rebuild-user or inside of VestaCP Backend. Now you can use different PHP Versions for different Domains.

If you need to edit your php.ini file or include additional modules such as Ioncube you will find it under: /usr/local/php/php/php_x.x.x/etc/php.ini - after modification you don't need to restart Apache2, the change will be loaded directly with the next request over php cgi.

MultiPHP is tested on Ubuntu Server 14.04 LTS, maybe someone can try this on Debian and let us know if it works.

Best Regards
Raphael

Edit 2016-09-27: Modified Installation Guide and added setup informations for PHP 5.5 and 5.6.
I would suggest to switch base system to PHP 5.6, only 5.x version that is still supported (http://php.net/supported-versions.php) - then you can still switch to 5.4 or 5.3 if needed.

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Sep 27, 2016 5:44 pm
by skamasle
Will be nice do a script :)

And add php 5.5 and 5.6

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Sep 27, 2016 6:16 pm
by ScIT
skamasle wrote:Will be nice do a script :)

And add php 5.5 and 5.6
Script is not planed, compiling takes long and I think it's better to do this setup "step by step" for each server. If you have more then 4 or 5 VestaCP Server you can do a script by yourself.

PHP 5.5 and 5.6 is not a problem, our systems runs with PHP 5.6 thats because it is not listed. I've updated the Documentation to add the requested PHP 5.5 and 5.6 versions.

I would suggest to switch base system on PHP 5.6, only 5.x version that is supported (http://php.net/supported-versions.php). Then you can still switch to 5.4 or 5.3 if needed.

Best Regards
Raphael

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Thu Sep 29, 2016 6:09 am
by MaryGutierrez
Either rebuild the user with v-rebuild-user or inside of VestaCP Backend. Now you are able to use different PHP Versions for different Domains.

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Thu Sep 29, 2016 7:11 am
by ScIT
MaryGutierrez wrote:Either rebuild the user with v-rebuild-user or inside of VestaCP Backend. Now you are able to use different PHP Versions for different Domains.
Yep, like it's written in thread and guide :-). I'm glad that it works for you!

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Nov 08, 2016 7:17 pm
by pligin
[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: /root/.phpbrew/bashrc: line 17: syntax error near unexpected token `$'\r''
'bash: /root/.phpbrew/bashrc: line 17: `function __phpbrew_set_path()

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Nov 08, 2016 7:44 pm
by ScIT
pligin wrote:[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: /root/.phpbrew/bashrc: line 17: syntax error near unexpected token `$'\r''
'bash: /root/.phpbrew/bashrc: line 17: `function __phpbrew_set_path()
Please check your bashrc file on line 17, maybe it's a problem like here described: http://stackoverflow.com/questions/6473 ... token-in-r

If this does not resolv the problem, please post more information about your OS and VestaCP Version.

Thank you.

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Nov 08, 2016 8:50 pm
by pligin
Installed PHP 5.3
Don't work
Not Found

The requested URL /cgi-bin/php/phpinfo.php was not found on this server.

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Nov 08, 2016 9:19 pm
by ScIT
pligin wrote:Installed PHP 5.3
Don't work
Not Found

The requested URL /cgi-bin/php/phpinfo.php was not found on this server.
Do you have rebuilded your user? In VestaCP under User -> Rebuild or over command line v-rebuild-user username. If you follow the tutorial "step by step" it "have" to work :-).

Re: VestaCP MultiPHP (Debian/Ubuntu)

Posted: Tue Nov 08, 2016 9:27 pm
by pligin
ScIT wrote:
pligin wrote:Installed PHP 5.3
Don't work
Not Found

The requested URL /cgi-bin/php/phpinfo.php was not found on this server.
Do you have rebuilded your user? In VestaCP under User -> Rebuild or over command line v-rebuild-user username. If you follow the tutorial "step by step" it "have" to work :-).
Yes
I think this script is not working

Code: Select all

wrapper_script='#!/usr/local/php/php53/bin/php-cgi -c/usr/local/php/php53/etc/php.ini'
wrapper_file="/home/$user/web/$domain/cgi-bin/php"

echo "$wrapper_script" > $wrapper_file
chown $user:$user $wrapper_file
chmod -f 751 $wrapper_file
in the folder "home/$user/web/$domain/cgi-bin/php" does not create any files

P.S. nginx + apache2