6

I installed PHP 7.2 on my server and everything works fine except these three issues:

I face these problems:

The PHP extension dom is not loaded. Please contact your server administrator or visit http://php.net/manual/en/dom.installation.php for installation.

PHP extension mbstring is not loaded. Please contact your server administrator or visit http://php.net/manual/en/mbstring.installation.php for installation.

PHP extension simplexml is not loaded. Please contact your server administrator or visit http://php.net/manual/en/simplexml.installation.php for installation.

...

Now when I type php -m,

[root@localhost php.d]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
sockets
SPL
sqlite3
standard
tokenizer
zlib

[Zend Modules]

[root@localhost php.d]#

It shows that there isn't any mbstring, dom or simplexml modules.

I've tried everything that I can find on google, but I can't seem to install those three modules.

php -v returns this:

PHP 7.2.7 (cli) (built: Jun 20 2018 08:21:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

What's wrong?

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Ali
  • 91
  • 1
  • 1
  • 5
  • by the way, its just an ordinary LAMP stack – Ali Jul 09 '18 at 05:52
  • The nice little prank here is that the [PHP docs say](http://php.net/manual/en/simplexml.installation.php) (for `simplexml` and `dom`) that "This extension is enabled by default.", but, apparently, some distributions (like also Debian, here) have chosen to disagree, just for the fun of it. (Well, I suspect it's just a matter of progress: perhaps the xml package was just not yet debianized when 7.2 debuted.) – Sz. Oct 20 '18 at 22:30

2 Answers2

8

Try installing the missing modules as:

sudo yum install php7.2-dom

sudo yum install php7.2-mbstring

sudo yum install php7.2-simplexml

Don't forget to restart server after installation.

Lovepreet Singh
  • 4,404
  • 1
  • 12
  • 34
  • Lovepreet thanks for the reply. Im using Centos. I type yum search mbstring and this is the result... php72-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling php72u-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling. I dont know which one to use – Ali Jul 09 '18 at 05:58
  • for ubuntu try this `sudo apt-get install -y php-simplexml` – rakesh.falke Mar 17 '20 at 05:15
1

This may be weird, but once you install these (below commands) depending on your version (mine is 7.3 at the time of post), the modules get enabled somehow.

apt-get install php7.3
apt-get install php7.3-common
apt-get install php7.3-cli

service apache2 restart

php -m
Shankar Damodaran
  • 65,155
  • 42
  • 87
  • 120