Skip to content

Run Symfony2 command from cronjobs in CPanel on a shared host

Let's see how to program tasks scheduled in CPanel shared hosting to run custom commands of Symfony2.

In our example we will have the following file structure of our Symfony project in our shared server:

 

 

 

/src/AppBundle/Command/TestCommand.php

 

 

Now we run each time our command and to save the result in the test_command.log file. To do this just go in our CPanel:

Home > Advanced > Cron Jobs

Replace {username} by your user name on your shared hosting account.

 

Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0Email this to someone

Programmer and systems analyst since 2006. Graduate in Software Engineering in Marseille +10 years of experience in Web Technologies. Currently VueJS & Symfony.