【发布时间】:2019-10-26 22:59:47
【问题描述】:
我已将我的 symfony4 项目部署到共享主机 (infinityFree)。 但是当我访问我的网站时,我收到 500 Internal Server Error :
哎呀!发生错误 服务器返回“500 Internal Server Error”。
有些东西坏了。请让我们知道发生此错误时您在做什么。我们会尽快修复它。给您带来的不便,我们深表歉意。
我的项目在本地使用开发模式运行良好。
在 htdocs/var/log/prod.depreciations.log 中:
[2019-09-20 15:01:41] php.INFO: User Deprecated: The "Symfony\Component\Config\Definition\Builder\TreeBuilder::root()" method called for the "liip_imagine" configuration is deprecated since Symfony 4.3 ... etc
[2019-09-20 15:01:41] php.INFO: User Deprecated: A tree builder without a root node is deprecated since Symfony 4.2 ... etc
[2019-09-20 15:01:41] php.INFO: User Deprecated: The "Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser" class is deprecated since Symfony 4.3 ... etc
[2019-09-20 15:01:43] php.INFO: User Deprecated: The spaceless tag in "@LiipImagine/Form/form_div_layout.html.twig" at line 2 is deprecated since Twig 2.7, use the spaceless filter instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The spaceless tag in \"@LiipImagine/Form/form_div_layout.html.twig\" at line 2 is deprecated since Twig 2.7 ... etc
在 htdocs/var/log/ 中没有错误日志。 我的项目部署在 htdocs 中,并且在我的 htaccess 中作为我拥有的公用文件夹的兄弟:
php_value display_errors On
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone Europe/Paris
DirectoryIndex public/index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
#Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
在 Cpanel 中,php 版本是 7.3(默认),我没有使用 infinityfree 的 ssh 访问权限。我已经按照这个教程 https://symfony.com/doc/current/deployment.html
【问题讨论】:
-
您有“CRITICAL”级别的日志吗?
-
在 htdocs/var 我有缓存(dev + log 文件夹)和日志目录(dev.log with 0B and prod.depreciations.log)
-
dev.log 很奇怪,你是配置APP_ENV还是SYMFONY_ENV使用prod环境?
-
我用 composer dump-env prod 生成了 .env.local.php 'prod',
-
即使我编辑 .env 文件 APP_ENV=prod,我仍然收到错误 500
标签: php symfony cpanel symfony4