1

A Debian server has a standard systemd service unit installed: phpsessionclean. It is called every 30', invoking the shell script /usr/lib/php/sessionclean, which in turn invokes a small inline php script, using the cli SAPI. This execution issues the following warning every 30':

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/oci8.so' - libmql1.so: cannot open shared object file: No such file or directory in Unknown on line 0

Besides, no such warnings are issued when it is a cron job that invokes php scripts in general.

I can confirm the oci8 module is loaded when I run php -c <path to INI file> -m | grep oci8. I tried to set LD_LIBRARY_PATH and ORACLE_HOME to the relevant path inside /usr/lib/php/sessionclean, but that wouldn't do. However, I used to obtain equivalent warnings, even through crontab jobs, at the time when I hadn't set these environment variables at the top of the crontab. This to say that it looks like the Oracle environment is not loaded when the PHP script is run from the systemd mechanism.

My question: how to make the systemd-invoked PHP script aware of the Oracle environment?

1

As suggested my Mark Stosberg, I added that unique line

Environment="LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2" "ORACLE_HOME=/opt/oracle/instantclient_12_2"

to /lib/systemd/system/phpsessionclean.service, in the [Service] section, then reloaded the service: systemctl reload phpsessionclean. The subsequent runs did not generate the warning seen before. I suppose that only one of the two variables defined there is necessary, but I haven't got time to conduct the experiment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.