PHP7 on a VCCW vagrant environment with CentOS 6.x

When PHP7 first came across my eyes, I was sitting in a talk held by Zeev Suraski in Seville at WordCamp Europe 2015, who was clearly a proud father looking at his newborn child with such an enthusiasm, I just wanted to grab my laptop and try it myself. He talked about how much faster PHP7 was and I just couldn’t believe it.

Well, some months forward, here I am, installing PHP7 around all the websites we host for us and our clients, all WordPress instances have it now, and boy, it is fast. It’s so fast it resembles a local instalment. Well, the question then is, how much faster is it on a local development environment? My answer: see it for yourself!

If you don’t know VCCW, head over here and get yourself busy for 15 minutes. Then come back.

When you’re done, you have change the way you’ve develop WordPress sites. You might even ask yourself, what the hack was I doing until now. Ok, so, you’re already excited, and want to know, how you can get PHP7 running on this vagrant installation? Are all my plugins and themes work on PHP7? Well, the answer is right here, or a few minutes away. And the steps are very easy.

Step 1 – SSH access

ssh into your vagrant by typing the following command in an OSX terminal window inside your vagrant folder:

vagrant ssh

If it isn’t up, do a vagrant up first and than vagrant ssh.

Step 2 – Uninstall PHP5

Multiple versions of PHP cannot coexist. If you really need to try it first, well, copy paste your vagrant folder and do it in a parallel setup. To uninstall PHP5, type the following:

sudo yum remove php-common-5.4.45-3.el6.remi.i686

Say yes (y) to every question asked and you’re done. Note that the version number might be a little different, if so, do steps 3 and 4, and during step for you’ll get an error stating conflicting packages, there you can get the complete name of your PHP5 package you need to uninstall.

Step 3 – Add a yum repository containing PHP7

You could go ahead and build PHP7 out of source code, but hey, there are smart people who done that already, never mind the job. Add this repository to yum by typing the following:

sudo rpm -Uvh

Step 4 – Install PHP7

This is it. Install PHP7 by typing:

sudo yum install php70w php70w-opcache php70w-mysql php70w-xml php70w-soap php70w-xmlrpc php70w-mbstring php70w-json php70w-gd php70w-mcrypt

Say yes to everything once again and, voilá! PHP7 is installed. You don’t believe it? Type php -v and hit enter and see it for yourself. Now go to WordPress, login into the back office and browse around. Super fast, hu?

This is really interesting, how much faster a WordPress or any php website can benefit from PHP7. And also all the REST API plugins we’re developing for our mobile projects benefit from this. What is curious to me is why anyone hasn’t explored this more yet. Why isn’t everybody exited about this? Why isn’t everybody writing about PHP7 and WordPress? Am I missing something?

Please go ahead and ask questions or comment on this matter bellow. I’ll be most glad to help you out!