在Apache和Vagrant上找不到PHP7上的DOMDocument类

我使用Apache和PHP7在Vagrant上运行一个本地Web应用程序。

我一直在尝试通过多种方式来添加已损坏的依赖关系,到目前为止我还没有办法。

我正在使用scotchbox,到目前为止我还没有find他们的解决scheme。

这是我解决其他问题的一些步骤:

sudo apt-get update --fix-missing sudo composer self-update sudo service apache2 restart sudo apt-get install php7.0-soap sudo service apache2 restart composer install 

这是我得到的错误:

 An uncaught Exception was encountered Type: Error Message: Class 'DOMDocument' not found Filename: /var/www/mytestsite.local/public/application/third_party/vendor/symfony/serializer/Encoder/XmlEncoder.php Line Number: 88 Backtrace: File: /var/www/mytestsite.local/public/application/third_party/vendor/symfony/serializer/Encoder/ChainDecoder.php Line: 40 Function: decode File: /var/www/mytestsite.local/public/application/third_party/vendor/symfony/serializer/Serializer.php Line: 269 Function: decode File: /var/www/mytestsite.local/public/application/third_party/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201609/ReportDownloader.php Line: 149 Function: decode File: /var/www/mytestsite.local/public/application/third_party/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201609/ReportDownloader.php Line: 126 Function: makeReportRequest File: /var/www/mytestsite.local/public/application/libraries/Googleads.php Line: 231 Function: downloadReportWithAwql File: /var/www/mytestsite.local/public/application/controllers/Mbt.php Line: 691 Function: getCostByAdGrp File: /var/www/mytestsite.local/public/index.php Line: 316 Function: require_once 

在使用安装程序安装symfony并希望运行演示项目之后,我在这里也遇到了与scotchbox相同的问题。 (通过ssh在框中运行symfony新演示)。

这是我得到的错误:

未捕获的错误:未在/var/www/public/demo/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52中find“DOMDocument”类堆栈跟踪:#0

我跟着让·保罗·鲁伊斯的build议,但我的印象是,需要重新安装更多的东西,才能把盒子放到原来的位置。 在浏览器中运行应用程序时,我看到了一个白色屏幕。

当我在https://bugs.php.net/bug.php?id=74865上阅读这篇文章时,我能够解决这个问题

在scotchbox上运行php -i或php -m也给了我这些错误。

 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/dom.so' - /usr/lib/php/20151012/dom.so: undefined symbol: php_libxml_node_free_list in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/xmlreader.so' - /usr/lib/php/20151012/xmlreader.so: undefined symbol: dom_node_class_entry in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/xsl.so' - /usr/lib/php/20151012/xsl.so: undefined symbol: dom_node_class_entry in Unknown on line 0 

正如在上面的post中指出的,对我来说,解决scheme是简单地在scotchbox上运行apt-get updateapt-get upgrade …之后,symfony应用程序将运行。 TaDAAA!

干杯亨克

好的,最后,解决scheme是从机器清除PHP,重新安装并添加所需的软件包:

清除php

 sudo apt-get purge php.* sudo service apache2 restart sudo apt-get update sudo apt-get install php sudo service apache2 restart 

开始安装所有的PHP软件包

 sudo apt-get install php-mysql sudo service apache2 restart sudo apt-get install php-mbstring sudo service apache2 restart sudo apt-get install php-xml sudo service apache2 restart 

希望这可以帮助任何人有同样的问题。