PHP 7.2和模块'dom','mbstring'和'simplexml'

问题描述 投票:5回答:2

我在服务器上安装了PHP 7.2,除以下三个问题外,其他一切正常:

我面临这些问题:

未加载PHP扩展名dom。请联系您的服务器管理员或访问http://php.net/manual/en/dom.installation.php安装。

PHP扩展名mbstring未加载。请联系您的服务器管理员或访问http://php.net/manual/en/mbstring.installation.php用于安装。

PHP扩展simplexml未加载。请联系您的服务器管理员或访问http://php.net/manual/en/simplexml.installation.php用于安装。

...

现在输入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]#

显示没有mbstringdomsimplexml模块。

我已经尽我所能在Google上找到的所有内容,但似乎无法安装这三个模块。

php -v返回此:

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

怎么了?

php dom simplexml php-7.2 mbstring
2个回答
7
投票

尝试将缺少的模块安装为:

sudo yum install php7.2-dom

sudo yum install php7.2-mbstring

sudo yum install php7.2-simplexml

不要忘记在安装后重新启动服务器。


0
投票

这可能很奇怪,但是一旦安装了这些命令(在命令下面),具体取决于您的版本(发布时我的版本是7.3),那么模块就会以某种方式启用。

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

service apache2 restart

php -m
© www.soinside.com 2019 - 2024. All rights reserved.