Skip to content

Instantly share code, notes, and snippets.

@bgreenacre
Created October 11, 2013 18:34
Show Gist options
  • Save bgreenacre/6939760 to your computer and use it in GitHub Desktop.
Save bgreenacre/6939760 to your computer and use it in GitHub Desktop.
A simple example of executing a background process with php.
<?php
exec(
sprintf(
'cd "%s" && %s "%s" install > "%s" 2>&1 & echo $! >> "%s"',
__DIR__,
'/usr/bin/php',
__DIR__ . '/bin/composer.phar',
__DIR__ . '/var/log/composer-' . date('dmY-His') . '.log',
__DIR__ . '/var/run/composer.pid'
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment