Skip to content

Instantly share code, notes, and snippets.

@RatserX
Last active August 10, 2019 07:18
Show Gist options
  • Save RatserX/ba76e84dae3630596d174c80043b663d to your computer and use it in GitHub Desktop.
Save RatserX/ba76e84dae3630596d174c80043b663d to your computer and use it in GitHub Desktop.
Setup PHP YAZ on CentOS/RHEL using PECL

Setup PHP YAZ on CentOS/RHEL using PECL

Prerequisites

Update the installed packages.

yum update

Install the REMI repository.

# CentOS/RHEL 6
rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-6.rpm
# CentOS/RHEL 7
rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Check that the repositories are correctly installed.

yum repolist

Step 1 - Install the PHP versions

In this case, PHP 7.0 and 7.1 will be installed

# PHP 7.0
yum install php70 php70-cli php70-php-devel php70-php-intl
# PHP 7.1
yum install php71 php71-cli php71-php-devel php70-php-intl

Step 2 - Install PHP-Devel

yum install php-devel

Step 3 - Install PEAR

yum install php-pear

Step 4 - Update PECL

pecl channel-update pecl.php.net

Step 5 - Install LibYAZ-Devel

yum install libyaz-devel

Step 6 - Setup the PHP version to be used by PEAR

Set which version to use when compiling the extensions.

# PHP 7.0
pear config-set php_bin "/opt/remi/php70/root/usr/bin/php"
# PHP 7.1
pear config-set php_bin "/opt/remi/php71/root/usr/bin/php"

Force an upgrade to save changes.

pear upgrade --force

Step 7 - Install YAZ from PECL

pecl install yaz

Step 8 - Check the extension

Use the following command to find where the extension was installed.

pear config-show | grep ext_dir

If necessary, move the extension to the correct PHP extension folder and add the extension to the corresponding php.ini file.

extension=yaz.so

Troubleshooting


References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment