2

we are in need of a PHP5.3 installation on our Ubuntu 16.04 server for a legacy 3rd party application we are about to replace, but we still need around for some time.

Therefore I compiled PHP5.3.29 with FPM to get it to work with our Nginx Stack. However, I am struggling with compiling OpenSSL into PHP. So here is what I did so far:

Using the system installation of OpenSSL (v 1.0.1j)

Trying to compile PHP with --with-openssl fails with the following error while running make:

/usr/bin/ld: ext/openssl/openssl.o: undefined reference to symbol 'SSL_get_verify_result@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:267: recipe for target 'sapi/fpm/php-fpm' failed

So I searched the web to find a fix for this error, but wasn't really successful with the ones that I was able to find. However one post I came across mentioned that by using an older version of OpenSSL the problem could be circumvented. So thats what I tried.

Using self compiled old version of OpenSSL (v 0.9.8w)

I compiled OpenSSL with the flag --prefix=/opt/openssl to make sure it doesn't interfere with the systems installation of OpenSSL. After that I tried to compile PHP again using --with-openssl=/opt/openssl and went trough smoothly.

However, after running some tests using the app that required PHP 5.3 I quickly started seeing the FPM-Child that was serving my request segfaulting when using cURL-Requests with https urls. So I debugged the faulty child and was able to trace the cause down to OpenSSL. OK - what to do now?

Compiling PHP without OpenSSL at all

So I decided to omit the OpenSSL extension completely and was actually successful in both compiling (no surprise here) and also requesting https urls through curl using the PHP installation I've just compiled. All good I thought, but it wasn't (no surprise as well): After running the app for a while it turned out that it makes extensive use of file_get_contents() calls in combination with https urls. These all fail because PHP is lacking https stream support because of the missing OpenSSL extension.

So here I am not knowing what to do next and I hope you could give me a nudge in the right direction.

Just FYI here's the config I used for compilation (with varying values for the --with-openssl param):

./configure \
--prefix=/usr/local/php5.3 \
--with-config-file-path=/etc/php/5.3 \
--with-mysql \
--with-mysqli=mysqlnd \
--with-jpeg-dir=/usr/lib/x86_64-linux-gnu/ \
--with-png-dir=/usr \
--with-gd \
--enable-soap \
--enable-bcmath \
--enable-mbstring \
--with-curl \
--with-openssl=/opt/openssl
--with-zlib=/usr \
--enable-ftp \
--enable-zip \
--with-mcrypt \
--enable-pdo --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd \
--enable-fpm

Thanks a mil!

1 Answers1

1

Here are my notes from when I did this:

Step 1 - build php - to be executed where you un-tarred php (perhaps [homedir]/software/php5329), so it can install to [homedir]/usr/php5329

· PHP build compile configure - ./configure --prefix=[homedir]/usr/php5329 --with-snmp --with-mysql=/usr/phab/mysql/bin --with-libdir=lib64  --with-pdo-mysql=/usr/phab/mysql/ --with-pear=[homedir]/usr/php5329 --with-config-file-path=[homedir]/usr/php5329; make clean ; make -j 32 ; make install 

Step 2 - build libssh - to be executed where you un-tarred libssh-1.7.0 (perhaps [homedir]/software/libssh-1.7.0), so it can install to [homedir]/usr/libssh2

· Libssh2 - ./configure --prefix=[homedir]/usr/libssh2-1.7.0 ; make clean ; make -j 50 ; make install 

Step 3 - set up php-ssl bridge whose sources are in [homedir]/software/ssh-0.12

· PHP-SSL bridge - phpize534 ; ./configure --with-ssh2=[homedir]/usr/libssh2-1.7.0 --with-php-config=[path to new php-config]/php-config ; make clean ; make -j 50 ; make install