部署到生产环境是失败的,我看到一个空白页,没有登录到app/ log /prod.log。
我预热了prod缓存,并将cahce目录的所有权授予www-data,也没有php日志记录,但这可能是管理错误,我要求检查它,因为我没有访问它的权限。
我将htaccess更改为省略app_dev.php,并考虑app.php,这是我的.htaccess:
# Use the front controller as index file. It serves as fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# startpage (path "/") because otherwise Apache will apply the rewritting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex app.php
#DirectoryIndex app_dev.php
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to URI without front controller to prevent duplicate content
# (with and without `/app.php`). Only do this redirect on the initial
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an
# endless redirect loop (request -> rewrite to front controller ->
# redirect -> request -> ...).
# So in case you get a "too many redirects" error or you always get redirected
# to the startpage because your Apache does not expose the REDIRECT_STATUS
# environment variable, you have 2 choices:
# - disable this feature by commenting the following 2 lines or
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
#RewriteRule ^app_dev\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]
RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteCond %{REQUEST_FILENAME} -f
#RewriteRule ^(.*)$ app_dev.php [QSA,L]
RewriteRule ^(.*)$ app.php [QSA,L]
# The following rewrites all other queries to the front controller. The
# condition ensures that if you are using Apache aliases to do mass virtual
# hosting, the base path will be prepended to allow proper resolution of the
# app.php file; it will work in non-aliased environments as well, providing
# a safe, one-size fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
#RewriteRule .? %{ENV:BASE}app_dev.php [L]
RewriteRule .? %{ENV:BASE}app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the startpage to the front controller explicitly so that the website
# and the generated links can still be used.
#RedirectMatch 302 ^/$ /app_dev.php/
RedirectMatch 302 ^/$ /app.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>有什么线索吗?
发布于 2013-06-02 09:47:51
这是一个假设,但是如果dev环境工作正常,而不是prod (在同一个项目和机器上),这是因为您忘记在web/app.php中添加"umask(0000);“。
PHP致命错误:要求():打开失败需要在第165行的'/var/www/symfony/app/cache/prod/doctrine/orm/Proxies/_CG_MyProjectPanelBundleEntityAlgoritmo.php‘(include_path='.:/usr/share/php:/usr/share/pear') in /var/www/symfony/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php中
这显然是文件夹、应用程序/缓存(和应用程序/日志)的权限和所有权问题。
我把cahce dirs的所有权交给www-data
根据您正在使用ACL的事实,您不能这样做,请检查文档。有许多解决办法来解决这个问题,在灰色框架中解释。
要解决您的问题,如果您不使用ACL,我认为简单的方法是在app.php中添加app.php(您可能在app_dev.php中这样做),在文件的开头和“使用”声明之后添加。(请参见灰色框架中的"3.不使用ACL“)。否则,请阅读灰色框架的其他说明。
现在,该框架将来将能够在缓存文件夹中编写。但如果您不使用ACL,则需要另外更正当前的app/cache和app/文件夹配置:
考虑到您的用户名是" user ",请在root中说用户名"user“的用户(通常与Linux机器上的用户名相同)是这些文件夹(和子文件夹/文件)的所有者:
su chown user.user -R app/cache app/logs然后清除这些文件夹,以确保文件没有损坏或丢失(作为“用户”):
rm app/cache/* app/logs/*赋予这些文件夹777个权限,以便框架能够在其中写入:
chmod 777 -R app/cache app/logs此外,即使您可能这样做,也可以检查您的应用程序/控制台文件中是否有umask(0000);没有注释,因为如果您错过它,symfony控制台将把文件写成www-data,并且您无法读取缓存文件文件夹(您将有相同的错误)!
发布于 2014-11-04 15:52:22
数据库架构是最新的吗?
php app/console doctrine:schema:update --dump-sql我做了两次类似的实验,并以同样的方式解决了这个问题:
我在同一项目的另一个包中进行了一项工作,没有与该错误发生的部分进行交互。实际上,我还没有更新我的数据库模式。
希望这能帮上忙
https://stackoverflow.com/questions/16878331
复制相似问题