How to upgrade to PHP7


#22

Thank you, I upgraded PHP5 to PHP7 with the help of your comment.


#23

This article is not ok, because apache still keeps using the older version of PHP


#24

This is what i get :

 $ phpbrew install 7.0 +default
===> phpbrew will now build 7.0.24
===> Loading and resolving variants...
Downloading http://www.php.net/get/php-7.0.24.tar.bz2/from/this/mirror via curl extension
[==================================================================] 184.00/184.00B 100%
Redirecting to http://php.net/get/php-7.0.24.tar.bz2/from/this/mirror
Redirecting to http://php.net/distributions/php-7.0.24.tar.bz2
[==================================================================] 13.95/13.95MB 100%
===> Extracting /home/ubuntu/.phpbrew/distfiles/php-7.0.24.tar.bz2 to /home/ubuntu/.phpbrew/build/tmp.1508371882/php-7.0.24
===> Moving /home/ubuntu/.phpbrew/build/tmp.1508371882/php-7.0.24 to /home/ubuntu/.phpbrew/build/php-7.0.24
===> Checking patches...
Checking patch for replace apache php module name with custom version name
===> Configuring 7.0.24...


Use tail command to see what's going on:
   $ tail -F /home/ubuntu/.phpbrew/build/php-7.0.24/build.log


Error: Configure failed:
The last 5 lines in the log file:
checking for cURL in multiarch path... not found

./configure: line 410: test: please: integer expression expected

configure: error: reinstall

./configure: line 299: return: please: numeric argument required

./configure: line 309: exit: please: numeric argument required

Please checkout the build log file for more details:
         tail /home/ubuntu/.phpbrew/build/php-7.0.24/build.log

#25

For anyone still needing to upgrade to PHP7. I wrote a bash script to make the process painless. Below is a link to the scripts GitHub page. All you need to do is run 3 commands in the terminal and you’re upgraded.

Cloud9-PHP7-Upgrade


#26

It would be great if you could make it update to PHP 7.2 :slight_smile: But this was awesome. Thank you.


#27

It would be great if you guys updated this for the latest version of PHP as this did not work for me.


#28

No promises, if I get some time I’ll give it a whirl. If you do it, please fork though github and do a pull request with the new code. So others can use it. Glad it helped none the less.

Ian


#29

To anyone who visits this nowadays, there is a script that will automatically do this for you. It is located Here.

It allows a faster way to update, and it requires 1 command.


#30

Thanks! I did find one very minor error that I opened an issue for, but it was easy to work around – after that, it worked like a charm and phpinfo(); confirms I’m on 7.0.28 now.:grinning:


#31

$ phpbrew list

  • (system)
    php-7.0.16
    php-5.6.30
    Adapt the remaining commands as appropriate i.e.

phpbrew switch php-7.0.16 phpbrew use php-7.0.16
$ php -v
PHP 7.0.16 (cli) (built: Jun 5 2017 06:03:59) ( NTS )
Copyright © 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright © 1998-2017


#32

I can’t figure out why when I try to upgrade from php 5.6 to php 7 with a Wordpress install – Wordpress won’t recognize the upgrade.

I have done it before on C9 and it worked fine. But now it’s not working. WHen i do php -v it says 7 but when i do php info it says different.

Please assist. This is what worked before:

sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y

sudo apt-get install php7.0-curl php7.0-cli php7.0-dev php7.0-gd php7.0-intl php7.0-mcrypt php7.0-json php7.0-mysql php7.0-opcache php7.0-bcmath php7.0-mbstring php7.0-soap php7.0-xml php7.0-zip -y

sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak
sudo apt-get remove libapache2-mod-php5 -y
sudo apt-get install libapache2-mod-php7.0 -y
sudo cp /etc/apache2/envvars.bak /etc/apache2/envvars

find out what version of php
php --version


#33

I’m stuck at the $ phpbrew install 7.0 +default command. Returning the following error:

Error: Configure failed:
The last 5 lines in the log file:
checking for cURL in default path... not found

checking for cURL in multiarch path... not found

./configure: line 23550: curl-dir: No such file or directory

checking for cURL 7.10.5 or greater... ./configure: line 23565: curl-config: command not found

configure: error: cURL version 7.10.5 or later is required to compile php with cURL support

Please checkout the build log file for more details:
         tail /home/ubuntu/.phpbrew/build/php-7.0.30/build.log