简体   繁体   English

Symfony2 RuntimeException:将定义自动加载器的预期类“ Doctrine \\ DBAL \\ Driver \\ PDOMySql \\ Driver”

[英]Symfony2 RuntimeException: The autoloader expected class “Doctrine\DBAL\Driver\PDOMySql\Driver” to be defined

I've deployed my site to my development server using Capifony and although it has been deployed correctly when I go the the site ie dev.xyz.co.uk/app_dev.php I get the following error: 我已经使用Capifony将我的网站部署到了开发服务器上,尽管当我进入该网站即dev.xyz.co.uk/app_dev.php时,它已经正确部署了,但出现以下错误:

RuntimeException: The autoloader expected class "Doctrine\\DBAL\\Driver\\PDOMySql\\Driver" to be defined in file "/var/www/vhosts/dev.xyz.co.uk/shared/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php". RuntimeException:自动加载器预期的类“ Doctrine \\ DBAL \\ Driver \\ PDOMySql \\ Driver”将在文件“ /var/www/vhosts/dev.xyz.co.uk/shared/vendor/doctrine/dbal/lib/Doctrine/”中定义DBAL /驱动器/ PDOMySql / Driver.php”。 The file was found but the class was not in it, the class name or namespace probably has a typo. 找到了文件,但是类不在其中,类名或名称空间可能有错字。

Any idea what's causing it? 知道是什么原因造成的吗? It works fine when deploying to production. 部署到生产环境时,它工作正常。

You may check the first line of the file "Driver.php" just to read <?php . 您可以检查文件“ Driver.php”的第一行以读取<?php

If you just read <? 如果您只是阅读<? and tried to deploy on differents servers for dev and prod, just check if they have the same value for "short_open_tag" (in php.ini). 并尝试在dev和prod的不同服务器上进行部署,只需检查它们的“ short_open_tag”值是否相同(在php.ini中)。 If it's "on" on your prod's server and "off" on your dev's server you may have this error. 如果在产品服务器上“打开”在开发人员服务器上“关闭”,则可能会出现此错误。

It can be problem of accelerator (xcache, eaccelerator, apc). 这可能是加速器(xcache,eaccelerator,apc)的问题。 Restart PHP it can help. 重新启动PHP会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM