1

I am working on Linux Mint. I installed Apache, MySQL, PHP for Laravel and Oracle 11g Express edition. Then to connect Laravel to Oracle I found this on GitHub.

I did everything according to the documentation there. Then while I run php artisan migrate returns me

[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined function Yajra\Pdo\oci_connect()

After that I searched on but failed to get anything that work for me. Got two questions with same problem on Stackoverflow not answered yet. From GitHub issue tab, someone told to active a comment in php.ini file. But there are no such thing in my php.ini file.

halfer
  • 19,824
  • 17
  • 99
  • 186
Shafi
  • 1,850
  • 3
  • 22
  • 44
  • Downvoted for undoing a perfectly good edit. Please do not roll back improvement edits, unless they change the meaning of your post. – halfer Jan 15 '16 at 23:40

1 Answers1

2

It sounds like you don't have oci8 extension installed. You'll need to get Oracle Instant Client basic and sdk zip packages, unpack them to the same directory, create symbolic links

sudo ln -s libclntsh.so.* libclntsh.so
sudo ln -s libocci.so.* libocci.so

Then do pecl install oci8, and provide it with the directory path where you have unpacked the instant client to. It'll compile OCI8 extension on your machine. When it compiles correctly, enable the extension in php.ini:

echo "; configuration for php oci8 module" | sudo tee /etc/php5/conf.d/oci8.ini
echo extension=oci8.so | sudo tee -a /etc/php5/conf.d/oci8.ini

and restart apache. See also this answer, official oracle manual, official php manual or google "linux oci8 pecl howto" for multiple detailed manuals.

Community
  • 1
  • 1
Timekiller
  • 2,946
  • 2
  • 16
  • 16
  • Not working. `pecl install oci8` returns installation fail. And says php 7.0.0 or higher is required. I have php5 installed. What to do then? – Shafi Dec 19 '15 at 17:45
  • Try `pecl install oci8-2.0.10` – Timekiller Dec 19 '15 at 17:50
  • Now it returns `No releases available for package "pecl.php.net/oci8" install failed` – Shafi Dec 19 '15 at 17:57
  • 1
    Are you behind a proxy? If yes, see http://stackoverflow.com/a/33266364/1375470 - otherwise, try `pecl -vvv install oci8-2.0.10` to force verbosity. – Timekiller Dec 19 '15 at 18:15
  • Still oci8-2.0.10 is not found. :/ – Shafi Dec 19 '15 at 19:11
  • 2
    @MASh You were supposed to look at the output of `-vvv` to see what causes the error... Either way, you can go to https://pecl.php.net/package/oci8, download oci8-2.0.10.tgz manually and run `pear install oci8-2.0.10.tgz` – Timekiller Dec 19 '15 at 19:35
  • Great! Just a way behind I think. Found this at the end of the output after giving the path. `checking Oracle Instant Client SDK header directory... configure: error: Oracle Instant Client SDK header files not found` ERROR: `/tmp/pear/temp/oci8/configure --with-oci8=instantclient,/path/to/instant/client/lib' failed ` – Shafi Dec 19 '15 at 19:46
  • ...You're supposed to replace `/path/to/instant/client/lib` with an actual path where you unpacked instant client archives. It outright says that in the error. – Timekiller Dec 19 '15 at 19:49
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/98440/discussion-between-mash-and-timekiller). – Shafi Dec 19 '15 at 19:52