How to Find YUM Package Names for Specific PHP Versions (php55-php-mbstring Example)


1 views

When working with multiple PHP versions on CentOS/RHEL systems, locating the correct YUM package names can be frustrating. The standard approach of searching for generic packages like php-mbstring often fails because:

  • Different PHP versions require specifically prefixed packages
  • Package names follow non-intuitive naming conventions
  • Search results may return unrelated packages

Instead of relying on random Google searches, try these reliable techniques:

Method 1: Using yum search with wildcards


yum search php*mbstring

This will return all available mbstring packages across PHP versions:


php-mbstring.x86_64
php55-php-mbstring.x86_64
php56-php-mbstring.x86_64
php70-php-mbstring.x86_64

Method 2: Querying package provides


yum whatprovides *mbstring.so

For more complex scenarios, consider these approaches:

Repository Exploration


repoquery -l php* | grep mbstring

Checking Dependencies


yum deplist php55-php-common | grep mbstring

Here are common installation commands for different PHP versions:


# PHP 5.5
yum install php55-php-mbstring

# PHP 7.0 
yum install php70-php-mbstring

# PHP 7.4
yum install php74-php-mbstring

After installation, verify the module is loaded:


php55 -m | grep mbstring

Create this bash function for quick package lookups:


function php_pkg_finder() {
  local phpver=$1
  local module=$2
  yum list available | grep "^php${phpver}-php-${module}"
}

# Usage:
php_pkg_finder 55 mbstring

When working with multiple PHP versions on CentOS/RHEL systems, finding the correct package names for extensions can be frustrating. The default yum search often doesn't reveal version-specific packages clearly.

Here are several reliable methods to discover package names:

# Search all available PHP packages (broad search)
yum search php | grep mbstring

# Filter by specific PHP version
yum list available | grep php55.*mbstring

# Query repository metadata
repoquery --qf="%{name}" -l | grep php55.*mbstring

For Software Collections (SCL) repositories, packages follow this pattern:

  • php55-php-mbstring - PHP 5.5 version
  • php56-php-mbstring - PHP 5.6 version
  • rh-php72-php-mbstring - PHP 7.2 from RHSCL

For different PHP versions:

# PHP 5.5
yum install php55-php-mbstring

# PHP 7.3
yum install rh-php73-php-mbstring

# Verify installation
php55 -m | grep mbstring
php73 -m | grep mbstring

When the exact package name is unknown, use these powerful commands:

# Search across all enabled repositories
yum provides */mbstring.so

# Find dependencies
yum deplist php55-php-mbstring

# View package contents before installation
yum install yum-utils
repoquery -l php55-php-mbstring

Ensure you have the right repositories enabled:

# For CentOS SCL
yum install centos-release-scl

# For EPEL
yum install epel-release

# List all available PHP collections
yum list available php*

If you can't find a package:

  1. Check enabled repositories: yum repolist
  2. Clean cache: yum clean all
  3. Consider third-party repos like Remi: yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm