I entered the following commands on my command terminal in order to use the 'MongoClient' with PHP on XAMPP on my Macbook Pro:. brew install wget. brew install autoconf. sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo.
Added extension=mongo.so to php.ini /Applications/XAMPP/xamppfiles/etc. Restarted Apache However, I have had no luck.
I keep getting this error: Fatal error: Class 'MongoClient' not found in /Applications/XAMPP/xamppfiles/htdocs/xampp/index.php on line 5 I'm getting kind of frustrated because I don't really know what else to try.
I dusted off a G4 Powerbook with OS X 10.5.8 to test. Turns out that the current of mongo.so for PHP 5.3 on github doesn't support PowerPC (the PHP 5.2 build appears to). I downloaded the to match XAMPP 1.7.3 and compiled my own mongo.so (1.2.12). I did some minimal testing with XAMPP 1.7.3 on PowerPC to confirm this appears to work.
Essentially, I just pasted the example from the, and inserted some documents into MongoDB 2.0.6 running on another computer. Note this is an unofficial & unsupported mongo.so build, the same as what you should get building successfully from source with pecl install mongo.
As a bonus, this is a much newer driver version than the precompiled OS X ones currently on github. As a warning: I'm not sure about limitations or quirks of using this on PowerPC. Most of the OS X world has moved on to Intel architecture now.
So, instructions to use:. Download and install. Download mongo-ppc-1.2.12.so from my github:. Rename that to mongo.so and copy into /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/. Edit XAMPP/etc/php.ini and add a last line with: extension=mongo.so.
Install Mongodb Driver For Php On Xampp For Mac Download
Check via phpinfo that the mongo extension is available. Make sure you stop/start Apache if it was already running when you added the extension.
$ git clone $ cd mongo-php-driver $ git submodule update -init $ phpize $./configure $ make all $ sudo make install If your system has multiple version of PHP installed (e.g. MacOS default and ), note that each version of PHP has its own command and php.ini file. By default, the driver will use bundled versions of and and attempt to configure them on its own. If libbson and libmongoc are already installed as system libraries, you can instruct the driver to utilize them by specifying -with-libbson=yes -with-libmongoc=yes as arguments to configure. For a complete list of configure options, run configure -help.
When using bundled versions of libbson and libmongoc, the driver will also attempt to select an SSL library according to the -with-mongodb-ssl option for configure. The default value is -with-mongodb-ssl=auto, which will search for Secure Transport (macOS only), OpenSSL, and LibreSSL, in that order. Additionally, you may specify openssl, libressl, or darwin to force selection of a particular library, respectively.
Install Mongodb Driver For Php On Xampp For Mac Mac
Note: If the build process fails to find an SSL library, check that the development packages (e.g. Libssl-dev) and are both installed. When using Homebrew on macOS, it is common for a system to have multiple versions of OpenSSL installed. To ensure that the desired version of OpenSSL is selected, the PKGCONFIGPATH environment variable may be used to control the search path for pkg-config.
If pkg-config is not used, configure also supports a -with-openssl-dir=DIR argument, which can be used to specify a manual search path (for OpenSSL only). The final build step, make install, will report where mongodb.so has been installed, similar to. A) If your git version is not recent enough, as can happen e.g. On Ubuntu 12.04 LTS, git submodule -init won't exist In that case use: git submodule init git submodule update b) make install does not create a mongodb.conf configuration file to support the debian/ubuntu PHP versions phpenmod/phpdismod commands. To have them work: - do not add the extension=mongodb.so line to php.ini - add it to a mongodb.ini file in the PHP mods-available directory - the commands will then work for this extension c) if you have multiple versions of PHP on a system such as b), the phpenmod/phpdismod commands may fail if the extension is not built for the default PHP CLI version.
Install Mongodb Driver For Php On Xampp For Mac Free
To have it be enabled for a specific version, use the -v argument, like phpenmod -v php7.1 mongodb.
The mongodb install has been removed from Homebrew. To install the mongodb extension you need to use pecl. Sudo pecl install mongodb You may need to follow some additional configuration.
Follow the inline instructions as they appear. Once the install is finished it will add two lines at the bottom of your php.ini file. Instead, remove these lines and add the and add a separate file to your conf.d directory in the same directory as you php.ini file. In php.ini remove extension='mongodb.so' // remove extension='phpmongodb.so // remove Then run: $ touch /usr/local/etc/php/5.6/conf.d/ext-mongodb.ini Finally add this line to the new file: // example extension='/usr/local/Cellar/[email protected]/5.6.35/pecl/20131226/mongodb.so'.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |