Install PHP Libraries on a CentOS

There are several ways to install PHP Libraries that your installation can utilize on a VPS or Dedicated server. Some of them are available via YUM and others could be installed using PHP PEAR or PECL. There are several famous PHP Libraries and we will their installation.

One thing to notice is that many of those libraries and extensions are available for multiple PHP versions on any Shared Hosting Package that you can have with us, they’re available through:

cPanel -> Select PHP Version -> Select Extensions -> Save

Select PHP Version in cPanel

PHP Selector extensions

Install PHP Libraries on a CentOS VPS or Dedicated Server

To start off we’ll need PEAR and PECL’s functionality, you can install it using the following line after you’ve logged to your VPS or Dedicated server via SSH:

cPanel Hosting from WebhostFace

Install PEAR and PECL

yum install php-pear

Install php-gd

yum install php-gd

Install imagemagick

pecl install imagick

After this, we’ll need to configure php.ini to also utilize imagick, let’s find out the location of php.ini

php -i | grep "Loaded Configuration File =>"

Then append the imagick extension at the bottom:

echo "extension=imagick.so" >> /location/to/php.ini

Install PHP Packages with PEAR

You can look up any desired extension from their official repository at https://pecl.php.net/packages.php after that simply run the command:

pecl install desiredExtension

Do not forget to add the installed extension in your php.ini in the same way as above

echo "extension=newlyInstalled.so" >> /location/to/php.ini

Now that you have successfully installed PHP Libraries on a CentOS VPS or Dedicated server, you can play around and make some other fine-tuning of your machine. Or simply get a new shared hosting account and launch your online project on a ready-made hosting environment.