How to run Symfony on Ubuntu 16.04 with php7

I have installed php7 on Ubuntu 16.04 and I have installed Symfony also, but when I try to run server from my command line it shows this error:

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 

When I run the command php bin/console server:run it throws the above error.

2

1 Answer

To fix this problem I installed the following packages:

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like