<p>This is something I completely overlooked, but the Craft CLI is just a PHP wrapper that's executable on the CLI. So this will work:</p>
<p><code>/usr/bin/php73 craft help</code>
or
<code>/usr/bin/php73 craft update all</code></p>
<p>Will run the CLI with the PHP binary of your choice.</p>

CC BY-SA 4.0
2020-06-18T22:41:46.320Z
2020-06-18T22:41:46.320Z
jpea
<p>With the Craft CLI, is there a way to set which php version to use?</p>
<p>The context here is that the server runs PHP 5.4 for another project, but PHP 7.3 is installed at <code>/usr/bin/php73</code> and is setup in Apache to use that version for this specific site.</p>
<p>With normal <code>composer install</code> I just specify the path to that version like so:</p>
<p><code>/usr/bin/php73 /usr/bin/composer update</code></p>
<p>but I want to be able to run updates via the Craft CLI. The CLI tool then uses the composer version on the server. Is there a way to specify what version of php to use when running commands via the CLI?</p>

CC BY-SA 4.0
2020-06-18T19:04:20.807Z
What host/server/linux distro are you running on? This is something you will need to do server side.
dmatthams
<cli>
Craft CLI ./craft - can I tell it to use a specific php version when running composer via the CLI?
# Craft CLI ./craft - can I tell it to use a specific php version when running composer via the CLI?

(Asked by: username_0 on 2020-06-18)

With the Craft CLI, is there a way to set which php version to use?

The context here is that the server runs PHP 5.4 for another project, but PHP 7.3 is installed at `/usr/bin/php73` and is setup in Apache to use that version for this specific site.

With normal `composer install` I just specify the path to that version like so:

`/usr/bin/php73 /usr/bin/composer update`

but I want to be able to run updates via the Craft CLI. The CLI tool then uses the composer version on the server. Is there a way to specify what version of php to use when running commands via the CLI?

**Tags:** cli
> **Comments:**
> **username_1**: What host/server/linux distro are you running on? This is something you will need to do server side.  

---

## 1 answers

### Answer by username_0 on 2020-06-18. Score: 1

This is something I completely overlooked, but the Craft CLI is just a PHP wrapper that's executable on the CLI. So this will work:

`/usr/bin/php73 craft help`
or
`/usr/bin/php73 craft update all`

Will run the CLI with the PHP binary of your choice.


---

