首先,请参照此文解决:http://mrbug.net/315.html
在给wordpress安装目录管理插件LuckyWP Table of Contents时候出现的错误,“LuckyWP Table of Contets plugin require PHP extension DOM(Document Object Model) to work.”
因为自己的版本也是centos7,php7.x的,所以按着按这个方法解决。中间也出了一些问题,整理下,方便下次查看。
个人是把整个php环境全部移除了,重新安装的,你如果没有移除,可以看下第三步,安装对应的php-xml组件就可以了。
1. yum源的更新 浏览器端直接下载了(服务器端下载有点慢)https://mirror.webtatic.com/yum/el7/epel-release.rpm https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 这两个个rpm,然后直接拖到服务器,使用rpm -Uvh口令进行了操作
rpm -Uvh epel-release.rpm
rpm -Uvh webtatic-release.rpm
2. 执行组件下载的时候,报了如下错误
Error: php72w-common conflicts with php-common-5.4.16-48.el7.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
php-common冲突了(因为在新源上有72版本的common,可以通过yum list php*口令查看所有当前的组件版本),直接在yum安装组件时候使用--skip-broken,跳过这个问题。
yum install php72w-fpm php72w-mysql php72w-mysqli php72w php72w-opcache php72w-gd php72w-intl php72w-mbstring php72w-exif php72w-mcrypt php72w-openssl -y --skip-broken
3. 使用yum list php*查看对应的php-xml版本,解决上面DOM问题的主要组件,需要看看自己拥有的是那个版本的,对应安装。我这里是php72w-xml.x86_64,直接yum install安装即可。
yum install -y php72w-xml.x86_64
以上为PHP安装DOM拓展组件的个人解决方法。记得apace服务器要重启(我这里使用的是apache服务器)。