I need to install mcrypt for php on my Linux server. I have PECL, and PHP 7.2 running on API version 20170718 (i.e., all the PHP *.so extensions are loaded from /usr/bin/php/20170718). But, when I run,
pecl install mcrypt-1.0.1
It says,
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
libmcrypt prefix? [autodetect] : ...
And if I install it, the wrong version gets installed, and it doesn't appear because I'm running php API version 20170717, not 20180731. In addition, including it directly from the /usr/bin/php/20180731 directory still causes it to crash since it recognizes it's the wrong API version.
How can I install the proper mcrypt version for PHP API version 20170718?
Related
I use centos and php 7.3.2 and Nginx web server
I have installed several packages using pecl. They are all installed successfully.
When I run command "pecl list" or "php -m", I see the name of the desired packages:
Package Version State
PDO_IBM 1.5.0 stable
apcu 5.1.21 stable
ibm_db2 2.1.5 stable
igbinary 3.2.7 stable
raphf 2.0.1 stable
I have also checked the php version related to CLI with phpinfo() function. Both of them are one.
I have also run the "pecl config-show" command. Its php path is correct
I have also checked the following values. CLI and phpinfo() are the same
PHP API 20180731
PHP Extension 20180731
Zend Extension 320180731
However, I cannot see the installed modules on the phpinfo() page. And their functions don't work either
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'm afraid I put quite a mess on my development computer and I could use some help. Basically, I had php5.3.2 on ubuntu installed with apt-get package with apc loaded as a dynamic extension.
Today, I decided to upgrade to php5.4.6 using this PPA: https://launchpad.net/~ondrej/+archive/php5. So, I run now php5.4.6 but apc won't load anymore.
So I did
pecl uninstall apc
then
pecl install apc-3.1.13
to make sure I got a version of apc compatible with php5.4.
Everythin seems to go well but the extension still won't load. It does not show on a phpinfo(). I added extension=apc.so in php.ini of course.
I think I found the origin of the problem but I don't know how to fix it:
According to my phpinfo():
PHP API 20100412
PHP Extension 20100525
Zend Extension 220100525
Zend Extension Build API220100525,NTS
PHP Extension Build API20100525,NTS
When I do, pecl install apc, I got:
54 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
As a result apc.so will be installed in /usr/lib/php5/20090626 instead of /usr/lib/php5/20100525.
How can I fix this?
Just change the API version in zend_modules.h in your php binary source to the PHP extension API number which is indicates in phpinfo().
For example if the php extension API in phpinfo() is 20100525, you must change the API number in zend_modules.h file to 20100525 and then recompile your project.
I found a way to fix that. A simple
sudo apt-get install php-apc
will do the trick.
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.