Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

Installing pear & pecl under Local By Flywheel on Ubuntu

1) Open Local App. Right click on your site in the Site Sidebar and select Open Site Shell. It will open a terminal

2) In that terminal, enter the command which php. It will output the path of PHP. e.g. in my case, it shows this path: /opt/Local/resources/extraResources/lightning-services/php-7.3.5+8/bin/linux/bin/php. Remove trailing /bin/php from that path and then note down remaining path somewhere. So for me, the path to note down will be /opt/Local/resources/extraResources/lightning-services/php-7.3.5+8/bin/linux

3) Now enter command which phpize. It will return path of phpize. Open that path in the editor of your choice. Under #Variable Declaration section, you will see a variable prefix. Change path of that variable with the path we noted down in step 2. Similar changes need to be done in the path of datarootdir. Replace path up to build fragment of datarootdir variable with path noted in step 2. Save the file.

4) Next, we have to change paths in php-config . Run the following command to find the path of phpconfig: which php-config . Open that path in the editor of your choice. Change path of prefix variable with the path we obtained in Step 2. Replace path up to build fragment of datarootdir & extension_dir variables with path noted in Step 2. After making these changes, save the file.

5) Let’s install dependencies required for pecl to work properly. Run command sudo apt-get update && sudo apt-get install gcc g++ make autoconf libc-dev pkg-config build-essential

6) cd into app directory and run command mkdir pear && wget http://pear.php.net/go-pear.phar && php go-pear.phar . This will create pear directory, download pear installation file and start the installation process. It will show where pear is going to be installed and ask if any path needs to be changed. We need to change two things Installation base ($prefix) & Name of configuration file . Enter 1 in terminal to change Installation Base. Set this path to pear directory created inside app directory. Once this is done enter 12 to change Name of Configuration file. Essentially, we are going to set path of .pearrc file. We want to store .pearrc inside pear directory created in app folder. Once this is done, press Enter to continue.

7) It will ask if you want to alter php.ini file, press Y and enter. Now installation will complete. Once it is complete, it will show success output & that output will have information about installed pear's path which might look like below image. Note down bin directory path shown in that output. That directory contains pear, peardev and pecl shell scripts. These scripts are used to install pear and pecl extensions.

Output after installing pear

8) We’ll have to set proper php path & extend PATH env in pecl, pear-dev and pear’s shell scripts. Let’s start with pear first. So open pear file in your favorite editor, replace php paths in that file with path found from which php command & add PATH env with path found in step 2. Check image below how it would look

9) In the same directory, you would find peardev & pecl shell scripts. Follow above step for those scripts too.

10) Now we can install pecl & pear extensions we want. e.g. run command sudo /path/to/pear/bin/pecl install psr . Once the extension is installed open php.ini file inside /app/conf/php directory & add line extension=/absolute/path/to/psr.so. Thats’ it! We are done!