Search code examples
apisymfonyfosrestbundle

fosrestbundle on centos6 no response on post request


I made an api with Symfony 2.6 and fosrestbundle. The api works just ok.

Everything worked fine in my local environment. But when it went to the online server, i make the request and just hangs there loading.

I managed to get an error while making the request:

I did it fooling around enabling and disabling ssl.

cURL error 52: Empty reply from server (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) 

Here's the code i've tested successfully on my local environment and it's malfunctioning on the online server.

The server is a linux Centos 6 with Apache2

$ch = curl_init();

    $params = array(
        'nombre' => 'Test name',
        'fecha' => '2016-02-18 10:00:00',
        'telefono' => '555-5555',
        'comentarios' => 'No comments'
    );

    curl_setopt($ch, CURLOPT_URL,$url.'?access_token=' . $accessToken);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $server_output = curl_exec ($ch);

    curl_close ($ch);

I ran out of ideas. I looked up over the internet but couldn't find any information. I feel blind on this.


Solution

  • The REST Api Action Controller (Using FOSRestBundle) returned a whole doctrine entity... the server ran out of memory/cpu.

    I now return a plain json response and everything works well.