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

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

Related

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

PHP Memcached with WHM Centos 6.5, PHP 5.5.16 and Apache 2.4

I'm seriously loosing my patience with this one.
I tried to install PHP Pecl Memcached on the server with the above spec using the following approach:
Software > Module Installers > PHP Pecl
search for memcache
Installed first the memcache 3.0.8, which went all fine, but then trying to install memcached 2.2.7 I get error saying:
configure: error: no, sasl.h is not available. Run configure with --disable-memcached-sasl to disable this check
ERROR: `/root/tmp/pear/memcached/configure --with-libmemcached-dir=no' failed
The memcached.so object is not in /usr/local/lib/php/extensions/no-debug-non-zts-20121212
Tidying /usr/local/lib/php.ini...
No changes
Tidying /usr/local/cpanel/3rdparty/php/54/etc/php.ini...
No changes
Any idea what I need to do to make it work?
Please refer this link, seems to be some problem with the location of memcache.so object file
The Error Message is clear. You need the cyrus-sasl-devel package installed.

Configuring PHP for pthreads

I am trying to install pthreads for PHP, which is here.
In PHP manual of extention it says:
To enable pthreads support, configure PHP with --enable-maintainer-zts
and --enable-pthreads.
I have a CentOS server which has PHP installed but I cant figure out how to reconfigure it with these settings on, I checked my phpinfo() can see current ./configure options.
I will happy if someone can show me how to reconfigure my php. Do I need to uninstall current PHP first then install another or is there any way to run this ./configure command easily. I have SSH access to my server.
You could try install using PECL:
http://pecl.php.net/package/pthreads.
How to install PECL extensions:
http://php.net/manual/en/install.pecl.php
pecl install pthreads
I've written a tutorial about exactly this - Compile PHP with pthreads and ZTS enabled.
You must compile PHP as there are no prebuilt packages.
To reconfigure everything you'd use ./configure mainly.
if centos does not provide a thread safe version, you must compile php by own.
You have to build pthreads for your centos op system. After that you can use it as extension...
Use the following tutorials
http://blog.slowbro.org/2013/08/compiling-php-55-with-pthreads-on-centos/
http://eddmann.com/posts/compiling-php-5-5-with-zts-and-pthreads-support/
Or simply read the manual...
http://www.php.net/manual/en/pthreads.installation.php

PECL install failed

after upgrading from PHP5.2.6 to php 5.3. it seams, I also have to reinstall the PHP memcache-module.
So I downloaded the newest version of memcache (3.0.6) and followed this documentation:
http://www.php.net/manual/en/install.pecl.pear.php
pecl install memcache
Which results in the following error-message:
No releases available for package "pecl.php.net/memcache"
install failed
what's going on here? By the way: the server is not connected to the Internet, but that shouldn't be a problem, right?!
To answer my own question an for rising the intellectual horizon of #OZ_ and #martswite
an offline-installation of an pecl extension works like the following way:
1.) download the extension from http://pecl.php.net/packages.php
2.) there you get an .tgz file
3.) install the file:
pear install memcache-3.0.6.tgz
PECL modules are (by default, and most of the time) downloaded from a non-local repository.
Therefore you will need some form of internet connection to download it.
Alternatively you can upload the pecl package from your machine to a location on the servers local file system and install it from there, or compile from source.
To me this error was caused due to php without support for ssl.
Enable openssl or recompile with openssl built int.
Check php support in a Linux host run
php -i | grep openssl
Should print a line with openssl if support enabled.

OAuth PHP for Windows?

I'm running XAMPP on windows and trying to install Oauth into PHP. I already tried running "pecl install oauth" but it gave me error. i don't have a compiler to compile the OAuth 1.10 into .dll, and really don't have the time to learn how to compile it.
the link for the pecl package is here: http://pecl.php.net/package/oauth/1.1.0
EDIT after running 'pecl install oauth' the error i get is this:
WARNING: php_bin C:\XAMPP\xampp\php\php.exe appears to have a suffix \php.exe,
but config variable php_suffix does not match.
ERROR: The DSP oauth.dsp does not exist.
thanks!
This is usually do to incompatibility between the oAuth version and PHP. You can get the latest oAuth library precompiled from the windows.php.net site:
http://windows.php.net/downloads/pecl/releases/oauth/
Also don't forget to add the extension to your php.ini and restart Apache afterwards.
Install APC on Windows:
PECL is used for downloading and
compiling extensions, but Windows
machines generally don't have what is
required to compile these, instead try
looking for and downloading a
pre-compiled .dll.

Categories