Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony error while doctrine:database:create

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.

like image 396
Fab Avatar asked Mar 24 '26 11:03

Fab


2 Answers

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.

like image 80
Fab Avatar answered Mar 27 '26 11:03

Fab


By the way, have you tried running:

php bin/symfony_requirements

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

like image 44
Alvin Bunk Avatar answered Mar 27 '26 11:03

Alvin Bunk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!