Created
August 31, 2015 14:43
-
-
Save alanhartless/c999c35dae40e2b5a8a9 to your computer and use it in GitHub Desktop.
Script to run Symfony commands from web
This file contains hidden or 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_once __DIR__.'/app/bootstrap.php.cache'; | |
require_once __DIR__.'/app/AppKernel.php'; | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | |
use Symfony\Component\Console\Input\ArgvInput; | |
use Symfony\Component\Console\Output\BufferedOutput; | |
try { | |
// Replace 'doctrine:migrations:migrate' with commond of choice and add arguments to the array | |
$args = array('console', 'doctrine:migrations:migrate', '--no-interaction', '--env=prod', '--no-debug'); | |
$input = new ArgvInput($args); | |
$output = new BufferedOutput(); | |
$kernel = new AppKernel('prod', false); | |
$application = new Application($kernel); | |
$application->setAutoExit(false); | |
$result = $application->run($input, $output); | |
// Uncomment for output feedback | |
//echo "<pre>\n".$output->fetch().'</pre>'; | |
} catch (\Exception $exception) { | |
// Uncomment for output feedback | |
//echo $exception->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello thanks for sharing any update im getting this error
Fatal error: Class 'Symfony\Component\Console\Input\ArgvInput' not found