Created
May 22, 2018 07:47
-
-
Save yarimadam/24f0d033709478d8b4038bdd2f05f0c3 to your computer and use it in GitHub Desktop.
Run php script in background with symfony process component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use Symfony\Component\Process\Process; | |
use Symfony\Component\Process\ProcessBuilder; | |
$builder = new ProcessBuilder(); | |
$builder->setPrefix('/usr/local/bin/php'); | |
$cmd = $builder->setArguments(['/Users/tuncay/longRunningTask.php']) | |
->getProcess() | |
->getCommandLine(); | |
$process = new Process($cmd . ' > /dev/null 2>&1 &'); | |
$process->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment