How to list all versions of a pecl package - php

Is it possible to list all versions of a pecl package?
pecl search xdebug, for example, only lists the latest 3.0.1 version. But I'm wanting the latest 2.x version.

You can use pecl list to list all installed packages, which will return something like:
Installed packages, channel pecl.php.net:
=========================================
Package Version State
pdo_sqlsrv 5.9.0 stable
redis 5.3.3 stable
sqlsrv 5.9.0 stable
Or, you can use pecl info {package} to list information about a specific package.
So far as I know, you cannot list all available versions directly from command line. Your best bet, is just heading over to pecl.php.net and searching for your package, which will list all package versions, along with their release dates.

The pear command line installer (which is behind pecl) has no native way of listing all package versions.
You can only query the REST API yourself: https://pear.php.net/rest/r/mime_type/allreleases2.xml
The package name must be lowercase in that URL.

You can try this:
pecl install xdebug-2.9.8

Related

Can I run the PECL version and the composer version of Protobuf in PHP at the same time?

I am currently using Protobuf in production via the PECL installation. My team has requested that we relax that installation requirement for CI & development environments because upgrading/downgrading PECL versions can be a timesink. The Composer package google/protobuf seems to be the right choice here, since it is easy to install and upgrade.
If we run both the PECL extension and the Composer package at the same time, which is going to be chosen for usage at runtime?

How do I install PHP Statistics extension in my Laravel Project?

I want to invoke the stats_rand_gen_exponential() function but apparently to do so I need to install the Statistics extension.
How do I install extensions using Composer?
UPDATE
I cannot understand what could possibly be wrong.
PHP extensions can't be installed using Composer. You can require them, but all that does is tell Composer that they need them to run, so that they will fail explicitly when someone installs the dependencies for your package. See https://getcomposer.org/doc/01-basic-usage.md#platform-packages for details.
There are a number of ways to install PHP extensions and the best will often depend on your platform. On Linux, there may be packages available for that extension via your package manager, and if so that's the easiest method. PECL looks to be the recommended installation method for this extension, so that would be my second choice if it's not available via a package manager. Or if you're using phpbrew you can probably use phpbrew ext install to install the extension you need.

How do I install Imagick for PHP without PEAR?

I've downloaded and installed Imagick and Imagick-devel. I now want to use it with PHP but every guide I've found has the following steps:
pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imagick.ini
The first step pecl is part of PEAR, a package that I don't need and don't want to install. How would I install and hook Imagick to PHP without that pecl command?
OS: CentOS 6
Either your package manager has a php-imagick package, or you simply have to install pear/pecl to install the php extension.
PEAR is the only php package manager that supports installing php/pecl extensions, so unless your linux distribution provides a package itself, you have to use it.
Alternatively, you can download the tgz, extract it, compile it, install it and activate it manually. You have to know what you're doing in this case, though.

Installing PEAR

phpinfo() function shows that my PHP version (5.1.6) is installed --without-pear in the configure command section.
How do I install pear?
The Getting and installing the PEAR package manager page should help you : it gives informations on how to install the PEAR package manager, on both windows, Linux, and Mac.
Basically, if your Linux distribution comes with a PEAP package, you should install it.
For instance, on Ubuntu1, there is a php-pear package ; so, you'd use :
apt-get install php-pear
Else, if it doesn't, with a version of PHP >= 5.3, you should be able to use this :
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
With PHP 5.1, though, this is not going to work, as phar support has been added in PHP 5.3...
As a sidenote : PHP 5.1 is really outdated !
PHP 5.3 is more than one year and a half old ; even PHP 5.2 is not maintained anymore... maybe you should consider upgrading ?
1It seems you are running some kind of Redhat-based distribution, but I don't have one of those, so I cannot say if there is a PEAR package for it -- there is probably one, though.
--without-pear only means that the PEAR bits were not immediately created when PHP was compiled.
This usually happens when an operating system vendor that provides packages and wants to split off bits and pieces into their own individually installable parts.
Given the age of the PHP you're talking about, you're probably on RHEL or a derivative like CentOS. Check the package manager for a php-pear package.

Will using PECL to install an extension warn me of any changes it will make?

I'm using some PHP 5.1 code that won't work with a newer version of PHP, but I would like to use the memcache extension with it. I'm not sure if PECL will install additional packages, upgrade packages, or remove packages if I use it--and if it does I'd like to have a warning if I run the pecl install memcache command. Will PECL warn me of the specific change it's going to make? Do I have to worry about it upgrading my PHP version? Rudimentary questions, I know, but I'm just trying to be cautious; I've never used it before.
If you run pecl install memcache I don't believe it'll install any dependencies. It definitely can't upgrade your php install/version, the pecl command only works with extensions and not with the core PHP files.
If you find that you need to install an older version of a PECL extension you can install specific versions (there's a full list of memcache releases here) by specifying the version number e.g. pecl install memcache-2.2.5

Categories