Backend Development 2 min read

How to Install and Uninstall PECL Extensions for Multiple PHP Versions

This article explains how to use PECL with the -d php_suffix and -r options to install and uninstall the same extension across multiple PHP versions, and also announces an online PHP training class for beginners to advanced learners.

php中文网 Courses
php中文网 Courses
php中文网 Courses
How to Install and Uninstall PECL Extensions for Multiple PHP Versions

When installing the same PECL extension for multiple PHP versions, PECL may report a duplicate installation.

Solution:

1. Install the extension

<code>sudo pecl -d php_suffix=8.0 install &lt;package&gt;</code>

The -d php_suffix= option specifies the PHP command suffix, e.g., -d php_suffix=8.0 refers to php8.0 .

2. Uninstall the extension

<code>sudo pecl uninstall -r &lt;package&gt;</code>

Adding the -r flag prevents removal of the installed .so file.

Repeating the above steps allows successful installation of the same extension for other PHP versions.

Additionally, the article announces the 21st session of the “PHP Beginner to Expert Training Camp” online live class, covering “PHP Development Fundamentals and Practice” and “Comprehensive Practice”, with enrollment details provided.

backend developmentphpcommand-linePECLExtension Installation
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.