Finally, I manage to use LD_PRELOAD to load the specific .so library inside mod_fcgid wrapper scripts.
It is working now.
I manage to run PHP 4.4 , 5.2 , 5.3 , 5.4 , 5.5 , 5.6 , 7.x inside CentOS 8,
whereas PHP 4 and PHP 5.x are using MariaDB 10.1 client library (installed in separate folder).
The host is running MariaDB 10.4 client and server library.
LD_PRELOAD=/usr/local/xxx/curl/lib/libcurl.so
export LD_PRELOAD
exec /usr/local/php53/bin/php-cgi53 ${OPTIONS}
It is working now.
I manage to run PHP 4.4 , 5.2 , 5.3 , 5.4 , 5.5 , 5.6 , 7.x inside CentOS 8,
whereas PHP 4 and PHP 5.x are using MariaDB 10.1 client library (installed in separate folder).
The host is running MariaDB 10.4 client and server library.