Unable to install php solr extension - php

Using pecl install -n solr gives
No releases available for package "pecl.php.net/solr"
install failed
Also tried pear install pecl/solr which gives the same output :
No releases available for package "pecl.php.net/solr"
install failed
I'm using a Mac and php56.
Output of pecl -V
PEAR Version: 1.9.4
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016;
root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Another important piece of information is that, pear and pecl were not available in my system, so I installed them using
sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin
Update
Tried sudo pecl install -n solr and now it seems to go one step further
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: phpize failed

Luckily stumbled upon
PEAR package install fails
which led to execute
pear list-upgrades which showed some kind of permission issue with cache directory, manually created the directory using sudo at the specified location (/private/tmp/pear/cache)
And then used sudo to install the solr extension as sudo pecl install -n solr which threw the following error :
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
brew install autoconf followed by sudo pecl install solr worked.

Related

php's ssh2 extension installation on RHEL8 with php 7.4

I have installed php7.4 via RHEL8's Default Stream using dnf.
I want to install the php's ssh2 module.
How do I install Pyrus (Pear2 Package Manager) on RHEL8 with php7.4?
When I tried: php pyrus.phar
I got the error message in command prompt: Could not open input file: pyrus.phar
I used:
updatedb
locate pyrus
Got nothing
So, what is the issue here?
Best Regards
Thayalan
I wanted to install php's ssh2 extension via Pyrus but I was having trouble with Pyrus. Therefore, I tried it without Pyrus. I preferred yum or dnf installation throughout. But, it was not possible for some. The following are how I have installed ssh2:
yum install make gcc php-devel php-pear
libssh2 package (ssh2 package needs it) installed by downloading the file https://libssh2.org/download/libssh2-1.10.0.tar.gz into an appropriate folder.
Then, I entered the following commands:
tar -zxvf libssh2-1.10.0.tar.gz
cd libssh2-1.10.0
./configure
make
make install
ssh2 package installed by downloading the file https://pecl.php.net/get/ssh2-1.3.1.tgz into an appropriate folder.
Then, I entered the following commands:
tar -zxvf ssh2-1.3.1.tgz
cd ssh2-1.3.1
phpize
./configure
make
make test
make install
Then I entered the following entry into /etc/php.ini: extension=ssh2.so
After that, I restarted php by: systemctl restart php-fpm
And now, php's ssh2 extension has been successfully installed.

Trying to install int extension macOS Catalina and PHP 7.4.10

I am trying to install the zip and the intl extension for PHP 7.4.10
I run
sudo pecl install intl
and then the installation is requesting :
Specify where ICU libraries and headers can be found [DEFAULT] :
then I hit enter and continues but then it shows the next error:
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
then I start to look how to install icu, I run:
brew install icu4c
the console shows:
If you need to have icu4c first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/user/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/user/.bash_profile
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
export .bash_profile="/usr/local/opt/icu4c/lib/pkgconfig"
I added all the paths to the .bash_profile config file and run:
source .bash_profile
at this point I am not sure what todo I am still receiving:
== Environment ==
!! php_extension zip !!
[System] must be installed and enabled - The Zip PHP extension is now required by Moodle, info-ZIP binaries or
PclZip library are not used anymore.
!! php_extension intl !!
[System] must be installed and enabled - Intl extension is required to improve internationalization support, such as
locale aware sorting and international domain names.
even after run sudo apachectl restart
also I have check a lot of guides to install the zip extension via php.ini adding extension=zip but is not working
any help will be appreciated
[UPDATE]I tried to use the fist answer to the post and I got after run all and the last command output was sudo pecl update-channels && sudo pecl install intl
checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-icu-dir=/usr/local/opt/icu4c' failed
Is icu4c present on your system ? What is the output of:
which icu4c
If you have no output we can investigate further. A quick look at the ICU documentation tell us that the library relies on autoconf.
brew update
brew install autoconf automake libtool
brew install icu4c
Now let's check if icu4c is installed properly
which icu4c
If at this point you still have no output then it's better to install and compile icu4c from source.Because this library installed via Homebrew could be suffering from multiple issues.
wget https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz
tar xvfz icu4c-67_1-src.tgz
cd icu/source
./configure --prefix=/usr/local/opt/icu4c/67_1 --enable-icu-config
sudo make && sudo make install
Afterwards you can resume
sudo pecl update-channels && sudo pecl install intl
If you will be asked
Specify where ICU libraries and headers can be found [DEFAULT] :
The answer is
/usr/local/opt/icu4c
When icu4c is installed with brew, it doesn't copy its files to pkg-config configuration directory.
So, another workaround would be to be to set the PKG_CONFIG_PATH to the folder where the lib is located. Example:
PKG_CONFIG_PATH=/usr/local/Cellar/icu4c/69.1/lib/pkgconfig/ pkg-config --cflags --libs libsoup-2.4

