1

i have this console command :

php app/console jms-job-queue:run

I want to run this command when i click a button on my website. So i don't niet a command prompt to do this.

Is this possible in symfony 2 ?

4 Answers 4

2

A good idea would be to created a helper class to do this for you, because the commands will look different foreach dev and prod environment. You can add also methods to check if there are any processes running, or to kill one.

Not sure, but I guess you need full path to your command:

[%kernel.root_dir%] / console jms-job-queue:run
Sign up to request clarification or add additional context in comments.

Comments

1

Your could try creating a service that defines the behavior you want, then have both your console command and your controller action call that service. This promotes code reuse and allows you to call that function anywhere you want.

You can also look at this question that had been answered before: How can I run symfony 2 run command from controller

Comments

0

Maybe it will be enough to use plain php exec function.

Comments

0

You can define the command as a service like this and use it in your controller.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.