Answers.Body: <p>The issue seemed to stem from the fact that Caddy serves up PHP with fastcgi, instead of Apache or Nginx, and something to do with http requests used to start the task. AJAX requests (what my other functioning task plugins were using to kickoff) were unaffected.</p>
  
  <p>Following a suggestion found here: <a href="https://stackoverflow.com/questions/11758334/fastcgi-finish-request-creates-hung-connection-when-open-session-exists">https://stackoverflow.com/questions/11758334/fastcgi-finish-request-creates-hung-connection-when-open-session-exists</a></p>
  
  <p>I've placed</p>
  
  <pre><code>session_write_close();
  fastcgi_finish_request();
  </code></pre>
  
  <p>at the top of the <code>runStep($step)</code> function in each plugin's Task class and it resolved the issue!
  Though, I'm not sure if either of the lines above have other implications.</p>
  
  <hr>
  
  <p><strong>Update</strong><br>
  I should add, that from what I can tell, the above snippet <em>does</em> cause issues with tasks on Apache setups. (tasks will start yet never finish). Unless you are using Caddy Server in production, (you're probably not and using Valet for development) the snippet above should only be used as a temporary hack to get through your tasks.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T03:34:04.440Z
Answers.LastActivityDate: 2016-09-23T16:46:03.697Z
Answers.LastEditDate: 2017-05-23T12:38:53.957Z
Answers.UserDisplayName: Chase Giunta
Body: <p>I'm using Laravel Valet for my Craft development environment (which is awesome, btw) except for an issue with Tasks not kicking off. I initially stumbled upon the problem while using the Import plugin. The task created by the plugin would never start. Instead, it would sit in a "Pending" state. </p>
  
  <p>I figured this was a bug with the plugin, because other tasks seemed to start and run just fine. I then also discovered another task-related problem with P&amp;T's example task plugin, "Power Nap", where running the task would cause the whole site to hang.</p>
  
  <p>What gives?</p>
  
  <p>Both of these issues aren't present when running the site with MAMP. I've narrowed it down to something to do with <a href="https://laravel.com/docs/5.2/valet" rel="nofollow">Valet</a> (which is using <a href="https://caddyserver.com" rel="nofollow">Caddy</a> to serve PHP sites).</p>
  
Tags: <tasks><caddy><valet>
Title: Tasks either don't start or don't run as background processes
ThreadText: # Tasks either don't start or don't run as background processes
  
  (Asked by: username_0 on 2016-07-28)
  
  I'm using Laravel Valet for my Craft development environment (which is awesome, btw) except for an issue with Tasks not kicking off. I initially stumbled upon the problem while using the Import plugin. The task created by the plugin would never start. Instead, it would sit in a "Pending" state.
  
  I figured this was a bug with the plugin, because other tasks seemed to start and run just fine. I then also discovered another task-related problem with P&T's example task plugin, "Power Nap", where running the task would cause the whole site to hang.
  
  What gives?
  
  Both of these issues aren't present when running the site with MAMP. I've narrowed it down to something to do with [Valet](https://laravel.com/docs/5.2/valet) (which is using [Caddy](https://caddyserver.com) to serve PHP sites).
  
  **Tags:** tasks, caddy, valet
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-07-28. Score: 1 | Accepted answer
  
  The issue seemed to stem from the fact that Caddy serves up PHP with fastcgi, instead of Apache or Nginx, and something to do with http requests used to start the task. AJAX requests (what my other functioning task plugins were using to kickoff) were unaffected.
  
  Following a suggestion found here: <https://stackoverflow.com/questions/11758334/fastcgi-finish-request-creates-hung-connection-when-open-session-exists>
  
  I've placed
  
  ```
  session_write_close();
  fastcgi_finish_request();
  
  ```
  
  at the top of the `runStep($step)` function in each plugin's Task class and it resolved the issue!
  Though, I'm not sure if either of the lines above have other implications.
  
  ---
  
  **Update**  
  I should add, that from what I can tell, the above snippet *does* cause issues with tasks on Apache setups. (tasks will start yet never finish). Unless you are using Caddy Server in production, (you're probably not and using Valet for development) the snippet above should only be used as a temporary hack to get through your tasks.
  
  
  ---
  
  