sayyed tabrez
sayyed tabrez

Reputation: 126

call artisan command using shell script

can we call artisan command using PHP exec or shell_exec or system function?

exec('php artisan list');

I have tried the above command in the controller but it is giving me an error saying 'Could not open input file: artisan' actually, I want to call another artisan command this just for testing

please guide me if am doing anything wrong here

Upvotes: 2

Views: 1815

Answers (1)

Eric Qvarnström
Eric Qvarnström

Reputation: 1002

The artisan file is located in the root folder of the project and you are trying to execute it from a controller in a different folder. Try using the absolute path or a relative path:

exec('php /path/to/rootfolder/artisan list');

Upvotes: 1

Related Questions