Installing php-decimal in MacOS arm64e and can't get libmpdec - php

I've just upgraded to a MacBook with the M1 and when installing php-decimal with pecl install decimal, I receive the following error:
checking for libmpdec custom path... no
checking for libmpdec library in default path... found in /usr/local/lib
checking for libmpdec headers in default path... found in /usr/local/include
checking for mpd_version in -lmpdec... no
configure: error: Please check your version of libmpdec (2.4+)
ERROR: `/private/tmp/pear/temp/decimal/configure --with-php-config=/Applications/MAMP/bin/php/php8.0.8/bin/php-config' failed
I've used homebrew to install libmpdec brew install mpdecimal and I can see the files at usr/local/lib - they are aliases to the homebrew location with these files:
libmpdec++.a
libmpdec++.2.5.1.dylib
libmpdec.a
libmpdec.2.5.1.dylib
libmpdec++.dylib
libmpdec++.3.dylib
libmpdec.dylib
libmpdec.3.dylib
I'm just out of ideas here.

The ancient magic is looking for whether a function named mpd_version to determine if your version of the library has that function.
As you apparently have version 2.5.1 and 3 installed somewhere it should find it. But the error message is one that could result in an older version of the headers being present the directory /usr/local/include.
Can you look at the file mpdecimal.h in /usr/local/include to see if that file is present in there, and contains a definition of the function mpd_version in it.
Though it may also be failing at the linking step. You should be able to dump out which symbols are present in the lib by running nm -gC libmpdec.a or similar.

Related

Getting error bz2 module requires libbz2 >= 1.0.0 while compiling php 8.1.13

I am trying to compile PHP with
./configure <other options> --with-bz2=/path_to_bzip2/bzip2/1.0.6
But when the build reaches bz2 it gives out below error
..
checking for BZip2 support... yes
checking for BZ2_bzerror in -lbz2... no
configure: error: bz2 module requires libbz2 >= 1.0.0
./configure for php version 8.1.13 in php-8.1.13 did not succeed
I have exported path to bzip2 in LD_LIBRARY_PATH.
Also content of lib in bzip2
user#server [bzip2/1.0.6/lib]:ls
libbz2.a libbz2.so.1.0 libbz2.so.1.0.6
Not sure why this error. I found at some forums that manually installing bzip2-devel before building PHP should resolve this. But that did not help
I tried with older version of PHP that earlier worked with same build script but those also getting into this error now. Not sure what has changed recently.
This was finally resolved. And it was not related to bzip2. So for anyone facing similar issues here's the summary:
In config.log error was
/usr/bin/ld: cannot find -lsqlite3
So, using answers from here
https://stackoverflow.com/a/21647591/10091382
I tried to find if its able to find sqlite properly
Command used:
ld -lsqlite --verbose
The list displayed confirmed that its not getting the required .so files in the path its looking. So, placing the right files or pointing to right path would resolve this issue.

PHP installation configure: error: Cannot find php_pdo_driver.h

So I have already installed Apache2 and Mysql on Linux Mint (the same as Ubuntu), Now I am trying to install PHP on Apache but I get a very strange error message :
configure: error: Cannot find php_pdo_driver.h.
I did some search on the Internet and I found out that these files were not embedded before in PHP, but they are now. I even checked for it myself in the PHP source folders and I found that specific file. Can anyone tell me what's the problem and how to solve it ?
actually PDO is included on PHP core.
You must install the PHP and MySQL bundled packages.
Use sudo apt-get install php5-mysql
you should check your php version, you must have php version 5 to load PDO.

Install PHP 7.0 Internationalization extension (Intl) on XAMPP on Mac

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

custom OpenCV install issues [LINUX]

Just installed OpenCV 2.4.7 manually in a custom dir on my hosted CentOS 6.4 box. However, when I now try to "./configure" a program called OpenCV-for-PHP that depends on the OpenCV library, it doesn't recognize this new version and still automatically refers to the "old" OpenCV installation (version 2.0.0) that was installed through yum.
The question is: what do I have to set in order to make OpenCV in my custom directory the actively used OpenCV, that will be used during the ./configure stage? (instead of the one it looks up now, which was installed through yum) I've tried:
[root#srv]# export LD_LIBRARY_PATH="/home/userhome/opencv/opencv-2.4.7/build/lib"
[root#srv]# export PKG_CONFIG_PATH="/home/userhome/opencv/opencv-2.4.7/build/lib"
[root#srv]# export PATH=/home/userhome/opencv/opencv-2.4.7/build/lib:$PATH
None of these seem to do the trick, however. pkg-config also still displays the old version after adding these vars.
[root#srv]# pkg-config --modversion opencv
2.0.0
[root#srv]#
Running "./configure" still displays the same dreaded message and exits prematurely:
[root#srv1 OpenCV-for-PHP]# ./configure
(...)
checking for pkg-config... found
checking for opencv... too old
configure: error: Ooops ! You need at least opencv 2.1.0
Maybe it is possible to feed a specific parameter into the ./configure with a value set to my custom OpenCV install dir? (ie. ./configure --opencvpath=/home/usern/opencv/lib/)
All suggestions that might fix this issue are welcome!
PKG_CONFIG_PATH was pointing to the wrong directory. This var has to point to the pkg-config dir containing .pc files, ie. in our server's case "/usr/local/lib/pkgconfig".
By opening the .pc file for OpenCV residing in the aforementioned directory it showed to be still pointing to the old installation. Simply change the value here to the custom path you've installed OpenCV in.

How to add Solr PECL extension into lampp (xampp) stack

Is it possible to add PECL extensions into a lampp stack? If so, how can it be done?
I am specifically interested in http://www.php.net/manual/en/book.solr.php extension.
EDIT: when installing this extension using:
/opt/lampp/bin/pecl install -f solr
everything seams to go as it should except at the end:
checking for cURL support... yes, shared
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
ERROR: `/tmp/pear/temp/solr/configure --enable-solr=yes --enable-solr-debug=no --with-curl=/opt/lampp/bin --with-libxml-dir=/usr' failed
From what I understand this should mean that it simply needs to find the correct curl location which I specify in the install when it asks as 'opt/lampp/bin'
Does this mean that it can't be done without recompiling php using a different curl package? Is this even possible with a lampp stack or do I have to now build my own?
Any ideas?
see PHP: Installation of PECL extensions.
Also take a look at the requirements of the SOLR extension module: http://docs.php.net/solr.requirements

Categories