How to upgrade a PHP workspace to version 7?



Is there a way to upgrade the php version from 5 to 7?


What have you tried already? It should would just like any other Linux box minus some low level hardware access.


i am fairly new to using linux boxes, so i am still learning how to do things? However, i have a mandate to learn to upgrade the php workspace from 5 to 7. If you have any resources to read and how to accomplish the task, i am happy to have them. :grinning:


I suggest trying to google-ing your question. You are not the first to ask how to upgrade a technology.

The first result for me after googling “how to update php on linux” is good stack exchange thread:
This link may not be for you, and if it is not, I suggest trying other links until you get it to work.

A general practice is to stick to official packages when upgrading theses types of technologies. Sometimes they are not available for your environment, sometimes they are. If they are not its generally because you are running “out of date” software, for example, google chrome only goes up to version 38 on Ubuntu 12. I had to upgrade to 14.04 to get chrome version support again.


After trying other guides I put this together, that works perfectly on C9.
Others were having issues around the envvar file.

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

Hope it helps!


thank you so much, @rcason This works perfectly on C9.


Hi. I’m having issues with xdebug after the steps above. Where you guys using it and did you notice any problems?


nope; i did once and it has been working like a charm. i am doing it again today and i will let you know.


Thanks a lot !! This works well !


Thanks rcason!! Works perfectly!!


That worked for me but I lost debugging which is not acceptable in my case (teaching students).
Anyone has got the debugger working ? I need php 7.0+ and debugging.


Perfect Solution! It also worked for me!


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


After following the steps above the c9 server doesn’t run. There’s no way to run the application?