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

DNABeast's avatar

Artisan commands using wrong PHP version for Artisan

I've got a Forge server on PHP 7.2 but a site on it that's using 7.3 It's all running fine.

But I've got a custom Artisan command and when I type into the command line

php artisan make:media

it (of course) uses the wrong version of PHP. In this instance this causes an exception.

How can I use what I'm assuming is the fpm version of PHP to run my artisan command?

0 likes
2 replies
tykus's avatar
tykus
Best Answer
Level 104

On Forge, you can execute a command with a specific PHP version (assuming that version is installed) using:

php7.3 artisan make:media

Obviously, something has fallen out of sync between the FPM and CLI versions that are running by default, so you could see if it is possible for Forge to reset the default PHP version in the PHP configuration page for the server.

1 like
DNABeast's avatar

You did it you legend. You solved my problem.

(Versions are intentionally out of sync.)

Please or to participate in this conversation.