yajra / laravel-oci8

Oracle DB driver for Laravel via OCI8
https://yajrabox.com/docs/laravel-oci8
MIT License
829 stars 237 forks source link

Migrate command working but error "Call to undefined function Yajra\Pdo\oci_connect()" on browser. #190

Closed chrislandeza closed 8 years ago

chrislandeza commented 8 years ago

Hi guys, please help me with my production server. I did php artisan migrate:refresh --seed on our linux server and I was able to see the result (tables, data etc.) on my sqldeveloper successfully, but when I try to visit the app on the browser I'm getting this error: Call to undefined function Yajra\Pdo\oci_connect()

We followed this tutorial on how to enable Oci8 on linux machine http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

We now have Oracle libraries in /usr/lib/oracle/11.2/client64/lib /usr/include/oracle/12.1/client64

and enable the PHP OCI8 extension by editing /etc/php.ini and adding extension=oci8.so

Other details: Distributor ID: CentOS Description: CentOS release 6.7 (Final) Release:6.7

.env fle: DB_CONNECTION=oracle DB_HOST=192.168.137.162 DB_PORT=1521 DB_DATABASE=QCSIM3 DB_USERNAME=MMUCI DB_PASSWORD=mypassword

yajra commented 8 years ago

@chrislandeza make sure you have oci8 extension enabled on CLI config too. Sorry for delayed response.

--Edit-- Oh I think it's the other way around. Anyways, some php installations have 2 config for cli and apache/fpm.

chrislandeza commented 8 years ago

@yajra - No problem sir. Managed to fix this by following this thread: http://stackoverflow.com/questions/5225236/oci8-extensions-load-in-cli-but-not-browser

Re. SELinux and OCI8 when running as an Apache module

Suggested solution from http://old.nabble.com/php-with-oci8-td16460446.html you can customize your policy to allow this access using audit2allow

#grep http /var/log/audit/audit.log | audit2allow -M myhttp 
#semodule -i myhttp.pp 

This should allow you to run these oracle apps with SELinux in enforcing mode. There's also a thread about this on the oracle forums