Symfony Cache Dotty/orm/Proxies 无法在第 209 行打开流 /Proxy/AbstractProxyFactory.php
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36255440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Symfony Cache doctrine/orm/Proxies failed to open stream /Proxy/AbstractProxyFactory.php on line 209
提问by Luiz Brz Developer
I'm try to move symfony to shared host.
我正在尝试将 symfony 移至共享主机。
I moved symfony structure to / and my web folder is /public_html.
我将 symfony 结构移动到 / 并且我的 web 文件夹是 /public_html。
Warning: require(/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php): failed to open stream: No such file or directory in /home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209
Warning: require(/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php): failed to open stream: No such file or directory in /home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209
Fatal error: require(): Failed opening required '/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php' (include_path='.:/opt/php55/lib/php') in /home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209
警告:需要(/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php):无法打开流:/home/user/vendor/doctrine/common/lib/中没有这样的文件或目录Doctrine/Common/Proxy/AbstractProxyFactory.php 在线 209
警告:需要(/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php):无法打开流:/home/user/vendor/doctrine/common/lib/中没有这样的文件或目录Doctrine/Common/Proxy/AbstractProxyFactory.php 在线 209
致命错误:require():在 / 中打开所需的 '/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php' (include_path='.:/opt/php55/lib/php') 失败home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php 在线 209
This error occurs only in the prod
environment. The exception is not thrown in the dev
environment.
此错误仅发生在prod
环境中。dev
环境中不会抛出异常。
I tried the following:
我尝试了以下方法:
rm -rf /app/cache + chmod 777
app/console cache:warmup
I use Symfony 2.8.3. The following directories are present locally and on the server:
我使用 Symfony 2.8.3。以下目录存在于本地和服务器上:
LOCAL CACHE: - /annotations, /twig, /vich_uploader + /doctrine, /translations
本地缓存: - /annotations, /twig, /vich_uploader + /doctrine, /translations
SERVER CACHE: - /annotations, /twig, /vich_uploader
服务器缓存: - /annotations, /twig, /vich_uploader
If I upload my local cache to the server, the exception disappears.
如果我将本地缓存上传到服务器,异常就会消失。
回答by Nicolai Fr?hlich
You did not create the proxy classes before you tried to access your application. This is usually done by:
在尝试访问您的应用程序之前,您没有创建代理类。这通常通过以下方式完成:
app/console cache:warmup --env=prod
The auto-generation of proxy-classes is disabledby default in the prod
environment. You can enable automatic generation of proxy-classes similar to the dev
environment by adding this to your config:
默认情况下,环境中禁用自动生成代理类prod
。您可以dev
通过将其添加到您的配置中来启用类似于环境的代理类的自动生成:
app/config/config_prod.yml
app/config/config_prod.yml
doctrine:
orm:
auto_generate_proxy_classes: true # <- change to true
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
proxy_namespace: Proxies
回答by Carlos Santos
I have changed all files that refer to the expression 'auto_generate_proxy_classes'(I've changed the value from 'false' to 'true') and this fixed the issue:
我已经更改了所有引用表达式“auto_generate_proxy_classes”的文件(我已将值从“false”更改为“true”),这解决了问题:
- ... /vendor/doctrine/doctrine-bundle/DoctrineBundle.php
- ... /vendor/doctrine/doctrine-bundle/Resources/doc/configuration.rst
- ... /vendor/doctrine/doctrine-bundle/DependencyInjection/Configuration.php
- ... /vendor/doctrine/doctrine-bundle/DependencyInjection/DoctrineExtension.php
- ... /app/config/config.php
- ... /app/cache/prod/appProdProjectContainer.php
- ... /vendor/doctrine/doctrine-bundle/DoctrineBundle.php
- ... /vendor/doctrine/doctrine-bundle/Resources/doc/configuration.rst
- ... /vendor/doctrine/doctrine-bundle/DependencyInjection/Configuration.php
- ... /vendor/doctrine/doctrine-bundle/DependencyInjection/DoctrineExtension.php
- ... /app/config/config.php
- ... /app/cache/prod/appProdProjectContainer.php