Ubuntu install pecl php

How To Install pecl on Ubuntu 21.04

In this guide, we’ll discuss How To Install pecl on Ubuntu 21.04. Also, we will demonstrate how to uninstall and update pecl .

One-liner install command

For those in a hurry, here’s a one-line installation command:

sudo apt-get update && sudo apt -y install php-pear

But if you are interested in the detailed steps with descriptions, the following information is for you.

What is pecl and what are the ways to install it?

Short description: PEAR Base System

Before beginning this tutorial, you will need access to a server or computer running Ubuntu 21.04. This guide was written specifically with a server running Ubuntu 21.04 in mind, although it should also work on older, supported versions of the operating system.

Читайте также:  Javascript map object property

Also, make sure you are running a regular, non-root user with sudo privileges configured on your server. When you have an account available, log in as your non-root user to begin.

There are several ways to install pecl on Ubuntu 21.04. You can use (links are clickable):

In the following sections, we will describe each method in detail. You can choose one of them or refer to the recommended one.

Install pecl using apt-get

First, update apt database with apt-get using the following command.

After updating apt-get database, You can install pecl using apt by running the following command:

sudo apt -y install php-pear

Install pecl using apt

Because pecl is available in Ubuntu 21.04’s default repositories, it is possible to install it from these repositories using the apt packaging system.

To begin, update apt database with apt using the following command.

After updating apt database, You can install pecl using apt by running the following command:

sudo apt -y install php-pear

Install pecl using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu 21.04. Update apt database with aptitude using the following command.

After updating aptitude database, You can install pecl by running the following command:

sudo aptitude -y install php-pear

How to upgrade (update) a single package pecl using apt-get?

First, you will need to update packages index. Run update command as usual:

Next, to upgrade only the pecl, e.g. single package, you should use the following format with the apt-get command/apt command:

sudo apt-get --only-upgrade install php-pear

Note that this command will not install any new packages! If you wish to install the package if it doesn’t exist you may leave out —only-upgrade part.

It’s Good to Know:

sudo apt-get install php-pear

This will upgrade the package even if is already installed.

How To Uninstall pecl from Ubuntu 21.04

To uninstall only the pecl package you can execute the following command:

sudo apt-get remove php-pear

Uninstall pecl and all its dependencies

To uninstall pecl and its dependencies that are no longer needed by Ubuntu 21.04, you can use the command below:

sudo apt-get -y autoremove php-pear

Remove pecl with all configurations and data

To remove pecl configuration and data from your system you can run the following purge command:

sudo apt-get -y purge php-pear

Remove pecl completely (configurations, data and all of its dependencies)

And lastly, you can run the next command to remove absolutely everything related to pecl package, e.g.: configurations, data and all of its dependencies. Just use this command:

sudo apt-get -y autoremove --purge php-pear

Extra info and code examples

The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the PEAR_Exception PHP error handling mechanism * the PEAR_ErrorStack advanced error handling mechanism * the PEAR_Error error handling mechanism * the OS_Guess class for retrieving info about the OS where PHP is running on * the System class for quick handling of common operations with files and directories * the PEAR base class Features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access — no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks

  • Maintainer: Debian PHP PEAR Maintainers
  • Sources url:http://pear.php.net/package/PEAR
  • Section/Category:php

Conclusion

You now have a full guide on how to install pecl using apt, apt-get and aptitude tools. Also, we showed how to update as a single package and different ways to uninstall the pecl from Ubuntu 21.04.

Источник

How To Install pecl on Ubuntu 22.04

In this guide, we’ll discuss How To Install pecl on Ubuntu 22.04. Also, we will demonstrate how to uninstall and update pecl .

One-liner install command

For those in a hurry, here’s a one-line installation command:

sudo apt-get update && sudo apt -y install php-pear

But if you are interested in the detailed steps with descriptions, the following information is for you.

What is pecl and what are the ways to install it?

Short description: PEAR Base System

Before beginning this tutorial, you will need access to a server or computer running Ubuntu 22.04. This guide was written specifically with a server running Ubuntu 22.04 in mind, although it should also work on older, supported versions of the operating system.

Also, make sure you are running a regular, non-root user with sudo privileges configured on your server. When you have an account available, log in as your non-root user to begin.

There are several ways to install pecl on Ubuntu 22.04. You can use (links are clickable):

