1

I am trying to configure laravel to work with oracle database, I am trying to use Yajra for my connection but I get this error every time I try to run my application.

FatalThrowableError in Oci8.php line 449: Fatal error: Call to undefined function Yajra\Pdo\oci_connect()

If anyone can help me fix this i will be extremely grateful...

1 Answer 1

1

It because your php do not support oci8!

if you use Windows:

Download instantclient-basic-windows from here Ccreate folder

cd E:/wamp64/bin
mkdir oracle

Move downloaded instantclient package into /oracle

mv instantclient-* E:/wamp64/bin/oracle
unzip instantclient-basic-windows.x64-12.1.0.2.0.zip

Add instantclient_xx to your Path and Edit php.ini

Uncomment them

extension=php_oci8_12c.dll
extension=php_odbc.dll

restart your wamp you'll see the oci8

<?
  phpinfo().

if you use Linux:

Download instantclient-basic-linux and instantclient-sdk-linux from here, and unzip it in a dir.

mkdir /opt/oracle
mv instantclient-* /opt/oracle
unzip instantclient-basic-linux-x86-64-11.2.0.2.0
unzip instantclient-sdk-linux-x86-64-11.2.0.2.0

mv instantclient_11_2 instantclient
cd /opt
chown -R root:www-data /opt/oracle
echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient
ldconfig


cd /opt/oracle/instantclient
ln -s libclntsh.so.* libclntsh.so
ln -s libocci.so.* libocci.so

you neet to input 'instantclient,/opt/oracle/instantclient'

pecl install oci8

after finish.check if you have pci8.so in directory like /usr/lib/php/20151012

cd /etc/php/7.0/mods-available/
vi oci.ini // extension=oci8.so
cd /etc/php/7.0/fpm/conf.d/
ln -s /etc/php/7.0/mods-available/oci.ini 20-oci.ini

append path

vi /etc/environment
# append
export LD_LIBRARY_PATH="/opt/oracle/instantclient"
export TNS_ADMIN="/opt/oracle/instantclient"
export ORACLE_BASE="/opt/oracle/instantclient"
export ORACLE_HOME=$ORACLE_BASE 

Finally

service php7.0-fpm restart
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.