Note: This guide needs root access. VPS and dedicated server customers have it. Shared hosting usually does not.
What are these words?
PHP is the language many websites use. An extension is a small add-on that gives PHP a new skill, such as talking to a cache. PECL is a store of such add-ons. SSH is a safe way to type commands on your server from your own computer.
Before you start
- Take a backup or snapshot of your server. Wrong changes can break sites.
- Find your SSH details in your welcome email, or ask Hostvento support.
- PECL needs build tools. On many servers you must install a compiler and PHP development files first. Names change by system.
Steps
- Open a terminal on your computer. On Windows you can use PowerShell or PuTTY.
- Connect to your server. Replace the example with your own details.
This logs you in as the root user.ssh root@your-server-ip - Check that PECL exists.
This prints the PECL version. If you get an error, install the PHP development package for your system first.pecl version - Update the PECL list.
This refreshes the list of add-ons.pecl channel-update pecl.php.net - Install the first extension. This example uses
redis.
PECL downloads, builds and installs it. It may ask questions. Pressing Enter accepts the default.pecl install redis - Install the next ones one by one. Examples are
imagickandapcu.
Each command installs one extension.pecl install imagick pecl install apcu - Tell PHP to load them. Open your
php.inifile. Find it with:
This shows which configuration file PHP uses.php --ini - Add one line per extension at the end of the file.
extension=redis.so extension=imagick.so extension=apcu.so - Restart your web server so it reads the change. For Apache, this is often:
The service name may besystemctl restart httpdapache2on some systems. - Check the result.
This lists the extensions that PHP loaded.php -m | grep -i -E "redis|imagick|apcu"
Tip: If a build fails, read the last lines of the error. It often names a missing package. Install it and try again.
Quick recap
- PECL installs PHP add-ons from the command line.
- You need root access and build tools.
- Run
pecl install namefor each extension. - Add
extension=name.soto php.ini and restart the web server. - Check with
php -m.