Good day! I'm trying to figure out how to run a script that contains work with Oracle CRON database.
The script itself works if run through the browser. Starting by setting the task in CRON and displaying its result - I got errors like
Fatal error: Call to undefined function ociconnect
The problem is that if the script works through Apache2, then everything is fine, without Apache's participation, no.
Tried to delete comments - unsuccessfully, before
; extension = php_oci8.dll
; extension = php_oci8_11.g.dll
At the moment, when working out the script in CRON, no information is written to the file at all. CRON logs are fine, everything runs without errors. It is impossible to overcome this problem the third day. I ask your advice!
Addition :
php -r 'phpinfo ();' | grep php.ini
Configuration File (php.ini) Path => /etc/php/7.0/cli Loaded Configuration File => /etc/php/7.0/cli/php.ini The value of the variable ORACLE_HOME is not empty
ORACLE_HOME = / usr / lib / oracle / 12.2 / client64
The LD_LIBRARY_PATH value for the root user is missing.
For user LD_LIBRARY_PATH = / usr / lib / oracle / 12.2 / client64 / lib
There is also a difficulty in the fact that in the CRON task there are already tasks that are being carried out. I am afraid that altering the global variable may disrupt their work.
LD_LIBRARY_PATHenvironmentLD_LIBRARY_PATHin the shell from which the script works and provide the same value in the task launched from cron (for example, setting the variable globally in the crown settings or making a bash script that sets it and calls the php script. It will also be useful to ensure the values of all variables environments starting withORACLE_, especiallyORACLE_HOME- Mikephp -r 'phpinfo();' | grep php.iniphp -r 'phpinfo();' | grep php.iniphp -r 'phpinfo();' | grep php.inito find out which php.ini is used for the console. - Ivan Bolnikh