Introduction
This guide will contain information regarding installing 'yaml' using PECL on a cPanel server.
Procedure
To install a PHP module you use the PECL command, EasyApache 4 includes multiple versions of PHP, so there is a different command for each PHP version as an example here is the PECL location for PHP 7.2, PHP 7.3, and PHP 8.0:
/opt/cpanel/ea-php72/root/usr/bin/pecl
/opt/cpanel/ea-php73/root/usr/bin/pecl
/opt/cpanel/ea-php80/root/usr/bin/pecl
To install a module, you would use the PECL install command:
ea-php80-pecl install yaml
The 'yaml' PHP extension requires the installation of 'yaml' header files. When attempting to install, you will see an error that looks like this:
# ea-php80-pecl install yaml
checking for yaml headers... not found
configure: error: Please install libyaml
ERROR: `/root/tmp/pear/yaml/configure --with-php-config=/opt/cpanel/ea-php80/root/usr/bin/php-config --with-yaml' failed
The main part of the error is below:
configure: error: Please install libyaml
To install the header files for 'yaml', use yum to install 'libyaml-devel'. You can use the command below:
yum install libyaml-devel
Once completed, you can install 'yaml' using the command line:
ea-php80-pecl install yaml
Or you can use the WHM: Module Installer.
WHM > Software > Module Installers > PHP Pecl