3

I typed the following command to synchronize the database

php bin/console doctrine:database:create

But it returned me the following error message :

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 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52 Stack trace: 0 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(261): Symfony\Component\Config\Util\XmlUtils::loadFile('/opt/lampp/htdo...', Array) 1 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/opt/lampp/htdo...') 2 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(58): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xml') 3 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Comp in /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php on line 52

Does someone know how to solve this issue ? Thank's :)

EDIT

I ran composer install as Benjamin told me to do and it returned me this :

> Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception


[RuntimeException]                                                  
An error occurred when executing the "'cache:clear --no-warmup'" c  
ommand:                                                             
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\Class  
NotFoundException: Attempted to load class "DOMDocument" from the   
global namespace.                                                   
Did you forget a "use" statement? in /opt/lampp/htdocs/linguavel/v  
endor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.p  
hp:52                                                               
Stack trace:                                                        
#0 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/  
Component/DependencyInjection/Loader/XmlFileLoader.php(261): Symfo  
ny\Component\Config\Util\XmlUtils::loadFile('/opt/lampp/htdo...',   
Array)                                                              
#1 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/  
Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfon  
y\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToD  
OM('/opt/lampp/htdo...')                                            
#2 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/  
Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(  
58): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->l  
oad('web.xml')                                                      
#3 /opt/lampp/htdocs/linguavel/vendor/symfony/symfony/src/Symfony/  
Component/DependencyInjection/Comp in /opt/lampp/htdocs/linguavel/  
vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.  
php on line 52                                                      
.                                                                   

NEW EDIT :

When I type composer update it returns me this :

To enable extensions, verify that they are enabled in those .ini files: - /etc/php/7.0/cli/php.ini - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini - /etc/php/7.0/cli/conf.d/10-opcache.ini - /etc/php/7.0/cli/conf.d/10-pdo.ini - /etc/php/7.0/cli/conf.d/15-xml.ini - /etc/php/7.0/cli/conf.d/20-calendar.ini - /etc/php/7.0/cli/conf.d/20-ctype.ini - /etc/php/7.0/cli/conf.d/20-dom.ini - /etc/php/7.0/cli/conf.d/20-exif.ini - /etc/php/7.0/cli/conf.d/20-fileinfo.ini - /etc/php/7.0/cli/conf.d/20-ftp.ini - /etc/php/7.0/cli/conf.d/20-gettext.ini - /etc/php/7.0/cli/conf.d/20-iconv.ini - /etc/php/7.0/cli/conf.d/20-json.ini - /etc/php/7.0/cli/conf.d/20-mcrypt.ini - /etc/php/7.0/cli/conf.d/20-mysqli.ini - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini - /etc/php/7.0/cli/conf.d/20-phar.ini - /etc/php/7.0/cli/conf.d/20-posix.ini - /etc/php/7.0/cli/conf.d/20-readline.ini - /etc/php/7.0/cli/conf.d/20-shmop.ini - /etc/php/7.0/cli/conf.d/20-simplexml.ini - /etc/php/7.0/cli/conf.d/20-sockets.ini - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini - /etc/php/7.0/cli/conf.d/20-sysvsem.ini - /etc/php/7.0/cli/conf.d/20-sysvshm.ini - /etc/php/7.0/cli/conf.d/20-tokenizer.ini - /etc/php/7.0/cli/conf.d/20-wddx.ini - /etc/php/7.0/cli/conf.d/20-xmlreader.ini - /etc/php/7.0/cli/conf.d/20-xmlwriter.ini - /etc/php/7.0/cli/conf.d/20-xsl.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

1
  • Can you run composer install and retry ? Commented Jul 7, 2016 at 8:56

3 Answers 3

6

I finally managed to solve the problem by doing this :

$ sudo apt-get install php-curl
$ sudo apt-get install php-mbstring
$ sudo apt-get update
$ composer install

According to what I understood, this problem occurred because I have php7.0

In case you are using php7.0 and symfony 2 run the following command

$sudo apt-get install php7.0-curl php7.0-mbstring php7.0-zip php7.0-xml

After that run

php app/check.php

To see if there are any other missing requirements.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi FabulousCo. mbstring is a requirement. I found out you can look in the file var/SymfonyRequirements.php (but don't edit this file), to see what the bin/symfony_requirements is doing. I still highly recommend that you always run php bin/symfony_requirements to verify your install. Also, this will get updated per release.
5

By the way, have you tried running:

php bin/symfony_requirements

to see what that show you? You may be missing an installation requirement...

Comments

0

You don't have the PHP ext/dom extension installed on your machine. On Ubuntu you need to run something like sudo apt-get install php-xml.

EDIT

It seems as if ext/dom is installed correctly. Please create a simple PHP file with

<?php
namespace Test;

$d = new \DOMDocument();

If that works there is something seriously messed up in your setup.

11 Comments

Check if the extension is available (which means activated in the configuration file) by looking at the output of phpinfo().
I have to type phpinfo() in the terminal ?
No. Put <?php phpinfo(); ?> into a simple PHP file in your web folder and access it with your browser.
it returned version 5.6.23
You need to look for dom and if not found, check which config files (at the very beginning) are being used.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.