`phpize' failed, while installing Imagick [duplicate]

I have been meaning to install ffmpeg as an extension to my PHP setup. So before I can install it, I need to phpize it. I installed php5-dev by sudo apt-get install php5-dev. But now when I run phpize I get the following error :
phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
The location of my php.ini is /usr/local/zend/etc/php.ini
From another online resource I tried this
sudo apt-get install autoconf automake libtool m4
But all of them are already installed.
Locate config.m4 didn't return anything.
Any pointers here how I can get phpize and thus, ffmpeg up and running?
For recent versions of Debian/Ubuntu (Debian 9+ or Ubuntu 16.04+) install the php-dev dependency package, which will automatically install the correct version of php{x}-dev for your distribution:
sudo apt install php-dev
Older versions of Debian/Ubuntu:
For PHP 5, it's in the php5-dev package.
sudo apt-get install php5-dev
For PHP 7.x (from rahilwazir comment):
sudo apt-get install php7.x-dev
RHEL/CentOS/yum
yum install php-devel # see comments
For PHP7 Users
7.1
sudo apt install php7.1-dev
7.2
sudo apt install php7.2-dev
7.3
sudo apt install php7.3-dev
7.4
sudo apt install php7.4-dev
If not sure about your PHP version, simply run command php -v
Ohk.. I got it running by typing /usr/bin/phpize instead of only phpize.
Under Redhat Enterprise / CentOS, use yum to install the php-devel module:
yum install php-devel
For PHP 7, you need:
yum install php70-php-devel
Step - 1: If you are unsure about the php version installed,
then first run the following command in terminal
php -v
Output: the above command will output the php version installed on your machine, mine is 7.2
PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies
Step 2: Then to install phpize run the following command, Since my php version is 7.2.3. i will replace it with 7.2, so the command will be,
sudo apt-get install php7.2-dev
Step 3: Done!
Alternate method(Optional):
To automatically install the phpize version based on the php version installed on your machine run the following command.
sudo apt-get install php-dev
This command will automatically detect the appropriate version of php installed and will install the matching phpize for the same.
Hmm... actually i dont know how this solved it? But the following steps solved it for me:
find / -name 'config.m4'
Now look if the config.m4 is anywhere in a folder of that stuff you want to phpize. Go to that folder and run phpize directly in there.
For ubuntu 14.04LTS with php 7, issue:
sudo apt-get install php-dev
Then install:
pecl install memcache
In Ubuntu 16.04, you can install phpize with the command
aptitude install php7.1-dev // for php 7.1
which is equivalent to
apt-get install php7.1-dev // for php 7.1
If you're having problems with phpize not found on CentOS7.x after you have installed the relevant devel tools for your version/s of PHP, this path finally worked for me:
For PHP 7.2.x
/opt/cpanel/ea-php72/root/usr/bin/phpize
For PHP 7.3.x
/opt/cpanel/ea-php73/root/usr/bin/phpize
For PHP 7.4.x
/opt/cpanel/ea-php74/root/usr/bin/phpize
Run this in your folder containing the downloaded PHP extension, for example in line 3 below:
Example based on installing the PHP v7.3.x Brotli Extension from https://github.com/kjdev/php-ext-brotli
git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
cd /php-ext-brotli
/opt/cpanel/ea-php73/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
make
make test
Install from linux terminal
sudo apt-get install <php_version>-dev
Example :
sudo apt-get install php5-dev #For `php` version 5
sudo apt-get install php7.0-dev #For `php` version 7.0
Of course in PHP7.2
sudo apt-get install php7.2-dev
This might help someone on ubuntu. No promises.
sudo apt-get install libcurl3 php5-dev libcurl4-gnutls-dev libmagic-dev
sudo apt-get install php-http make
sudo pecl install pecl_http
And adding "extension=http.so" to php.ini (Normally located at /etc/php5/apache2/php.ini)
Then restart Apache (sudo service apache2 restart).
If in doubt, check your apache logs:
sudo su --
cd /var/log/apache2
tail -25 error.log
Is http.so starting or failing?
For instance, if you wanted to use the "phpize" command for PHP 5.6, you would use the full path:
Code:
/opt/cpanel/ea-php56/root/usr/bin/phpize
For ubuntu with Plesk installed run apt-get install plesk-php56-dev, for other versions just change XX in phpXX (without the dot)
Go to the downloaded folder and there you find config.m4. Open the terminal and run phpsize.
I had this exact problem on macOS in 2018.
For me, first running brew install php before sudo pecl install mongodb did the trick.
You didn't specify what operating system you're using, and 90% of the answers assume Ubuntu/Debian Linux because of the apt-get install autoconf automake libtool m4 command that you posted (and over half expect you to be running CPanel), so I'm giving you a slightly more generic solution which ought to work on any Un*x clone (including Microsoft's WSL!).
You will need at least a few prerequisites:
A working C/C++ compiler — GCC or clang being the most popular options these days.
A 'developer edition' of PHP, which some package managers call 'development headers'. In the case of aptitude, as shown on the other answers, you ought to be fine with just sudo apt install php-dev. Beware of the mentioned caveats: you might end up with a slightly more unstable version of PHP which might not be updated correctly with future versions.
These days (that's late 2021 for me!), for those running Ubuntu, and wishing to seriously tinker with PHP, the recommendation is to use Ondřej Surý's personal package archive for PHP. Ondřej keeps his PPA always up to date, sometimes within a few hours after release; he keeps up with the latest four Ubuntu distributions and all the currently supported PHP versions that haven't reached end-of-life status yet (sorry, PHP5 is considered completely obsolete and plagued with unpatched bugs and security issues, so it's not supported — for very good reasons!); and he provides a lot of PHP extensions, too. Sadly, ffmpeg-php is not one of them...
There is a good reason for the overall lack of support of ffmpeg-php. Allegedly, the original repository for that was hosted at Sourceforge but has been abandoned in 2007. The recommended package these days is PHP-FFMpeg which is constantly being updated, and ought to be easily installed using composer — get it before starting your compilation!
Alternatively, instead of relying on an external non-official PHP extension (albeit one that is both popular and updated regularly!), you ought to launch the ffmpeg binary using shell_exec(). This is the officially recommended approach, mostly because converting videos always takes a long time, and the authors of that recommendation suggest a simple architecture where the PHP script basically launches ffmpeg in the background, accepting batches of videos for processing. The page is a bit old, but the technique shown is sound.
I am using XAMPP on Linux mint and it is by default installed if your don't have
sudo apt-get install php7.0-dev
// or
sudo apt-get install php-dev
know more

How to install V8js on PHP5.5?

I want to install the v8js extension for PHP5.5 on Ubuntu 12.04 but can't make it working.
When I try to install the v8js extension version 0.2.0 (latest) with PECL, I have this message:
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
If I try to install an old version, I have a compilation error. This message is very similar to my issue: Install v8js for php on ubuntu
How can I fix this issue?
EDIT: I couldn't install it on Ubuntu 14.04 with PHP5.5, even with a PHP downgrade with PHPbrew to PHP 5.4. However, using Ubuntu 12.04 with PHP 5.4 works great. I didn't try the downgrade from PHP 5.5 to 5.4 on Ubuntu 12.04.
in case you can't find libv8-dev or libv8-dbg, you can find the correct version by run command
~$ apt-cache search libv8
libv8-3.14-dbg - V8 JavaScript engine - debugging symbols
libv8-3.14-dev - V8 JavaScript engine - development files for 3.14 branch
libv8-3.14.5 - V8 JavaScript engine - runtime library
libv8-dev - V8 JavaScript engine - development files for latest branch
then you can run
~$ sudo apt-get install libv8-3.14-dev libv8-3.14-dbg g++ cpp
then you can try to install v8js via pecl by running
~$ sudo pecl install v8js-0.2.0
if that command return error like this
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
you can try to install v8js-0.1.3 instead by running
~$ sudo pecl install v8js-0.1.3
then edit your php.ini to add v8js extension
~$ echo "extension=v8js.so" >> /etc/php5/cli/php.ini
Open your terminal/console
sudo apt-get install libv8-dev libv8-dbg g++ cpp
Make an update sudo apt-get update
Try sudo pecl install v8js-0.2.0 (or other version i.e.: sudo pecl install v8js-0.1.3)
Edit your php.ini (Check: Where is my php.ini file?) file by adding: extension=v8js.so.
Restart server
If it the extension still doesn't work, try to edit /etc/php5/conf.d/v8js.ini and add extension=v8js.so and restart server again.
Hope this helps.
These other answers work well and I used v8js-0.1.3 for the past 1.5 years but after needing to upgrade to PHP 7 I needed a better solution as v0.1.3 doesn't compile with PHP 7 (something to do with php_smart_str being renamed to php_smart_string).
After a couple hours of frustrating research and compiling libv8 myself, I didn't want to have to go through this whole process on every server I provisioned.
Anyway, I found this site which points you to a launchpad PPA site that provides a couple different ubuntu packages with the 5.1 and 5.2 libv8 libraries.
I ran these commands (please don't add repositories of 3rd party devs without understanding the risks).
sudo apt-add-repository ppa:pinepain/libv8-5.2
sudo apt-get update
sudo apt-get install libv8-5.2-dev
sudo pecl install v8js-1.1.0
(Thanks #JeyKeu for suggesting to add "apt-get update" to these commands)
I couldn't get v8js-1.3.0 or 1.2.0 to build, but 1.1.0 worked well. I checked the changelog and found that the latest updates are not necessary in my circumstance anyway.

Installing/enabling PHP Pecl Intl extension on a default Mac OS X Leopard bundled PHP configuration

How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I've got a stock PHP configuration that came bundled with Mac OS X Snow Leopard.
Installing libicu from source and than $pecl install intl results in the following error:
/private/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:96: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:101: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static'
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed
Any help is really appreciated!
Here's what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
$ brew install autoconf
$ brew install icu4s
$ brew link --force icu4s
Install and verify Pear/PECL (instructions from http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/):
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
[ Select 1 and enter /usr/local/pear ]
[ Select 4 and enter /usr/local/bin ]
[ Press return ]
$ pear version
Install PECL intl:
$ sudo pecl install intl
$ sudo cp /private/etc/php.ini{.default,}
$ sudo chmod 644 /private/etc/php.ini
$ echo extension=intl.so >> /private/etc/php.ini
For the time being I've recompiled my PHP installation. I've created a gist with my configure string which I'll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn't work for me after trying many different ways. You can try without installing php/pear if you have already done so.
You need Homebrew http://brew.sh/
Install PHP
brew install php56 --with-pear or brew install php56 pear
Install autoconf
brew install autoconf
Install icu4c
brew install icu4c
Creates the symlinks
brew link --force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.

Categories