2016-01-03 162 views
0

我有一个应用程序,它使用SF2,FOS-RestBundle,MySQL,AngularJS。 Symfony仅用于为我在Angular中编写的前端应用程序提供REST API。当我已经启用调试模式一切都很正常,我的API网址 像:FOS其余 - 生产环境问题

HOST /app_dev.php/api/users”

但是当我切换到生产环境,改变我的URL :

HOST/API /用户”

我不断收到这样的错误:

{"error":{"code":500,"message":"Internal Server Error"}}

这是我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“断点”。它甚至没有去那里。

Screenshot of error and headers

得到任何帮助。

+1

你能得到服务器日志(可能是Apache),所以你看到的实际错误,而不仅仅是500错误? –

回答

0

当我想通了如何去在我的主机服务器日志我发现以下错误:

Your data could not be encoded because it contains invalid UTF8 characters." at app/endor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php line 36

和解决方案是在这里(“SET NAMES UTF8”的伎俩):

JMSSerializer and UTF-8 encoding error (Symfony2.4)