Environment:
Server: Ubuntu Server 12.04 x64
Web Server: Apache 2
PHP: 5.3.10-1ubuntu3.8
Oracle: Instant Client 11.2
Problem:
I have a script that I am setting up as a cron job, but when it runs it produces
PHP Fatal error; Call to undefined function oci_connect() in /var/www/reports/inc/config.php on line 25
If I run this script or any other script using oci_connect or oci_pconnect through Apache, they work fine. I just migrated to a new machine and the script ran fine on the previous machine, but I cannot think of what I am missing.
Permissions on the script are the same as the config file and I have tried running as www-data, my user account, and root (all provide the same error).
When you use PHP from the shell or
crontab, you're using the CLI version, not the webserver version, and they usually have separatephp.inifiles. Edit/etc/php5/cli/php.iniand enable the OCI extension.