PHPBrew on PHP workspaces

php

#1

The workspaces seem to come with nvm and rvm installed. Perhaps https://github.com/phpbrew/phpbrew should be installed as well. It is the leader in the equivalents among PHP as far as I can tell.

Anyway, I just installed phpbrew. Just follow the instructions:

curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew

I used sudo -s to create a new shell and do it because I’m still new to this, but it seems like you’re given root privileges anyway so that may not be necessary.


Use PHP7 in workspaces by default
#2

@jcrben: how do you setup PHP 7 after the third command? I’m not familiar with phpbrew. Thanks.


#3

You can use phpbrew on Cloud9. I found that the standard installation process works fine, just run the commands below.

We first install the libmcrypt-dev package to avoid running into dependency issues during build:

$ sudo apt-get update
$ sudo apt-get install libmcrypt-dev

Next, we download phpbrew and move it to /usr/local/bin:

$ curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
$ chmod +x phpbrew
$ sudo mv phpbrew /usr/local/bin/
$ phpbrew init

# add this to your ~/.bashrc
$ [[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc

$ phpbrew lookup-prefix ubuntu

Once set up, we install and load PHP 5.6:

$ phpbrew install 5.6 +default
$ phpbrew switch php-5.6.16
$ phpbrew use php-5.6.16
$ php -v
PHP 5.6.16 (cli) (built: Dec 29 2015 21:31:19) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

#4

@xoob Thanks! I was composing the exact same post.

I will share this repo (https://github.com/WebDevJL/CloudDeploymentManager) for a fast install of the useful stuff I use on C9 workspaces. Fork it first.

git clone https://github.com/WebDevJL/CloudDeploymentManager.git
sh CloudDeploymentManager/deploy.sh
#Install PHP 5.6.10 and set it as the version used.
sh CloudDeploymentManager/php-upgrade.sh

There is one manual input in your ~/.bashrc file during the deploy.sh execution.

You can tweak the version of PHP in php-upgrade.sh as you fancy .


Unable to start my apache after trying to upgrade php 5.6.34 version
#5

Thank you, the script works great!
Except, last line should include the version number

sh CloudDeploymentManager/php-upgrade.sh 5.6