PHP Warning at startup while trying to load php_oci8.dll - php

I'm using XAMPP and trying to configure Oracle connection for sql.
I uncommented the line extension=php_oci8.dll and at first it ended up with an error (that oci.dll is missing), but later I downloaded instantclient from Oracle web pages. I tried with versions 10.2, 11.2, and 12.1 but neither worked. Obviously I've added the path to those libraries to my PATH env variable.
The warning I'm getting at the startup of Apache is: PHP Warning: PHP Startup: in Unknown on line 0
The error when I'm trying to connect is: PHP Fatal error: Call to undefined function oci_connect() in ...
I've tried with php_oci8.dll and php_oci8_11g.dll. Those files are in my php/ext directory (they were included in xampp), my instantclient is added to PATH and the warning doesn't show up if I disable those modules. I've tried restarting services and computer.
Can you help me find a solution how to configure it correctly? I'm using Windows 8.1 with administrative privileges.
BTW. My phpinfo() says that OCI8 is activated (but functions like oci_connect still don't work).
EDIT: When I tried running PHP manually I finally got the error to display what was wrong: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application. in Unknown on line 0 Can you help me find out where can I download a correct version?

There was a problem with 64bit version of instantclient. If you ever have the same issue, please install 32bit version of instantclient.
To be honest the easiest way is just to follow PROPER instructions: http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
I tried a lot of other advices and they all went really bad on me (not just because I used different bit version - also I copied the files everywhere following stupid advices and it was hard to correct it)

Its because your Oracle is 64 bit. Remove it and install a 32 bit version of Oracle client and it will work.

It looks like your extension are not install properly. Try to update it or reinstall it with pecl with
pecl install extname
You should also check extension_dir directive in php.ini and check if the PHP folder is added to the path

There's an alternate way to solve this: Install the full Oracle Client, not the basic zip, you can get it at oracle site (about 1Gb):
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-windows-3633015.html
Im using Windows 10, Apache 2.4, PHP 7.1 (all x64) and it works. Also tryed PHP 5.6 and it works too. Still use the php_oci8_11g.dll from the basic client zip to match your php and system version.
You can search the site to find older client versions (11g, 32bits, etc) but Im working with de 12c client and accessing an Oracle 11g enterprise server.
I found a lot of occurrencies of this same error all around, but none gave me this solution. Hope taht helps.

Related

Windows Server 2012 r2 + XAMPP + SqlSrv = unsuccessful so far

I have a Windows 2012 R2 server with XAMPP installed. I need to connect to a Microsoft SQL Server database but I saw the mssql-library is no longer supported and I was redirected to the official Microsoft package SqlSrv.
I've unzipped all files to d:\xampp\php\ext and I've added extension=php_pdo_sqlsrv_56_nts.dll in my php.ini.
Using XAMPP's controlpanel I've restarted Apache but it didn't work. I'm always getting the errors:
[20-Apr-2015 08:38:08 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\xampp\php\ext\php_pdo_sqlsrv_56_nts.dll' - The specified module could not be found.
in Unknown on line 0
[20-Apr-2015 08:38:08 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\xampp\php\ext\php_pdo_sqlsrv_56_nts.dll' - The specified module could not be found.
in Unknown on line 0
I've checked a few times to be sure the filename is correct. The file truely exists. All system users have full control over the file (any file in the \ext directory for that matter). It also doesn't matter to switch to a ts or non-pdo variant.
I'm running PHP 5.6.3. Any suggestions? I'm out of ideas to look for the issue...
Update 1:
Via several form posts I came across a C++ Redistributable to install, so I've got that covered. But still I'm missing out on some DLL's according do depends.exe (Dependency Walker).
To this point I'm missing the following DLL's:
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
PHP5.DLL
API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
EXT-MS-WIN-NTUSER-UICONTEXT-EXT-L1-1-0.DLL
IESHIMS.DLL
SETTINGSYNCPOLICY.DLL
WLANAPI.DLL
I assume they're part of a package I'm missing. I also saw some posts about installing the latest SQL Server Native Client. But as far as I found the latest version is 11, but is too old for Windows 2012R2.
Update 2:
On this forum page I saw a useful reaction (in German) telling SqlSrv can't work with the latest available XAMPP PHP version. So I've reinstalled XAMPP with PHP 5.5.19 now, but this still didn't help.
How to proceed?
Okay, I've found out what's wrong.
At this moment I'm succesfully running SqlSrv on my Windows 2012R2 machine with XAMPP. The main problem was I was using the *nts.dll files. Using Dependency Walker I was able to get a list of dll's that were not loaded succesfully. One of the DLL's listed there was php5.dll. It took me a while to figure out that would be strange. I've inspectected my php folder and I saw the file php5ts.dll in there, but no php5.dll So I Googled for sqlsrv php5.dll and I came across this page from Microsoft.
That page lists which drivers work with which DLL for PHP. I've switched the modules from nts to ts and now everything is working as expected. At this moment I've also installed the C++ redistributable to fix the MSVCP110.dll issue but I'm not sure if that was mandatory to get it working. If you run into the same issue maybe you'll also have to install this patch (Microsoft downloadpage, I've downloaded VSU_4\vcredist_x86.exe)
Good luck future solution seekers!

WAMP will not start Mongo driver. Updated: narrowed down the issue

I have followed instructions down to the letter, but WAMP is not loading php_mongo.dll.
I have downloaded the latest version of WAMP and the MongoDB PHP driver, made sure I am using the correct versions and have also tried a few different versions, added lines to the php.ini file, but to no avail.
Currently I have:
Wamp Server version 2.5, just did a clean install.
MongoDB driver version 1.5.4-5.5 (thread safe) vc11 build for x86 (running 32 bit Windows).
Renamed the file 'php_mongo.dll' and put it in the standard extension directory (C:\wamp\bin\php\php5.5.12\ext).
Added the line extension=php_mongo.dll to the php.ini file and checked it stays there after saving and closing the file.
Ensured that it appears in the list of extensions and is ticked on the Wamp control panel.
But I can't get it to show by using phpinfo(), so I assume that means it cannot start. Every tutorial says to 'make sure you're using version x or stable release y'. I have tried about 15 different combinations and this is the closest I have got.
Can anyone help?
UPDATE:
Got rid of WAMP as I wanted finer control. I've got Apache 2.2 and PHP 5.4.12 working great, but Mongo is still not playing ball. I've checked the server logs and it's giving me this line:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_mongo.dll' - The specified module could not be found.\r\n in Unknown on line 0
When I used a different version of the driver I got an error saying it wasn't a valid win32 program, but now it's saying that (even though that file DOES exist).

PHP loading extensions error

I'm trying to get PHP to load some extensions (sqlsrv driver for PHP PDO).
I'm using a wamp server, With PHP 5.4, Apache 2.4.4.
In my PHP.ini file, i've entered the following line:
extension_dir = C:\wamp\bin\php\php5.4.16\ext
...
extension=php_pdo_sqlsrv_54.nts.dll
However in the apache error log, whenever I restart the apache service, I get the error message:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.16/ext/php_pdo_sqlsrv_54_nts.dll' - The specified module could not be found.\r\n in Unknown on line 0
Now, I know for a fact, this error is incorrect. If I copy the file location directly from the error log, (C:\wamp\bin\php\php5.4.16\ext\php_pdo_sqlsrv_54_nts.dll) and paste it into windows explorer, it finds the file fine.
I've added the ext directory to windows PATH environment variable, still no success.
Any ideas what to try next?
Thanks
Your problem is that you are trying to run a NTS 'Not Thread Safe' dll with a PHP that is 'Thread Safe', so initially try downloading the Thread Safe version of the sqlsrv DLL.
BIG NOTE and possibly your next problems solution:
As far as I know the sqlserver database interface dlls are only available as 32bit. So if you have installed the 64bit WAMPServer you will have to uninstall and install the 32bit WAMPServer.

Mongodb running with node and PHP

I am new to Node.js and MongoDB. I have successfully got the mongoDB running with node.js and am able to start it up and store data inside of collections. So the server is already running on localhost:27017 and works when accessing localhost:28017 .
Now that I have it running and working within Node, I wanted to test MongoDB out with PHP on my Xampp server running on Ubuntu, but am not able to get the phpinfo() to say it is using mongo yet.
I have followed the steps here to configure and install the driver. I have moved the mongo.so file to my xampps extensions and added the appropriate line in php.ini + restarted. But phpinfo() still doesn't show it.
I guess i am confused on the aspect of where do i put the mongo-php-driver folder? is this installed into the Xampp server as well, if so where do i put it?
It is already running and working using node.js , so was just getting confused why it wasn't working properly or getting connected.
Also while I'm at it, Is it possible to have php and node.js use the same mongoDB server running on port 27017?
EDIT:
I was able to get the server to at least give me an error message about the file after i edited the extension_dir to the correct path
extension_lib = "/opt/lampp/lib/php/extensions/no-debug-zts-20090626"
i am now getting this error
Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0
i guess I needed to change that php.ini option to get it to load properly. but it seems I have compiled the wrong mongo.so build. I try again.
Thanks
According to this:
http://montenasoft.com/en/blog/how-install-pecl-php-extension-64bit-linux-while-you-are-using-32bit-xampp
Because xampp is compiled with 32 bit, but the mongo driver you compile is 64 bit.
You may have to compile your mongo driver with these:
phpize
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure
make
sudo make install
Or just install apache2, mysql, php separately. I think this is a better option.

CentOS - Mongo class not found in PHP

I need the MongoDB PHP driver on my CentOS 5.4 machine. My PHP version is 5.1.6. I downloaded the RPM and installed it. That created several files in /usr/bin directory. I copied
/usr/bin/mongo
to
/usr/lib/php/modules
which was what extension_dir showed on doing phpinfo();.
I also added
extension=mongo.so
in /etc/php.ini.
However on executing my PHP script, i still get
Mongo class not found.
What's going wrong here ?
Also, my phpinfo() shows PHP version 5.1.6 whereas running PHP from command line shows 5.3.3. Could anything be wrong with that ?
Thanks in advance.
You're saying your webserver and command line PHP report different versions. These are going to be installed in different locations, and their extensions are API incompatible with each other.
When you installed the php_mongo extension, it may have used the command line php to determine the directory to install the extension to.
Make sure you have the correct php_mongo for the php version of your webserver, and it is in the correct extensions directory. (get the directory from the php.ini returned by phpinfo())
I hope you realise PHP 5.1 is also many years out of date. Unless you have a specific reason to use a version that old, you should also look at upgrading to a more recent version.
Edit:
Just read your comment "I must also mention that /usr/bin/mongo is a binary executable file but its not having a .so extension. Im copying it as is to /usr/lib/php/modules"
No no no! :)
This is the mongo command line client. This is not the PHP extension!
You can run a find /* -name "mongo.so" to see where the installer put the file, this will probably also give you an indication of which version of PHP it was installed for.
It looks as though you are confusing the RPM-packages for the MongoDB server with the requirements to install the MongoDB PHP driver. The PHP driver provides access to the server from your PHP applications, and does not install any command line tools.
restart httpd !
yum service httpd restart

Categories