I have a local machine with
- Oracle Linux 7
- Oracle XE 18c (needs max InstantClient 18.5)
- httpd with PHP7.4
I had to downgrade the installed Oracle InstantClient (from 19.x to 18.5) in order to be able to install Oracle XE 18c.
Database was then created, and filled with the basic data needed to run my local website. But I still needed the PECL oci8 for it to connect with the DB. I installed that, everything worked fine.
Then I powered my machine off.
This morning, I changed some data using both sqldeveloper and sqlplus. No problem with that, either.
Then I tried to use my website again, and it couldn't connect to the DB. A look at the error log and some further analysis and reconstruction of what I've done since it worked last made me check if php was running, using php -v.
It returned the following message:
PHP Warning: PHP Startup: Unable to load dynamic library 'oci8.so' (tried: /usr/lib64/php/modules/oci8.so (libclntsh.so.19.1: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/oci8.so.so (/usr/lib64/php/modules/oci8.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_oci.so' (tried: /usr/lib64/php/modules/pdo_oci.so (libclntsh.so.19.1: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_oci.so.so (/usr/lib64/php/modules/pdo_oci.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.28 (cli) (built: Feb 17 2022 21:07:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
I uninstalled an reinstalled the whole PHP stuff, making sure the second install has only the right versions. But I still get the same result.
Both oci8.so and pdo_oci.so do exist in the mentioned folders.
libclntsh.so.19.1 was missing before, that's true.
After reinstalling everything, it was there, but marked as "broken link" (/lib).
How can I fix this?
If you need more information, I'll be glad to provide it.
Thanks!
My Answer:
a broken link. This means that the library file libclntsh.so.19.1 is either not present in the specified location or it is not accessible by the PHP modules oci8.so and pdo_oci.so.
To fix this issue, you can try the following steps:
1. Check the actual location of the libclntsh.so.19.1 file on your system. Make sure it is present and accessible by the PHP modules.
2. Update the LD_LIBRARY_PATH environment variable to include the directory where libclntsh.so.19.1 is located. You can do this by adding the following line to your ~/.bashrc file:
export LD_LIBRARY_PATH=/path/to/directory:$LD_LIBRARY_PATH
Replace /path/to/directory with the actual path to the directory containing libclntsh.so.19.1.
3. Restart your Apache web server and PHP-FPM service after making these changes to ensure they take effect.
4. Verify that the PHP modules oci8.so and pdo_oci.so are correctly configured to load the libclntsh.so.19.1 library file. You can do this by checking the configuration files in the /etc/php.d/ directory.
5. If the issue persists, you may need to recompile the PHP modules oci8 and pdo_oci with the correct version of the Oracle InstantClient libraries.
By following these steps, you should be able to resolve the broken link issue and successfully connect to your Oracle database from your PHP application.
Rate this post
5 of 5 based on 8927 votesComments