我有一个应用程序,它使用SF2,FOS-RestBundle,MySQL,AngularJS.使用Symfony只是为了为我用角编写的前端应用程序提供REST。如果启用了调试模式,并且我的API urls类似于:
"HOST/app_dev.php/api/users“
但是当我切换到生产环境并将我的urls更改为:
"HOST/api/users“
我一直在犯这样的错误:
{“错误”:{“代码”:500,“消息”:“内部服务器错误”}
这是我的FOSRest配置(和sensio ):
sensio_framework_extra:
view: { annotations: false }
router: { annotations: true }
request: { converters: true }
fos_rest:
routing_loader:
default_format: json
include_format: true
param_fetcher_listener: force
body_listener: true
allowed_methods_listener: true
view:
view_response_listener: 'force'
formats:
json: true
format_listener:
rules:
- { path: '^/api', priorities: ['json', 'xml'], fallback_format: null, prefer_extension: true }
- { path: '^/', priorities: [ 'text/html', '*/*'], fallback_format: null, prefer_extension: true }
access_denied_listener:
json: true我知道,这个错误是在FOSRestBundle的某个地方触发的,但是我在ExceptionController中有一个‘断点’。它甚至不去那里。
错误和标题的屏幕截图
感谢你的帮助。
发布于 2016-01-04 06:46:35
当我知道如何在我的主机中访问服务器日志时,我发现了以下错误:
您的数据无法编码,因为它包含无效的app/endor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php字符。
解决方案就在这里("SET NAMES UTF8“成功了):
https://stackoverflow.com/questions/34577372
复制相似问题