Skip to content

How to install multiple versions of PHP in Centos 7

So I installed CentOS 7 on my main home computer today, my baby. I’d run Windows at home on my main machine for most of my life, all of my professional life. I work with older PHP code often, so I can’t really have an ideal work environment without multiple versions of PHP on my machine. My main concern is actually being able to run PHP 5.3 for one of my more important ongoing projects. So here’s how I went about getting this setup. It turned out to be a bit trickier than I had expected.

I started with the obvious Google search, and ended up at this Stack Overflow question. PHPFarm seemed like a good solution. So I started.

PHPFarm installation went fine, and as expected. Tried to do my PHP 5.3.1 install, and it failed. The first errors were relating to a file called node.c, the last error was related to a file called node.lo and some XML related functions. So when you Google that, you’ll find lots of links to this URL: http://www.rasyid.net/2014/10/03/compile-php-5-2-17-using-phpfarm/. Which is kind of dealing with the same issue, but to me it came-off as a version-specific solution.

Turns out it’s not, and the URL referenced for the patch here https://mail.gnome.org/archives/xml/2012-August/msg00028.html solved the problem for me. In my instance I applied the patch to version 5.3.1 as per the instructions in the first link referenced above.

Now it all works as expected!

Also, if you get an error that resembles “error: xml2-config not found. Please check your libxml2 installation” while compiling, you’re likely missing the libxml2-devel package. On Centos/RHEL you can install it with ‘sudo yum install libxml2-devel’, or if you’re using a Debian/Ubuntu variant, you’d use ‘sudo apt-get install libxml2-dev’.

Spread The Love, Share Our Article

  • Delicious
  • Digg
  • Newsvine
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter

Related Posts

Comments

There are no comments on this entry.

Trackbacks

There are no trackbacks on this entry.

Add a Comment

Required

Required

Optional


framework-break