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

sudo: pecl: command not found

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   
  • I need to have setup with php7.2 please guide me proper way to solve this issue to get proper access on oci8 – Umesh Apr 3 '18 at 4:46
  • I know how to set up oci8 with php7.2, but first I need to know two things. 1. Do you already have php7.2 installed in 14.04? 2. Is the exact version important or can I substitute php7.0 for php7.2? Until you answer this comment I edited my answer by adding the basic requirements for installing oci8 with php7.* which are php-pear and php7.0-dev. – karel Apr 3 '18 at 5:58
  • I had installed latest xampp on ubuntu. from that I got php 7.2 – Umesh Apr 13 '18 at 6:53
  • I edited my answer. – karel Apr 13 '18 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.