I need to compile PHP 7.4 on AlmaLinux 9 with PostgreSQL module support. openssl-devel (3.0) RPM is required by mysql-devel and PHP 7.4 doesn’t compile with OpenSSL 3. So I have compiled OpenSSL 1.1 from source and installed it in its default prefix path : /usr/local.
So PHP 7.4 compiles fine this way :
$ cd php-7.4.33
$ ./configure PKG_CONFIG_PATH='/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig' OPENSSL_LIBS="-L/usr/local/lib64/ -lssl -lcrypto" --with-apxs2 --with-pgsql --with-external-pcre --enable-mbstring --sysconfdir=/etc --with-config-file-path=/etc --enable-pdo --with-pdo-pgsql --with-zlib --with-zip --with-jpeg --with-pear --with-curl --enable-opcache --with-openssl --with-freetype --with-xpm --with-libdir=lib64 --with-ldap --with-mysqli --with-pdo-mysql --enable-soap --enable-gd --without-sqlite3 --without-pdo-sqlite --with-curl
$ make -j $(nproc)
I got this warning :
/usr/bin/ld: ext/openssl/.libs/openssl.o: in function `php_openssl_load_cipher_mode':
php-7.4.33/ext/openssl/openssl.c:6499: undefined reference to `EVP_CIPHER_flags'
The problem is that libpq.so depends on libssl.so.3 and PHP on libssl.so.1.1, so ld.so must load two versions of the same SO :
$ ldd sapi/cli/php | egrep "ssl|crypto|pq"
libpq.so.5 => /lib64/libpq.so.5
libssl.so.1.1 => /usr/local/lib64/libssl.so.1.1
libcrypto.so.1.1 => /usr/local/lib64/libcrypto.so.1.1
libssl.so.3 => /lib64/libssl.so.3
libcrypto.so.3 => /lib64/libcrypto.so.3
$ ldd /usr/lib64/libpq.so
libssl.so.3 => /lib64/libssl.so.3
libcrypto.so.3 => /lib64/libcrypto.so.3
My question is, what ls.so will do if objects of the same name exist in these two SO files (libssl.so.1.1 and libssl.so.3) ? php-cli seems to work but I’ve not tested PostgreSQL connexion yet.
Many thanks