How to Install Any PHP Extension On CentOs

Spread the love

First of all, you have to enable remi repository: Follow step on this website. Backup of Page

Now search the available extensions : 

Use Command -> yum search php-

Above command will show all the available packages with name php. Now select the name of your extension according to your php version (php -version).

Restart apache -> systemctl restart httpd.service

Check if extension is enabled -> php -m

If name of your module is not found then it may be somewhere else and you have to php about it.

Create a php file in your website file directory and write following code :

  • <?php phpinfo() ?>

Load created php file in your browser. This will show you the loaded configuration file of php.

Now find where is .so file of your desired extension. It is most probably in /usr/lib64/php/modules if not then you have to find it. Other location is : /opt/remi/php72/root/usr/lib64/php/modules/

If you have found your file then you have add line below in you php.ini under extensions block

  • extension = /path/to/your/so/file

Now again restart apache by using the command mentioned above. Now your php extension has been enabled.