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!
Related
I have a question that might point to a misunderstanding I have with Homebrew in relation to MongoDB:
I am running XAMPP (version) with PHP 7.2.1 (which I want to use) on Mac OSX 10.12.6 (Sierra). I installed MongoDB and created configuration and data storage folder. It runs fine on command line (when using mongod and mongodb by terminal).
Now, I want to install the PHP driver for PHP 7.2.1. I followed the instructions on http://php.net/manual/en/mongodb.installation.homebrew.php
and adapted them to version 7.2, therefore:
$ brew tap homebrew/homebrew-php
$ brew install php72-mongodb
this creates a php72 and a php72-mongodb folder in /usr/local/Cellar. However, my original (XAMPP based) PHP is in /Applications/XAMPP/ and the php there is in /Applications/XAMPP/etc/php.ini.
and simply adding:
extension="/usr/local/opt/php72-mongodb/mongodb.so"
won't do the trick. After adding this extension, Apache won't start any more. /Applications/XAMPP/logs/php_error.log shows the following error:
[27-Feb-2018 13:11:59 UTC] PHP Warning:
PHP Startup: Unable to load dynamic library 'mongodb.so'
(tried: /Applications/XAMPP/xamppfiles/lib/php/extensions
/no-debug-non-zts-20170718/mongodb.so
(dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/
no-debug-non-zts-20170718/mongodb.so, 9): image not found),
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-
20170718/mongodb.so.so
(dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-
non-zts-20170718/mongodb.so.so, 9): image not found)) in Unknown on
line 0
What is the correct way to include/connect the driver I just installed with my existing XAMPP installation? Do I need to tell Homebrew somehow where my XAMPP install is?
Given that I also have a php folder in my Homebrew (and my /usr/local/opt folder) indicates that I have a second PHP installation right now. Is this the way it is supposed to be?
The PHP version coming with MAMP is incomplete, you need to get the full version here.
Then, replace your local include folder, with the include folder of that downloaded version.
Go to your terminal and run ./configure, this will install full copy of your MAMP php.
Now that you have prepared the PHP directory, install the mongodb extension:
cd /Applications/MAMP/bin/php/php(your version ex: 7.2)/bin
and then run pecl to install mongodb extension
./pecl install mongodb
Now you have installed mongodb but your php should know this.
Go to php.ini file and search for ;Extension
Under this add extension=mongodb.so
Then restart your server and you are good to go, I hope this helps!
I followed the instructions outlined here:
Install PHP Internationalization extension (Intl) on XAMPP on Mac
Ran sudo pecl install intl
selected the correct files from the Cellar
then this error happened:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error:
'ext/standard/php_smart_str.h' file not found
include
^ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed
No matter, did some research and found out that PHP 7.0.8 deprecated php.smart_str.h to php.smart_string.h
So given my scant knowledge of C++ I copied smart_string.h to smart_str.h and renamed all the headers from STRING to string.....
re-ran pecl -no luck....more errors......without knowing where the .c files are and remaking php (not really interested in going that far) since anyway I'm using XAMPP so that ended that option.
I have php 5.5 on my mac, deep in the usr/local/bin folder
so next step was to get pecl to use those files and generate an intl.so file....
Did that....I have the intl.so file so put it in the 'extensions' folder in XAMPP (for reference: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012)
Ran php and came up with this error:
Warning: PHP Startup: Unable to load dynamic library
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so'
- dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so,
9): Symbol not found: _zval_used_for_init Referenced from:
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
Expected in: flat namespace in
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
in Unknown on line 0
I imagine it has to do with different versions?
In any case I can't get pecl to install intl without a make error in PHP 7.0.8 on XAMPP. There is no documentation on this and you'd think that if you deprecate a header.h file you'd update all extensions?
Install intl.so in PHP 7 seems impossible?
After a lot of research I was finally able to resolve this. Detailed steps here:
before you begin, check which php path is set. it should be /Applications/XAMPP/xamppfiles/bin/php. If not you can change it by PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}". more detail here
Overall idea is to build the intl-extension from PHP source code on your own. Before you begin make sure you have installed Xcode. Also, install the latest version of autoconf. this might help:
brew install autoconf
Next download the version of PHP you use in XAMPP from php.net. I am using 7.1.18. This version worked for me: php-7.1.31, I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well. Do let me know if it does or doesnt, I’ll update this post. Do not use PHP 7.3 for Magento 2.3.0, it is not supported.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
Restart your Apache using XAMPP GUI and it should work.
So far, it seems that extension intl.so for php is bundled with php
and should be compiled with php (intl --enabled). XAMPP does not support this (as of Oct 2016), MAMP does. I do not know about other distros. However, if you're willing to recompile PHP 7, it's worth it just to do that and enable it during compiling.
So....I ran with MAMP. Then I decided that I would simply install apache 2.4 and php 7 and Mysql without the stack and the junk that comes with MAMP or XAMPP and everything works like a charm... so if you need to use CakePHP or intl support etc... just drop XAMPP/MAMP and go with a standard install. I used homebrew (MacOS) and everything is working fine.
Update: As regards Windows, XAMPP does not default it, but you can add the module (dll) in php.ini and works like a charm
The error means that XAMPP doesn't have PHP compiled with intl. You may try:
pecl install intl
but probably it won't work as well.
See: PHP Bug #72879 Pecl install intl make error with PHP 7.0.8.
As for the workaround, try installing memcached extension instead of memcache, e.g.
pecl install memcached
Note: It also requires libmemcached package/library to be installed beforehand. For macOS, install via: brew install libmemcached.
If you wanna try without homebrew, with native apache and php, look at my aswer here: https://stackoverflow.com/a/55131868/3692846
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!
I was able to successfully install the mcrypt extension on Mountain Lion but I'm having a difficult time installing the extension on Mavericks.
For reference, I'm following this guide: http://www.coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/
The only inconsistency I've noticed is that by running php -v from the command line, I'm showing PHP version 5.3.15 - whereas the web server appears to be running 5.4.17. I downloaded 5.4.17 to compile mcrypt.
Basically, everything runs according to plan until the very end. Rather than installing the shared extensions into the new directory, /usr/lib/php/extensions/no-debug-non-zts-20100525, I get a message that says:
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
EDIT:
The issue appears to be that the web server's PHP was compiled with module API: 20100525 and the system is still using 5.3.15 (which is API: 20090626), hence the error.
I'm assuming you can't (easily) update the system version of PHP. What do I need to do to get the module and PHP APIs to match?
Thanks in advance for any help.
For reference of others finding this thread..
Here is an automated Mcrypt installer for 10.8 and 10.9.
http://topicdesk.com/downloads/mcrypt/mcrypt-download
Less than a minute to install this way.
I noticed that php 5.4.17 is located in /usr/bin and 5.3.15 is in /usr/local/bin,
so I:
created symlinks in /usr/local/bin to phpize and php in /usr/bin.
After I verified that phpize -v and php were pointing to the correct version, it was simply a matter of recompiling the mcrypt extension. After doing so, the extensions were installed in the correct directory:
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20100525/
I think in retrospect all I needed to do was add /usr/bin to my path variable so that it checks /usr/bin before /usr/local/bin.
I have a 64bit linux EC2 instance which comes with pre installed php.
However I needed xammp so I installed a 32 bit XAMPP. Everything works fine.
I installed mongodb which also works fine.
Now I needed to install a pecl php extention of mongo so that my webapp can run properly.
For this I figured out that a 32bit mongo.sa is required since my php in XAMPP is 32 bit therefore I followed this post : Installing Mongodb with Lamp On Ubuntu ( Linux )
The problem is, the mongo.so being generated even after setting CFALGS="-m32" is still 64 bit :(.
Where am I going wrong?
This is what I did to install the mongo extension
/opt/lampp/bin/pecl download mongo
tar xvzf mongo-1.2.12.tgz
cd mongodb-1.2.12
CFLAGS="-m32"
sudo /opt/lampp/bin/phpize
./configure
make
cd modules
ls ( gives mongo.so)
file mongo.so ( still shows its ELF64 bit extension)
mongo.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
:(. Please help!
Instead of the plain make step, try make CFLAGS="-m32".
linux-1:/tmp/mongo-1.2.12$ file modules/mongo.so
modules/mongo.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x37bbd16cd2928f1b8e86be001d6604046945d9f1, not stripped