I spent 2 days trying to install mongo php driver on a Mac 10.8 with MAMP (2.2), but it's almost impossible...
I've tried:
Installing Mongo Driver on MAMP
and this
Mongo PHP Driver 1.2.10 with MAMP
I have the 5.4.19 php version selected on MAMP.
I have installed the mongo driver doing:
sudo pecl install mongo
I have no errors, but once I restart MAMP I got this error on the loading process:
PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
The output of phpize is:
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
The output of php -v is:
PHP 5.5.3 (cli) (built: Sep 18 2013 14:31:13) ...
So the version doesn't match with MAMP.
I have tried to select the same version on MAMP, but I got the same problem...
Any hints?
Thank you very much!
The phpize in your path is building extensions for PHP 5.3 (API version 20090626), but you need to match the API version of PHP in your MAMP config (which should be API version 20100412 for PHP 5.4). It looks like you have another version of php in your path, which is PHP 5.5.
To build everything with the expected version of PHP, try putting that version of PHP first in your path, eg:
export PATH=/Applications/MAMP/bin/php/php5.4.19/bin:$PATH
Then run phpize to make sure it finds the correct API version.
The API version reported by phpize -v should match that reported by php -i | grep "PHP API".
Assuming all matches, you should then be able to build following the instructions you've linked.
Related
Today I wanted to update my dev machine with new php so i downloaded and set up PHP 7.2.7 x64.
After that I sterted collecting missing modules and everything goes fine till i came to the last one: php_ssh2.dll.
Downloaded latest version 1.1.2 from https://pecl.php.net/package/ssh2
Unfortunately it doesn't work. Error:
Warning: PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20160303
PHP compiled with module API=20170718
These options need to match
Anyone have any tips for me how to make it work?
I have compiled SSH2 module for PHP 7.2 (and PHP 7.3) on Windows. It is available at https://github.com/nufue/pecl-ssh2-windows
On Windows, PHP 7.2.x is built using VC15 and the latest SSH2 module is v1.1.2 which was built on VC14.
So you need to either downgrade to PHP 7.1.x or wait for the PHP team to compile SSH2 in VC15.
Additionally, I have no experience with this but you could decide to compile it yourself in VC15 if you are comfortable with that sort of thing.
Update:
SSH 1.1.2 now has a VC15 build at https://windows.php.net/downloads/pecl/releases/ssh2/1.1.2/
The latest SSH is 1.2 which currently has PHP 7.1-7.4 builds: https://windows.php.net/downloads/pecl/releases/ssh2/1.2/
I've installed MongoDB using homebrew and also installed the php mongo driver and included it in the current php version of my MAMP package. But when I start MAMP this error is in my php error log:
PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
I tried to compile the driver again with the phpize which is inside the mamp folder but got the same results. I'm very new to mac and *nix environment in general, Is there something that I'm missing?
The PHP version installed by homebrew is 5.5.17 and PHP version in my MAMP Package is 5.5.14
If you're compiling the PHP driver, you must do so against the same PHP version that you intend to run it with. Based on the error you've shared, the driver was clearly compiled against a different PHP runtime.
Luke Peters has a blog post discussing how to compile the module for MAMP, and it entails setting your PATH environment variable to MAMP's bin/ directory before using PECL to build the module. This will ensure that the appropriate phpize binary gets used. To paraphrase his write-up for your environment (5.5.14):
$ export PATH=/Applications/MAMP/bin/php/php5.5.14/bin:$PATH`
$ cd /Applications/MAMP/bin/php/php5.5.14/bin
$ sudo pecl install mongo
Trying to install mongoDB on my MAMP setup. I have MAMP 3.05, which comes with PHP 5.5.10. Installed mongo using the instructions from the mongo website and it seems to be running properly. Grabbed mongo extension from the mongo github page and followed their instructions for building and adding the extension to php.ini.
Everything seems ok until I restart MAMP. In php_error.log, I see this:
PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
It looks like the API number for php is a later version, so it would be nice not to have to rebuild an older version of PHP. Is there a way to rebuild the mongo extension with the correct module version, or do I have to discard MAMP and build PHP manually?
Please check with the command which phpize if you use the correct version of the phpize command. This should point to a directory similar to the one you installed your PHP5 into. Mine is found in /usr/bin/phpize which is the default OS X installation.
You can further run phpize -v to check the API version it links against. In my case (the default OS X PHP installation) it outputs:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
If the outputted API version does not match your required number 20121212 (in my case it is 20100412 which does not match) you are using the wrong phpize to configure the extension.
You have to do this first
sudo cp -r /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/php /usr/include/php
I am new to mongodb. I just installed mongodb on our development (linux) server:
I got mongodb to work on my console and I could load and save data, but when I wanted to install the PHP driver and altered the php.ini I got this error: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so
I searched the internet about this and all I could find was about 32bit and 64bit differences between php and the so file but as far as I know the computer that all this is installed on is only 32bit so everything on it will be 32bit as far as I know.
I installed the driver using pecl install mongo
also tried to pecl download mongo phpize it and set something to -m32 found that somewhere on the Internet, then make it and still didn't work.
Below some more info you might need in order to be able to help me out here.
uname -m
i686
file /opt/lampp/bin/php-5.3.5
/opt/lampp/bin/php-5.3.5: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.0, stripped
file /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so
/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
phpize --version
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Hope someone knows how to get this to work. I'm not quite a linux guru, know my way around a bit but please tell me exact steps to follow...
-mac-
--
also tried the bradly henk method on this page: http://us2.php.net/manual/en/mongo.installation.php but that didn't work either
just upgraded from 1.4.3 to 1.4.4 using pecl upgrade mongo. This didn't solve the problem. php version installed = 5.3.5 (lampp) and mongo version installed = MongoDB shell version: 2.4.6
The 1.4.4 version of the php driver should work for PHP Version: PHP 5.2.6 or newer, but then again the 1.4.3 version should also have worked on 5.2.6 or newer
/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so
phpize --version
Configuring for: PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Note the difference in the API Number here.
You seem to have multiple installations of PHP on your system.
You need to use the pecl (and phpize) tools that match the PHP version you want to load the module under.
I suspect you'll find the correct pecl binary under /opt/lampp/bin/pecl
I've installed the sphinx binaries and libraries and am now trying to install the PECL sphinx module.
My system is running OS X 10.6 with MAMP 1.8.2 installed. I try to install sphinx using the following command:
sudo pecl install sphinx
The PECL command outputs the following:
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
The versions above don't match the versions listed when doing a phpinfo(). It seems that PECL is trying to complie against the built-in version of PHP.
If I ignore the errors and continue the it will successfully compile and place the sphinx.so file in:
/usr/lib/php/extensions/no-debug-non-zts-20090626/sphinx.so
when in fact it should be:
/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/
I've tried copying the sphinx.so file to the MAMP extensions dir but when I restart apache PHP displays the following warning:
PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/sphinx.so
I think this is because MAMP is 32bit and the built-in PHP is 64bit so PECL complies for 64bit. I might be completely wrong but I did read this when I goggled on the topic.
Does anyone know how to get PECL to map to the MAMP version of PHP instead of the built-in version?
If the "correct" version of PHP is installed in something like /Applications/MAMP/bin/php5/, and has the development tools included, you should have some version of the pecl command to go with it, some next to that directory.
If so, running that pecl command that corresponds to your "correct" version of PHP should help : it'll run the correct version of phpize, and will allow the extension to be compiled against the (once again) correct version of PHP.
You just have to hope that MAMP includes those commands -- I cannot check, as I don't have a mac.