But the Loader will alway prefer the libcurl.so.4 found under /usr/lib64 to the one under /usr/curl_openssl1/lib. It seems having two libcurls with the same version number linked to different openssl version is not an option.
Doesn't -Wl,-rpath=/usr/... (in LD_FLAGS) cause the runtime linker to prefer that directory over /usr/lib64 when searching for the dependent libs? For example:
$ readelf -d /usr/local/bin/php-cgi | grep RPATH
0x000000000000000f (RPATH) Library rpath: [/usr/local/lib64]
$ ldd /usr/local/bin/php-cgi | grep libcurl
libcurl.so.4 => /usr/local/lib64/libcurl.so.4 (0x00007facbfcf9000)
$ readelf -d /usr/local/lib64/libcurl.so.4 | grep RPATH
0x000000000000000f (RPATH) Library rpath: [/usr/local/openssl3/lib64]
$ ldd /usr/local/lib64/libcurl.so.4 | grep libcrypto
libcrypto.so.3 => /usr/local/openssl3/lib64/libcrypto.so.3 (0x00007f0ed16f3000)
Tom.III