问题描述
我尝试将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):无法打开流:/ 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!