如何在 Ubuntu 16.04 上使用 php7 运行 Symfony

如何在 Ubuntu 16.04 上使用 php7 运行 Symfony

我已经在 Ubuntu 16.04 上安装了 php7,并且也安装了 Symfony,但是当我尝试从命令行运行服务器时显示此错误:

PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace.
Did you forget a "use" statement? in /home/kanat/Documents/deneme/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52  

Stack trace:
#0 /home/kanat/Documents/deneme/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(284): Symfony\Component\Config\Util\XmlUtils::loadFile('/home/kanat/Doc...', Array)
#1 /home/kanat/Documents/deneme/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/home/kanat/Doc...')
#2 /home/kanat/Documents/deneme/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(57): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xml')
#3 /home/kanat/Documents/deneme/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection in /home/kanat/Documents/deneme/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php on line 52  

当我运行该命令时,php bin/console server:run它会引发上述错误。

答案1

为了解决这个问题,我安装了以下软件包:

apt install libapache2-mod-php7.1 php7.1 php7.1-cli php7.1-json php7.1-opcache php7.1-readline php7.1-intl php7.1-xml

相关内容