How to enable extensions for oci8 (Oracle) in php.ini - PHP Warning: PHP Startup: in Unknown on line 0

55,468

Solution 1

[SOLVED]

I downloaded the Instant Client Package - Basic (version 10.2.0.5) and I extracted it.

Afterwards I copied all the files of that package in the following folders:

C:/wamp/bin/php/php5.4.16/ext/
C:/wamp/bin/apache/Apache2.4.4/bin

It worked for me in this way. After that the oci8 module was loaded.

Solution 2

When downloading the instantclient, verify that architecture have installed wamp.

In my case instantclient to download the x64 but had installed the x32 and had problems.

Downloaded the correct architecture and it worked fine.

Share:
55,468
programmer
Author by

programmer

Updated on July 21, 2020

Comments

  • programmer
    programmer almost 4 years

    I have Windows XP and recently I installed wamp (apache-mysql-php) 32-bit. I tested the installation (connect to mysql database with php and apache) and everything was working fine.

    Now i need to connect to an Oracle database so I tried to enable some extensions related to Oracle and oci8.

    And I did:

    1) I opened php.ini file and I removed the semicolons before the following lines:

    before:

    ;extension=php_oci8.dll
    ;extension=php_oci8_11g.dll
    

    after:

     extension=php_oci8.dll
     extension=php_oci8_11g.dll
    

    2) I restarted apache and all Services and i get a

    • "PHP StartUp" Warning.

    3) In php_error.log file I get:

     **PHP Warning:  PHP Startup:  in Unknown on line 0**
    

    So, i thought that it would be a good idea to check where my extension php folder is and if those dll files are there.

    In php.ini my extension folder is located at:

    extension_dir = "C:/wamp/bin/php/php5.4.16/ext/"
    

    The folder exists and both of these libraries (php_oci8.dll php_oci8_11g.dll) are inside that folder.

    4) I added in my 'Path' system variable in Windows the following:

    C:\wamp\bin\php\php5.4.16\ext;
    

    5) I copied both of these dll files in Apache's folder but again it didn't work!

    C:\wamp\bin\apache\Apache2.4.4\bin 
    

    6) Also, I checked the phpinfo page and the only entry I get for "oci8" is the following:

    Configure Command

     "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared"
    

    Hm...the following folders do not exist in my system:

    C:\php-sdk\oracle\instantclient10\sdk
    C:\php-sdk\oracle\instantclient11\sdk
    

    So, what am I supposed to do next in order to correctly enable the oci8 extensions?

    thanks

  • Yaroslav Shabalin
    Yaroslav Shabalin over 10 years
    You can extract .zip contents to any desired folder just add it to PATH environment variable.
  • Scott Chu
    Scott Chu over 8 years
    @Yaroslav: No! That won't work for Apache 2.4+PHP 5.5 64bit on Windows . I've tried that (Add instant client folder as 1st entry in PATH) and php_oci8.dll still causes the warning. Only copying all those files to apache/bin will make things work! Copying them to php/ext is not necessary!
  • hatmatbbat10
    hatmatbbat10 over 8 years
    @ScottChu solution solved it for me. I am using Apache 2.4+PHP 5.5 64bit on Windows and adding the instant client to the PATH variable did not work for me. However, copy the instant client contents into the root of the apache/bin folder worked for me.