Enabling Old Codeigniter with phpbrew

So I was checking my old production sites that uses codeigniters using version 2.0.2 (OMG) has this common error, because by now i'm using php7.* and here are the errors. It seems that this will not work for laravel old version.

A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 243

Instead of fixing the code entirely on the core system on the codeigniter or maybe upgrade the code, it's a bit of hassle by doing this.

My solution was using phpbrew, so the system PHP is 7.2 but the code is runing on 5.5.38 tried on 5.6.38 still shows error. Because of ubuntu php 7.2 openssl is not compatible with php lesser than 7 decided that to make it work decided not to add variant openssl like the command below

PHP 7.0.30

sudo apt-get update
sudo apt-get install php7.0 php7.0-curl php7.0-json php7.0-cgi
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-intl
sudo apt-get install php7.0-xsl

sudo apt-get install php7.0-fpm autoconf automake libxml2-dev libcurl4-openssl-dev libssl-dev openssl gettext libicu-dev libmcrypt-dev libmcrypt4 libbz2-dev libreadline-dev gettext build-essential libmhash-dev libmhash2 libicu-dev libxslt-dev
phpbrew install php-7.0.9 +default+mcrypt+zlib+sockets+soap+mhash+fpm+openssl+mysql+gd

PHP 5.6.36

apt-get install -y
autoconf automake curl libcurl3-openssl-dev build-essential libxslt1-dev
re2c libxml2 libxml2-dev bison libbz2-dev libreadline-dev
libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev
libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev
libmhash-dev libmhash2 libssl-dev openssl
gettext libgettextpo-dev libgettextpo0
libmcrypt-dev libmcrypt4 libicu-dev

phpbrew install php-5.6.38 +dbs +mb +default +gd +fpm -pgsql -openssl

phpbrew install php-5.5.38 +dbs +mb +default +gd +fpm -pgsql -openssl

Now my server are ready to migrate to a different server that uses 7.2 and phpbrew php 5 below.


phpbrew use php-5* invalid argument

source ~/.phpbrew/bashrc

how to check fpm running

ps aux | grep php-fpm

Switching fastCGI to phpbrew

Ex ~/.phpbrew/php/php-5.6.3/etc/php-fpm.conf

listen =
user = nobody -> www-data
group = nobody -> www-data

then in nginx conf

fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;


ubuntu phpbrew 7.2 imagecreatefromjpeg intervention nginx

Storage::put($prePath, $image_small->stream()->detach(), 'public');

phpbrew gd ubuntu

phpbrew ext install gd
-- --with-libdir=lib/i386-linux-gnu

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]