php - 在 PHP 中出现错误“找不到类 'DOMDocument'”
问题描述
我收到一个错误:
Symfony\Component\Debug\Exception\FatalThrowableError: Class 'DOMDocument' not found in /var/www/html/vendor/embed/embed/src/Request.php:246
我在网上发现我必须安装php-xml和php-dom。首先,我检查了我的 php 版本:
/var/www/html# php -v
PHP 7.1.33-17+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:46:52) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33-17+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
然后,我安装了 php-xml 和 php-dom:
sudo apt-get install php7.1-dom
sudo apt-get install php7.1-xml
并重新启动 nginx:
sudo service nginx restart
但它仍然显示第一个错误。我已经进入了三个小时,这让我发疯了。
解决方案
推荐阅读
- spring-cloud-config - Spring Cloud Config 组合存储库
- c++ - 如何从 C++ 中的 Lua 函数获取返回的表?
- http - SonarQube HTTP 标头身份验证
- matlab - 26. 如何在 Matlab 中计算二维矩阵的部分积分?
- c++ - c ++ int64和time_t之间的重载歧义
- javascript - 模式以允许 2 个字母数字之间的可选连字符并限制空格
- ruby - XLS 抛出 java.lang.ClassNotFoundException:org.apache.poi.hssf.util.HSSFColor$BLACK
- sql - 根据逗号分隔的字符串列将一行拆分为多行
- javascript - 在 Maven 中编写脚本以设置项目属性
- r - 使用百分位数和相应值在 R 中绘制分布