I am very new to mongoDB. I have downloaded the setup for mongoDB but before that I have to install the mongoDB PHP driver.
When I downloaded the driver I got these instruction in the documentation:
Installation
To install:
$ phpize
$ ./configure
$ make
$ sudo make install
When I run this command phpize on cmd then it gives me this error
'phpize' is not recognized as an internal or external command.
I am using:
MongoDB version 1.0
PHP version 5.5
Windows 7
I was having a similar issue a week ago. I struggled a lot and finally found that I had downloaded the wrong DLL file. (My system is 64-bit, so I downloaded the DLL for 64-bit. However, phpInfo() shows that my php is 32-bit. So, I downloaded the 32-bit DLL file and it worked!)
Have a look at the following tutorial if you still have any queries:
https://www.youtube.com/watch?v=HBKNKl5OG_8&t=356s
I hope that helps!
Related
We're using a MSSQL db at work and I want to be able to write PHP scripts that fetches data directly from the db to my local MAMP environment. I've tried installing pdo_sqlsrv and sqlsrv using Homebrew and I've tried compiling the extensions on my own using PECL commands, but in both cases it has ended unsuccessfully with the error message:
fatal error: 'sql.h' file not found
I've been googling this problem all day and can't seem to find a solution that I can get to work/understand. I'd be grateful for any help or hints.
Computer: Macbook Pro 2018 (macOS 10.13.6)
Local environment: MAMP PRO 4.5 (PHP version: 7.2.1)
I found the solution here: https://github.com/Microsoft/msphpsql/issues/198
I was missing tools provided by unixodbc, so:
brew install unixodbc
...provided the .h file(s) I was missing. The PECL installer was then able to locate the required libraries. In case it wouldn't have worked, I would have tried:
sudo CXXFLAGS="-I/usr/local/opt/unixodbc/include" LDFLAGS="-L/usr/local/lib" pecl install pdo_sqlsrv
sudo CXXFLAGS="-I/usr/local/opt/unixodbc/include" LDFLAGS="-L/usr/local/lib" pecl install sqlsrv
...as suggested in the link.
I am on a 64bit Fedora 17 box, PHP5.4.8. I have Oracle Instant Client 11.2 installed. I am trying to install the pdo_oci package and I'm running into some issues.
I have the latest PDO_OCI package. I unpacked it and executed the following:
~$ > cd ../PDO_OCI-1.0
~$ > phpize
~$ > ./configure --with-pdo-oci=instantclient,/usr/lib/oracle/11.2/client64/lib
I get the error message:
"I'm too dumb to figure out where the include dir is in your instant client install"
As suggested by the pdo_oci manual in php.net, I created couple of paths with the minor version of the OIC as such
ln -s /usr/bin/include/oracle/11.2 /usr/include/oracle/11.2.0.1
Still I get the same error message. Does anybody have any idea?
The machine I'm running this on is not connected to the internet, so I have to run the installation using the previously downloaded packages.
I was running into the same problem. I an running centos 6.5 64bits, but fedora is a lot similar.
Supposing you already installed both basic and devel packages:
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.i386.rpm
You should specify just the "/usr" directory, as the configure looks for oci.h in this way in configure:
$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h
so, after editing config.m4 to be able to do a 11.2 install (reference for the url in the end), do this:
./configure --with-pdo-oci=instantclient,/usr,11.2
I followed this tutorial:
http://shiki.me/blog/installing-pdo_oci-and-oci8-php-extensions-on-centos-6-4-64bit/
I get this error when i try to run following command
sudo pecl install mongo
Error:
...php_mongo.c:22:10: fatal error: 'php.h'
file not found
#include <php.h>
^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed
I am new to MAC, please help me to resolve this and get Mongo Working with PHP.
I have installed MacPorts and autoconf
It seems, that you did not install the xampp "Developer Package", required to build additional php extension. You can download the "Developer Package" from:
http://www.apachefriends.org/en/xampp-macosx.html#849
This has already been answered.
Please follow the processes outlined in this answer - Install PECL on Mac OS X 10.6.
I followed the process outlined here http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/, referenced by the above Stackoverflow link and the process for install pear, followed by pecl and subsequently -
sudo pecl install mongo
works perfectly on OSX Lion.
You may need to modify the extensions in /etc/php.ini, however, this is explained in the output after you install the php mongo driver.
It took me the whole day to find this answer, I had tried everything, but this worked finally:
sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include /Applications/XAMPP/xamppfiles/bin/pecl install mongodb
I found this article very helpful. Saved a lot of time after I wasted a lot of time to check other links. I did for MAMP and think will work for XAMPP too.
The thing is MAMP does not ship with all PHP sources to compile pecl mongo file and create mongo.so. All what you need is download php for respective version you are using. I was using php version 5.6.10. I checked php.net site that was having 5.6.13 version. I downloaded sources for this version from PhP.net. Executed "sudo pecl install mongo" again and it worked.
I am trying to install MongoDB with PHP5.2 on CentOS. When I run phpinfo() it says Mongo is not installed. I believe the PHP is working fine. I installed MongoDB, and I can enter the shell. I did pecl install Mongo, says it was completed and installed properly. I add a mongo.ini file which is extension=mongo.so. I can go to /usr/lib64/php/modules/ and mongo.so is there. Is there anything I am forgetting? I have restarted both HTTPD and Mongod services.
The only thing I did for mongo driver 1.2.9 to work with php was
$ cd mongodb-php-driver-folder
$ phpize
$ ./configure
$ sudo make install
At the end of php.ini, add
extension=mongo.so
Restart apache.
If something like an undefined symbol is showing up, it means that the source didn't compile properly. However, "Z_DEFLREF_P" is not part of the Mongo PHP Driver source code (in the latest version). Are you sure the error doesn't mention "Z_DELREF_P"?
Right now, that is indeed a bug in the 1.2.9 version of the driver. It doesn't compile with PHP 5.2 right now. I've added a ticket at https://jira.mongodb.org/browse/PHP-335
Use the 1.2.7 mongo driver for php and you shouldn't have an issue compiling.
I followed the following steps to install mongo's php drivers with lampp.
http://abstract2paradox.wordpress.com/2012/01/26/adding-mongo-db-driver-to-xampp/
When I start lampp its gives the following 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
Any ideas?
Thanking you
This means that your PHP is compiled in 32-bit mode, but the mongo extension as 64-bit mode. I believe Apple's compiled PHP is in 32-bit mode as well, you can verify that with:
php -r 'echo PHP_INT_MAX, "\n";'
If that shows 9223372036854775807 you're on a 64-bit platform.
Now, in your case you will need to make sure that you compile the MongoDB extension with a 32-bit architecture. From http://artur.ejsmont.org/blog/content/how-to-build-mongodb-pecl-extension-in-32bit-for-php-52-on-macosx-snow-leaopard I believe you can do that with:
pecl download mongo
tar -xvzf mongo-1.2.7.tgz
cd mongo-1.2.7
CFLAGS="-m32"
phpize
./configure
make
make install
The problem was as is outlined by Derick above. Although the way the problem got solved was download a 32 bit version of the ubuntu os and running it as a virtual machine on my pc using vmware. Later followed the 'Manual Installation section' on this page for the php driver installation and it all worked. Got the php drivers from github as mentioned in the page.
Later i copied the file mongo.so from the php file extensions directory running on my virtual machine to my parent os and it all works now!