title: Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
body: <p>I've been having some problems with my application not loading the views (sometimes).
  I am running a Debian server with php-fpm and nginx (php5.6.8 and nginx 1.8.0) Both compiled from source. On top of that I am running Lavavel 4.2.</p>
  
  <p>So far I've had the problem in both Chrome and Firefox (chrome simply stops loading and shows the error, firefox does not show an error but shows a incomplete version of the view).</p>
  
  <p>So far I've checked the permissions of both nginx and PHP, they both run as the same user (www-data:www-data).
  My php-fpm socket is configured as:</p>
  
  <pre><code>[sitename]
  
  listen = /var/run/php5-fpm/sitename.sock
  listen.backlog = -1
  listen.owner = www-data
  listen.group = www-data
  listen.mode=0660
  
  ; Unix user/group of processes
  user = folderuser
  group = www-data
  
  ; Choose how the process manager will control the number of child processes.
  pm = dynamic
  pm.max_children = 75
  pm.start_servers = 10
  pm.min_spare_servers = 5
  pm.max_spare_servers = 20
  pm.max_requests = 500
  
  ; Pass environment variables
  env[HOSTNAME] = $HOSTNAME
  env[PATH] = /usr/local/bin:/usr/bin:/bin
  env[TMP] = /tmp
  env[TMPDIR] = /tmp
  env[TEMP] = /tmp
  </code></pre>
  
  <p>Note that I set user to folderuser because the folder where the files for the site are located is owned by folderuser (folderuser:www-data).
  Furthermore, permissions inside laravel folders are configured as 755 (775 for cache and upload folders so that www-data can write cache files)</p>
  
  <p>I have disabled any kind of serverside php cache (except for zend opcache).</p>
  
  <p>I've also tried disabling "prefetch resources to load pages more quickly" feature in chrome, which did not solve the problem.</p>
  
  <p>As a last resort I've tried this solution:</p>
  
  <pre><code>/*
  |--------------------------------------------------------------------------
  | Fix for Chrome / PHP 5.4 issue
  | http://laravel.io/forum/02-08-2014-another-problem-only-with-chrome
  |--------------------------------------------------------------------------
  */
  
  App::after(function($request, $response)
  {
  
      $content = $response-&gt;getContent();
  
      $contentLength = strlen($content);
  
      $response-&gt;header('Content-Length', $contentLength);
  
  });
  </code></pre>
  
  <p>And some variants to this script, but I got some content length mismatches (more often than the <code>net::ERR_INCOMPLETE_CHUNKED_ENCODING</code> errors.</p>
  
  <p>So to sum up, I've checked permissions and user/group settings serverside, I've disabled serverside caching (except for zend), I've messed around with chrome settings and I've tried a script for laravel, none of which solved the issue I am having. Note that the issue happens at random intervals at random pages on the site.</p>
  
  <p>I really do not know what the next step towards solving my problem would be as the solutions above are the only ones I've found on the internet.</p>
  
  <p>I would really appreciate some help.</p>
  
  <p><strong>Edit:</strong> I have a beta version of the same application running off another server with the exact same configuration (only difference is in hardware, more memory though), the issue does not present there.</p>
  
  <p>Also, I forgot the mention that the application does not run with HTTPS (currently). The beta version however is running with HTTPS.</p>
  
  <p><strong>Edit</strong> The server where the issue is present has 2048 MB RAM, the beta server has 8192 MB RAM.</p>
  
  <p><strong>Edit</strong> I inspected the response with fiddler when the error occured, it simply cuts of the response at some point for no reason.</p>