Unable to connect mongo db server from php driver - php

I have installed the mongo db server and i have run the server from the command prompt administrator up to installing the mongo db server and running the mongo db server was fine.
when i have to install the mongo db php driver
the specifications mentioned by the php mongo db server i have done...here i am placing my details what needs
PHP Version 5.6.12
Compiler MSVC11 (Visual C++ 2012)
Zend Extension Build API220131226,TS,VC11
PHP Extension Build API20131226,TS,VC11
i have choosen the php_mongo-1.6.8-5.6-vc11-nts and renamed it as php_mongo and placed in php extension folder
and in php.ini file written extension=php_mongo.dll after that i have restarted my xampp server
even though it is giving the following error
Fatal error: Class 'Mongo' not found in C:\xampp\htdocs\test\test.php on line 3
please suggest anyone
thanks in advance

Related

Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Manager

Here are some necessary version related details of the packages I have installed on a dream-compute (godaddy) server machine with Ubuntu 16.04 with root access
Apache Server version: Apache/2.4.18 (Ubuntu)
php version 7
mongo db version v3.2.10 and
$ pecl search mongo
.Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
mongo 1.6.14 (stable) MongoDB database driver
mongodb 1.1.9 (stable) 1.1.9 MongoDB driver for PHP
I have set up a website that was previously running on a different server with PHP 5.6 and an old mongo-php driver.
Previously I was using MongoClient class in the connection string but after some searching I changed it to MongoDB\Driver\Manager in my connection class of the php website.
I have also included extension=mongodb.so in the /etc/php/7.0/apache2/php.ini file
The rest of the website is working fine, only when i browse to a page which has a mongodb call at the back-end gives me the following error (from php error log file):
PHP Warning: Module 'mongodb' already loaded in Unknown on line 0
PHP Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Manager::selectDB() in /var/www/html/iot/includes/class.abstract-data-collection.php:118
I am not an expert in linux and hence I am stuck here. Anyone have any idea what should I try to actually get to the problem, should I need to change the php code or is there anything I am missing in the configuration?
TA

I can't connect to Ingres with php 5.4

I have windows xp with xampp installed and the problem is at moment to connect with ingres DB show me this error **Fatal error: Call to undefined function ingres_connect() ** I read about it and I tried to load the extension php_ingres.dll and edit my php.ini with the name of my ext. I have php 5.4 somenone has this extension php_ingres.dll if you need more information please let me know. I installed the client ingres too.
Its an error tipically, because you don't have installed PHP drivers Ingress and PHP.ini can't resolve it, please download PHP drivers and later add it extension=php_ingres.dl in PHP.INI of your xampp server. You can check if extension was loaded using: extension_loaded('php_ingres').
Ingres 10.1.0 Community edition: http://esd.ingres.com/product/Community_Projects/Ingres_Database/Windows_32-Bit/Ingres_10.1_Build_121/ingres-10.1.0-121-gpl-win-x86-NoDoc.zip/http
PHP drivers here: http://esd.ingres.com/product/drivers/PHP/Windows_32-Bit/PHP_Driver

Fatal error: Class 'MongoClient' not found

I want to connect to MongoDB from PHP but I keep getting the fatal error in the title. My PHP version is 5.5.14, architecture x86, thread safety enabled, VC11.
So I downloaded 5.5 Thread Safe (TS) x86 from PECL, extracted php_mongo.dll to the \ext\ folder of my php installation, added extension=php_mongo.dll to the php.ini file, and restarted Apache.
I keep getting the same fatal error when I use either Mongo() and MongoClient().
Also, I can access mongo from CMD, starting it with mongod and then opening another cmd window to handle the database using mongo. I installed PHP and Apache separately (No XAMPP or WAMP) on Windows 8.1 x64.
Installation folders:
Apache: C:\Apache24
PHP: C:\php
MongoDB: C:\Program Files\MongoDB
In the lastest version, you can use new MongoDB\Driver\Manager() to create the obj instead of the MongoClient().

Cant load MongoDb driver in php.ini using Apache in Xampp

I am trying to learn PHP with mongodb backend, but I could not connect PHP to mongo because of the following error:
fatal error Mongo class undefined
I am using Xampp and netbeans as IDE. I looked it up and got that the drivers are to be installed.
So I downloaded the drivers which is php_mongo-1.4.x-5.5-vc11.dll. I put it in the .../php/ext/folder and edit php.ini placing extention = php_mongo.....dll.
But still when I start my apache it says php_mongo...dll not found althought it is placed correctly. Also it says libsasl.dll not found, which when I looked up, it was in place.
I have mongodb installed and I have correct driver version, so why does it happen?

sqlsrv drivers doesn't appear on a WAMP server phphinfo() after adding the extension entries in the php.ini file

I wanted to setup a database connection from PHP to SQL server 2012.I have a wamp server(64 bit) set up on a windows machine(64 bit) with PHP 5.5.12 and on the same machine I have SQL server 2012 installed.
Extracted sqlsrv drivers from official_link
Copied the extracted drivers php_sqlsrv_55_ts.dll, extension = php_pdo_sqlsrv_55_ts.dll to php\ext folder, and then changed the php.ini file to include the extensions
extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
Now I tried
<?php
phpinfo();
?>
I see the following information without any SQL server information in it.
Don't seem to have configured SQL server connection successfully. Could some one please guide me on what I am missing here.
64 bit WAMP server was not able to connect using the drivers extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
So, I installed a 32 bit version of the WAMP server and it works fine now.
Check the php error log (c:\wamp\logs\php_error.log).
I had the same setup (64bit WAMP/PHP 5.5.12) and same missing sqlsrv reference in phpinfo and I got this error in my log:
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' - %1 is not a
valid Win32 application. in Unknown on line 0
The solution was to install the 64bit version of the sqlsrv drivers. I found the unofficial 64bit drivers through http://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html
Warning: In my testing I found these 64bit PHP_PDO_SQLSRV extension 10 times slower than when using PHP_PDO_ODBC.
I am visiting this thread and i think this might help full for you and other with the same issue:
How can I install pdo_sqlsrv on my windows 2008 Server 2008 R2?
The PDO Extension is not the same as the native driver Microsoft is offering. For PDO you must enable
extension=php_pdo_mssql.dll
in your php.ini.
{Normally this file (php_pdo_mssql.dll) should be in your PHP extension-directory (C:...\php\ext). If it's not there you can download PHP from http://windows.php.net/download/ and just take the extension from a package there (take one that correspond with your PHP version of course)}.
Above is taken from PDO MSSQL Server - Driver not found
read for more details. i have the same issue foe linux and i have saved all the pages thats why i am quoting for you help.
if all above didn't work for you then:
On the php.net it is listed that
On Windows, PDO_ODBC is built into the PHP core by default. It is linked against the Windows ODBC Driver Manager so that PHP can connect to any database cataloged as a System DSN, and is the recommended driver for connecting to Microsoft SQL Server databases.
http://php.net/manual/en/ref.pdo-odbc.php
You can connect to mssql server using odbc drivers as i have never connect by my self from windows i use to do it through linux using freeTds, following pages might help you
http://craigballinger.com/blog/2011/08/usin-php-5-3-with-mssql-pdo-on-windows/
Connect PHP to MSSQL via PDO ODBC
PHP to SQL Server without ODBC or MSSQL support

Categories