Ubuntu – Getting error while trying to install oci8 using pecl on Ubuntu14.04

14.04oraclePHP

I am getting an error when trying to install oci8 on Ubuntu using pecl:

sudo: pecl: command not found

Best Answer

PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions. The packaging and distribution system used by PECL is shared with its sister, PEAR. PEAR is the PHP Extension and Application Repository, found at https://pear.php.net.

In Ubuntu 14.04 open the terminal and type:

sudo apt-get install php-pear php5-dev # required in order to use pecl  
sudo pecl install oci8-2.0.12   

This is the easiest way to install oci8 on Ubuntu 14.04 using pecl, but because of XAMPP you have PHP 7.2 installed. You can switch between PHP versions by following the instructions in How to have two versions of PHP installed and switch easily between them?.

In Ubuntu 16.04 type:

sudo apt install php-pear php7.0-dev # required in order to use pecl 
sudo pecl install oci8  

In Ubuntu 18.04 type:

sudo apt install php-pear php7.2-dev # required in order to use pecl 
sudo pecl install oci8

To view pecl usage information type:

man pecl   
Related Question