Symfony缓存原则/ orm /代理无法在第209行打开流/Proxy/AbstractProxyFactory.php [英] Symfony Cache doctrine/orm/Proxies failed to open stream /Proxy/AbstractProxyFactory.php on line 209

查看:156
本文介绍了Symfony缓存原则/ orm /代理无法在第209行打开流/Proxy/AbstractProxyFactory.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将symfony移至共享主机。

I'm try to move symfony to shared host.

我将symfony结构移至/,并且我的Web文件夹为/ public_html。

I moved symfony structure to / and my web folder is /public_html.


警告:require(/ home / user / app / cache / prod / doctrine / orm / Proxies / __ CG__UserBundleEntityUser.php):无法打开流:没有此类文件或第209行上/home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php中的目录

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

警告:require(/ home / user /app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php):无法打开流:/ home / user / vendor / doctrine / common / lib / Doctrine / Common / Proxy / AbstractProxyFactory中没有此类文件或目录。 php在线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

致命错误:require():无法打开所需的'/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php /home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php在第209行上的'(include_path ='。:/ opt / php55 / lib / php')

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

此错误仅在 prod 环境中发生。 dev 环境中不会引发该异常。

This error occurs only in the prod environment. The exception is not thrown in the dev environment.

我尝试了以下操作:

rm -rf /app/cache + chmod 777
app/console cache:warmup

我使用Symfony 2.8.3。以下目录位于本地和服务器上:

I use Symfony 2.8.3. The following directories are present locally and on the server:

本地缓存:
-/ annotations,/ twig,/ vich_uploader + / doctrine,/ translations

LOCAL CACHE: - /annotations, /twig, /vich_uploader + /doctrine, /translations

服务器缓存:
-/注释,/ twig,/ vich_uploader

SERVER CACHE: - /annotations, /twig, /vich_uploader

如果我上传本地缓存

推荐答案

在尝试访问应用程序之前,您没有创建代理类。这通常是通过以下方式完成的:

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

默认情况下,产品中自动禁用了代理类自动生成 code>环境。通过将其添加到配置中,可以启用类似于 dev 环境的代理类的自动生成:

The auto-generation of proxy-classes is disabled by default in the prod environment. You can enable automatic generation of proxy-classes similar to the dev environment by adding this to your config:

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

这篇关于Symfony缓存原则/ orm /代理无法在第209行打开流/Proxy/AbstractProxyFactory.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