Before you continue...
Do you want an easier way of updating your server to PHP 7.2? We have created a one-line command to do this for you! All you need to do is click the link below to view it!
Your welcome! ❤❤
The newest version of Laravel now needs PHP 7.2, which unfortuately is not what we get when we use a one-click LAMP droplet from the Digitalocean service. But luckily, its super easy to upgrade your server to this version.
Please make sure you make backups before you run any commands! Doing this from start to finish usually takes about 3 minutes.
Add Ondrejs PPA Repo
PPA's or Personal Package Archive, is a collection of software not included in Ubuntu by default. Typically these repositories focus on a single program, but they can include more depending on the person maintaining them. Ondřej Surý has created this PPA which has the latest versions of PHP in it. Lets add it to your system, and update to get a list of all the software we can install.
$ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update
Remove PHP 7.0
Its easy to remove our old version of PHP - just run these commands:
$ sudo apt-get purge php7.0 php7.0-common
Once your system has removed PHP 7.0 - it will replace it with PHP 7.2
Other PHP Packages
To install Laravel, we also need other packages - run this command to install:
$ sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring
Lets finish by restarting our server!
$ sudo shutdown -r now
Once we get back into your server - check what version of PHP is now on your server. After doing this on mine - I get:
PHP 7.2.2-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb 1 2018 16:01:26) ( NTS )
If you liked this article, or it helped you at all - follow me on Twitter at https://twitter.com/JakeLPrice