3

I recently installed and enabled oci8 extension for PHP 5.6 and using Apache 2.4.10 on CentOS 6.4 64-bit, using httpd, httpd-devel, php56w-* and mysql. I used the latest Instant Client at the time (12.1) and followed the instruction on Oracle website, used both pecl install oci8 and phpize options on installing oci8 2.0.8, setting environment variables for both shell and Apache, mentioning modules/oci8.so in php.d/oci8.ini.

The problem is, I can call oci_connect() by using php in terminal like php oci_test.php, it works fine, but when I try running it from a browser, it returns Fatal error: Call to undefined function oci_connect(). I have already read this solution but it didn't work, and both LD_LIBRARY_PATH and ORACLE_HOME are set correctly in both shell and httpd and php. (I intend to use yajra's work on oci for laravel so it doesn't use connection strings and generate it dynamically, so it doesn't need TNS_ADMIN or any .ora files)

It just works fine on my other Environment which is an XAMPP controller based Apache on Windows, manually upgraded to Apache 2.4.10 (64 ts vc11) and PHP 5.6 (64) using php_oci8_12c.dll provided by oracle.

Community
  • 1
  • 1
Tala
  • 909
  • 10
  • 29
  • Is _OCI_ visible in the output of `php_info` when executed from Apache? Is the "PHP" you use from the command line the "same" as the one used by Apache (more formally: do you run PHP as a module, or as a CGI?) – Sylvain Leroux Oct 02 '14 at 17:45
  • @SylvainLeroux it is not shown in php_info from apache, but is shown by php -i. I have this list for my find / -name php: /usr/include/php; /usr/include/php-zts/php; /usr/lib64/php; /usr/share/php; /usr/share/swig/1.3.40/php; /usr/bin/php; /var/lib/php; /root/php-5.6.0/sapi/cli/php; I am not sure which one is linked in bin – Tala Oct 02 '14 at 17:57
  • 1
    I can't help you much on this issue. But have you checked apache `error_log` ? Where is installed your module (oci8.so) ? Have you checked the permissions (as Apache is probably running as _www_ or _nobody_)? – Sylvain Leroux Oct 02 '14 at 18:11
  • 1
    @Cunning If you can't see it when you visit the page with ` – cwallenpoole Oct 02 '14 at 18:15
  • @SylvainLeroux Thanks! I found it `PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/oci8.so' - libclntsh.so.12.1: cannot enable executable stack as shared object requires: Permission denied in Unknown on line 0` but I don't know who should I give what permission! – Tala Oct 02 '14 at 18:45
  • Thanks you @SylvainLeroux The problem was with SELinux. I disabled it and it works just fine! By the way, if you could form an answer so I could mark it as an answer that'd be great. – Tala Oct 02 '14 at 19:25
  • Thank you @cwallenpoole! The problem was the security settings of Linux. – Tala Oct 02 '14 at 19:26

0 Answers0