Reputation: 126
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
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