Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

andyjh07's avatar

Is there any way to run `php artisan` on forge?

I'm spinning up some new servers and on one of the sites I want to put it in maintenance mode - I planned on using php artisan down but forge doesn't allow it saying Could not open input file: artisan.

How on earth do I go about doing this?

0 likes
7 replies
shez1983's avatar

depends on where you are doing it from?

from deploy script you can just enter that and it should work (assuming deploy script) CDs to the right folder where your project is

katifrantz's avatar

Remember php artisan only works in the laravel installation directory, so try to run ls -A, to view all hidden files, and if you do not find an artisan file then it cant work .

1 like
andyjh07's avatar

@shez1983 Ah yeah, I know I could do it in the deploy script but is that the only place this can be done? I was trying to do this as sudo via SSH

shez1983's avatar

you can do it via SSH but you need to be inside the folder where laravel is located.. otherwise you get THAT error you mentioned..

1 like
tykus's avatar
tykus
Best Answer
Level 104

So you can ssh into the server being managed by Forge; are you inside the project root; has composer install been run?

andyjh07's avatar

Wow holy crap I totally forgot to run composer install. Thanks for that @tykus_ikus, now I feel stupid ;)

1 like
Otienoh's avatar

Another hack just found out, create a recipe the do so using the UI

Please or to participate in this conversation.