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

#34

Thanks @elijahcruz12 your script worked without problems–made it so easy


#35

To fix the cURL version error you should try this comand :
sudo apt-get install libcurl4-gnutls-dev librtmp-dev
than
phpbrew install 7.0 +default

good luck


#36

This is the error i got:

  charlesderek:~ $ sudo apt-get install gcc make autoconf libc-dev pkg-config -y
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Note, selecting 'libc6-dev' instead of 'libc-dev'
    autoconf is already the newest version.
    gcc is already the newest version.
    gcc set to manually installed.
    make is already the newest version.
    make set to manually installed.
    pkg-config is already the newest version.
    pkg-config set to manually installed.
    The following package was automatically installed and is no longer required:
      libvpx1
    Use 'apt-get autoremove' to remove it.
    Suggested packages:
      glibc-doc glibc-doc:i386 locales:i386
    The following packages will be upgraded:
      libc-dev-bin libc6 libc6:i386 libc6-dbg libc6-dev
    5 upgraded, 0 newly installed, 0 to remove and 294 not upgraded.
    Need to get 14.2 MB of archives.
    After this operation, 1024 B of additional disk space will be used.
    Get:1 http://us-central1.gce.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libc-dev-bin amd64 2.19-0ubuntu6.14 [69.0 kB]
    Get:2 http://us-central1.gce.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libc6-dev amd64 2.19-0ubuntu6.14 [1913 kB]
    Get:3 http://us-central1.gce.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libc6-dbg amd64 2.19-0ubuntu6.14 [3464 kB]
    Get:4 http://us-central1.gce.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libc6 i386 2.19-0ubuntu6.14 [4015 kB]
    Get:5 http://us-central1.gce.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libc6 amd64 2.19-0ubuntu6.14 [4753 kB]
    Fetched 14.2 MB in 0s (18.1 MB/s)
    debconf: unable to initialize frontend: Dialog
    debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
    debconf: falling back to frontend: Readline
    Preconfiguring packages ...
    (Reading database ... 74278 files and directories currently installed.)
    Preparing to unpack .../libc-dev-bin_2.19-0ubuntu6.14_amd64.deb ...
    Unpacking libc-dev-bin (2.19-0ubuntu6.14) over (2.19-0ubuntu6.13) ...
    Preparing to unpack .../libc6-dev_2.19-0ubuntu6.14_amd64.deb ...
    Unpacking libc6-dev:amd64 (2.19-0ubuntu6.14) over (2.19-0ubuntu6.13) ...
    Preparing to unpack .../libc6-dbg_2.19-0ubuntu6.14_amd64.deb ...
    Unpacking libc6-dbg:amd64 (2.19-0ubuntu6.14) over (2.19-0ubuntu6.13) ...
    Preparing to unpack .../libc6_2.19-0ubuntu6.14_amd64.deb ...
    De-configuring libc6:i386 (2.19-0ubuntu6.13) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
    debconf: falling back to frontend: Readline
    Unpacking libc6:amd64 (2.19-0ubuntu6.14) over (2.19-0ubuntu6.13) ...
    Preparing to unpack .../libc6_2.19-0ubuntu6.14_i386.deb ...
    debconf: unable to initialize frontend: Dialog
    debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
    debconf: falling back to frontend: Readline
    Unpacking libc6:i386 (2.19-0ubuntu6.14) over (2.19-0ubuntu6.13) ...
    Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
    Setting up libc6:amd64 (2.19-0ubuntu6.14) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
    debconf: falling back to frontend: Readline
    Setting up libc6:i386 (2.19-0ubuntu6.14) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
    debconf: falling back to frontend: Readline
    Setting up libc-dev-bin (2.19-0ubuntu6.14) ...
    Setting up libc6-dev:amd64 (2.19-0ubuntu6.14) ...
    Setting up libc6-dbg:amd64 (2.19-0ubuntu6.14) ...
    Processing triggers for libc-bin (2.19-0ubuntu6.11) ...

charlesderek:~ $ sudo pecl install apcu -y

    Parse error: syntax error, unexpected 'new' (T_NEW) in /usr/share/php/PEAR/Frontend.php on line 91

#37

It seems the apache server runs currently as php7 but the last two steps also didn’t recognize after the error mentioned above?