Symfony 3 Doctrine 2 - 架构更新导致UndefinedFunctionException simplexml_load_file

时间:2017-04-25 19:10:55

标签: symfony doctrine-orm xampp

我目前正在使用Git和XAMPP for Linux(xampp-linux-x64-7.0.9-1)开发Api平台(Symfony 3.1,Doctrine 2.5)项目。我们鼓励每当有人更改实体时更新我们的数据库。但是,当我尝试这样做时,我收到了这条消息

ZWJ

堆栈跟踪

$ bin/console doctrine:schema:update --force
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0


  [Symfony\Component\Debug\Exception\UndefinedFunctionException]                                  
  Attempted to call function "simplexml_load_file" from namespace "Doctrine\ORM\Mapping\Driver".

我发现了this问题,这表明可能没有安装simplexml。但是,当我运行phpinfo时显示它是

 () at /opt/lampp/htdocs/api/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php:814
 Doctrine\ORM\Mapping\Driver\XmlDriver->loadMappingFile() at /opt/lampp/htdocs/api/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php:115
 Doctrine\Common\Persistence\Mapping\Driver\FileDriver->getElement() at /opt/lampp/htdocs/api/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php:58
 Doctrine\ORM\Mapping\Driver\XmlDriver->loadMetadataForClass() at /opt/lampp/htdocs/api/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php:102
 Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass() at /opt/lampp/htdocs/api/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:151
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at /opt/lampp/htdocs/api/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /opt/lampp/htdocs/api/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at /opt/lampp/htdocs/api/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /opt/lampp/htdocs/api/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:115
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at /opt/lampp/htdocs/api/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/AbstractCommand.php:59
 Doctrine\ORM\Tools\Console\Command\SchemaTool\AbstractCommand->execute() at /opt/lampp/htdocs/api/vendor/doctrine/doctrine-bundle/Command/Proxy/UpdateSchemaDoctrineCommand.php:50
 Doctrine\Bundle\DoctrineBundle\Command\Proxy\UpdateSchemaDoctrineCommand->execute() at /opt/lampp/htdocs/api/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:261
 Symfony\Component\Console\Command\Command->run() at /opt/lampp/htdocs/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:839
 Symfony\Component\Console\Application->doRunCommand() at /opt/lampp/htdocs/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:185
 Symfony\Component\Console\Application->doRun() at /opt/lampp/htdocs/api/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /opt/lampp/htdocs/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:116
 Symfony\Component\Console\Application->run() at /opt/lampp/htdocs/api/bin/console:29

由于问题似乎与Doctrine相关,我删除了vendor /文件夹并使用composer再次安装了所有这些。可悲的是,没有任何改变。作为最后一次尝试,我使用$ php -i | grep -i simplexml SimpleXML Simplexml support => enabled 选项运行更新,这给了我相同的结果。

有没有人遇到过这个问题?我认为它与Linux有关,因为团队的其他成员使用Windows并且从未遇到过这个问题。

编辑:正如评论中所建议的那样,我检查了php.ini中是否有" extension = pdo.so"线,它只出现一次。该部分文件是

--dump-sql

如果我评论最后一行,则警告消失,但问题仍然存在。

0 个答案:

没有答案