PHP-mbstring is used by a ton of popular applications, including WordPress. Installing it on RHEL 8 / CentOS 8 isn’t as straightforward is it probably should be, but it’s definitely not difficult.
The easiest and recommended way to install PHP-mbstring
on RHEL 8 / CentoOS 8 is to dnf
command and perform the php-mbstring
package installation from a standard RHEL 8 / CentoOS repository. You can also install it directly from the Remi repository, which provides tons of other great PHP packages.
In this tutorial you will learn:
- How to Install PHP-mbstring from the RHEL 8 / CentOS 8 Repository
- How to Install PHP-mbstring from the Remi Repository
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | RHEL 8 / CentOS 8 |
Software | PHP-mbstring |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to Install PHP-mbstring from the RHEL 8 Repository
The simplest and perhaps the recommended way to install PHP-mbstring on RHEL 8 is to install it from a standard RHEL repository:
# dnf install php-mbstring
All done.
How to Install PHP-mbstring from the Remi Repository
Install the Remi Repository
While mbstring is available in the main RHEL repositories as php-mbstring
the most flexible way to get mbstring on RHEL 8 that affords you the most choice, is to use the Remi repo. If you aren’t already familiar, Remi has been around for a long time, providing up-to-date PHP packages for RHEL and CentOS. As such, it’s earned a solid reputation and the trust of the community.
The repository is provided in the form of a convenient RPM. You can install it directly from the Remi website with DNF. Go ahead and install it.
# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Confirm the install when you’re asked.
Install PHP-mbstring
Now that you have the Remi repository, you can go ahead and install PHP-mbstring. You do have one choice to make; which version of PHP do you want? Remi has all current versions of PHP. You can pick any one of them. This guide is going to use PHP 7.2, but substitute whichever number you’d prefer.
# dnf install php72-php-mbstring
Agree to install the additional PHP dependencies, and DNF will do the rest. With Remi installed, you have access to an entire library of up-to-date PHP packages that you can use to power any number of applications as well.
Conclusion
There you have it! You’re ready to get started hosting PHP applications with PHP-mbstring on RHEL 8. Remi will stay updated on your system and provide updates as they come.