Issues compiling PHP dependencies

I decided to update PHP, and had a few problems compiling its dependencies. So I thought I’d share the problems I had and the solutions here for future reference, and maybe they might help someone else as well.

The first issue I had was that CURL wouldn’t configure with SSL support. The problem turned out to be because openssl was compiled with static libs only. To fix this, you can either prepend LIBS="-ldl" in front of the ./configure command when configuring CURL. Alternatively (and probably the better solution) is to ensure openssl is compiled with the shared option.

The second issue I had was that icu4c wouldn’t compile. The answer here was that I had unzipped the icu4c files to the same folder that I had previously unzipped an older version of icu4c to. So there was a mix of the old files and the new ones, causing problems. So, I need to remember to clear out my build dirs after building successfully (or before starting a new compile).

The other thing you can do to ensure you don’t have this problem, is to make sure you always extract the source files into a directory that includes the version number. Most software comes this way anyway, but icu4c extracts to just a ‘icu’ directory. So my process for downloading and extracting icu4c now looks like this:

ICU4C='icu4c-56.1'
wget http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.tgz -O $ICU4C.tgz
mkdir $ICU4C
tar xvfz $ICU4C.tgz -C ./$ICU4C --strip-components=1
cd $ICU4C/source

The third issue I had was that when I tried compiling PHP it failed, complaining that it couldn’t find buffio.h. Thankfully the error message was pretty clear as to where it was expecting to find this file – in the tidy lib dir. It seems that tidy-html5 doesn’t have a buffio.h file, instead it has tidybuffio.h. So we can just symlink buffio.h to tidybuffio.h, and that fixes the problem.

Alternatively, you can modify the PHP source to change the reference to tidybuffio.h there. A quick sed one liner to do that can be found here: Install PHP 5.6.12 with tidy-html5.

Posted on by xoogu, last updated

Leave a Reply