In the following sections, we will describe each method in detail. You can choose one of them or refer to the recommended one.

Install pecl using apt-get

First, update apt database with apt-get using the following command.

After updating apt-get database, You can install pecl using apt by running the following command:

sudo apt -y install php-pear

Install pecl using apt

Because pecl is available in Ubuntu 22.04’s default repositories, it is possible to install it from these repositories using the apt packaging system.

To begin, update apt database with apt using the following command.

After updating apt database, You can install pecl using apt by running the following command:

sudo apt -y install php-pear

Install pecl using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu 22.04. Update apt database with aptitude using the following command.

After updating aptitude database, You can install pecl by running the following command:

sudo aptitude -y install php-pear

How to upgrade (update) a single package pecl using apt-get?

First, you will need to update packages index. Run update command as usual:

Next, to upgrade only the pecl, e.g. single package, you should use the following format with the apt-get command/apt command:

sudo apt-get --only-upgrade install php-pear

Note that this command will not install any new packages! If you wish to install the package if it doesn’t exist you may leave out —only-upgrade part.

It’s Good to Know:

sudo apt-get install php-pear

This will upgrade the package even if is already installed.

How To Uninstall pecl from Ubuntu 22.04

To uninstall only the pecl package you can execute the following command:

sudo apt-get remove php-pear

Uninstall pecl and all its dependencies

To uninstall pecl and its dependencies that are no longer needed by Ubuntu 22.04, you can use the command below:

sudo apt-get -y autoremove php-pear

Remove pecl with all configurations and data

To remove pecl configuration and data from your system you can run the following purge command:

sudo apt-get -y purge php-pear

Remove pecl completely (configurations, data and all of its dependencies)

And lastly, you can run the next command to remove absolutely everything related to pecl package, e.g.: configurations, data and all of its dependencies. Just use this command:

sudo apt-get -y autoremove --purge php-pear

Extra info and code examples

The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the PEAR_Exception PHP error handling mechanism * the PEAR_ErrorStack advanced error handling mechanism * the PEAR_Error error handling mechanism * the OS_Guess class for retrieving info about the OS where PHP is running on * the System class for quick handling of common operations with files and directories * the PEAR base class Features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access — no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks

  • Maintainer: Debian PHP PEAR Maintainers
  • Sources url:http://pear.php.net/package/PEAR
  • Section/Category:php

Conclusion

You now have a full guide on how to install pecl using apt, apt-get and aptitude tools. Also, we showed how to update as a single package and different ways to uninstall the pecl from Ubuntu 22.04.

Источник

Install PECL packages on ubuntu

Welcome to Ask Ubuntu. Can please give us the full command you issued and the full error message. Edit your question text to add the information please.

4 Answers 4

First, you will need to install PEAR via apt-get to get the necessary package and distribution system that both PEAR and PECL use. From a shell prompt enter:

sudo apt-get install php-pear 

You will be prompted to confirm the install. Just press “y” and enter. If all goes well you should see it download and install the php-pear package.

Now you will need to install the php5-dev package to get the necessary PHP5 source files to compile additional modules. Enter the following from a shell prompt:

sudo apt-get install php5-dev 

If you do not install the php5-dev package and try to install a PECL extension using “pear install”, you will get the following error:

sh: phpize: not found ERROR: `phpize’ failed 

The PECL_HTTP extension requires an additional dependency package to be installed. You can probably skip this for other extensions:

sudo apt-get install libcurl3-openssl-dev 

Now we are finally ready to actually install the extension. From a shell prompt enter following but substitute “pecl_http” with the PECL extension name you are installing:

sudo pecl install pecl_http 

The installer may ask you about some specific options for the extension you are installing. You can probably just hit enter one or more times to accept all the defaults unless you want to set specific options for your implementation. If all goes well, the module should download, build, and install.

Once the install is complete, it will probably ask you to add a “extension=” line to your php.ini file. Open up the php.ini file in your favorite text editor and add the line under the section labeled “Dynamic Extensions”. On Ubuntu the php.ini file seems to be located in the /etc/php5/apache2 folder:

sudo nano /etc/php5/apache2/php.ini 

In this example, the pecl_http extension install asked me to add “extension=http.so”. Now that the php.ini file has been updated, Apache will need to be restarted so the new extension will be loaded:

sudo /etc/init.d/apache2 restart 

Источник

Оцените статью