# Error updating Docker PHP version for WP-CLI

**URL:** https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923
**Category:** Application Support
**Created:** [December 3, 2022, 10:11pm UTC](https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923 "2022-12-03T22:11:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![designlobby](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/designlobby/32/1308_2.png) [@designlobby](https://community.kinsta.com/u/designlobby)
#### Post date: [December 3, 2022, 10:11pm UTC](https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923/1 "2022-12-03T22:11:36Z")

</div>

Hi there,

I have a DevKinsta local site setup using php8.0. When I try to use WP-CLI I am getting errors saying I’m using php7.4.

So I found & followed instructions here:  
(I am also using roots/sage and have acorn installed as an MU plugin)

> [@WordPress site has the site type "custom site" when Acorn in included as mu-plugin](https://community.kinsta.com/t/wordpress-site-has-the-site-type-custom-site-when-acorn-in-included-as-mu-plugin/1910/2):
>
> Hi @ian, welcome to the DevKinsta community! Thanks for sharing the troubleshooting you have done so far, that quickly lead me to find the culprit. What defines whether a site is listed as a “custom site” vs. a WP site? We use a specific WP CLI command to verify that WordPress is installed and that it isn’t returning an error. When this command isn’t able to return a standard response, DevKinsta uses the label “Custom site”. I was able to replicate that DevKinsta shows “Custom site” when t…

But I’m getting errors in my Terminal after selecting the php version:

```auto
www-data@eb548f61a27c:/www/kinsta/public/mysite$ update-alternatives --config php
There are 5 choices for the alternative php (providing /usr/bin/php).

  Selection Path Priority Status
------------------------------------------------------------
  0 /usr/bin/php8.1 81 auto mode
  1 /usr/bin/php7.2 72 manual mode
  2 /usr/bin/php7.3 73 manual mode
* 3 /usr/bin/php7.4 74 manual mode
  4 /usr/bin/php8.0 80 manual mode
  5 /usr/bin/php8.1 81 manual mode

Press <enter> to keep the current choice[*], or type selection number: 4
update-alternatives: using /usr/bin/php8.0 to provide /usr/bin/php (php) in manual mode
update-alternatives: error: error creating symbolic link '/etc/alternatives/php.dpkg-tmp': Permission denied

```

Please advise so that I can use WP-CLI 🙏

Many thanks!  
Gareth

---

<div class="post-metadata">

### Author: ![Agus](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/agus/32/1515_2.png) [@Agus](https://community.kinsta.com/u/Agus)
#### Post date: [December 5, 2022, 2:00am UTC](https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923/2 "2022-12-05T02:00:07Z")

</div>

Hello Gareth 👋

Thank you for reporting it here.  
As I could see from the report/error, it seems due to the “_User Permission_” issue as per that message:

```auto
update-alternatives: error: error creating symbolic link '/etc/alternatives/php.dpkg-tmp': Permission denied

```

I noticed that you ran that `update-alternatives --config php` command line with the user:  
**www-data**

I suspect you might be connecting to the local containr/Docker with this command perhaps?

```auto
docker exec -it devkinsta_fpm sudo -H -u www-data bash

```

If that so, please try the following steps instead:

1. Connect to the local FPM container with:  
`docker exec -it devkinsta_fpm bash`  
(so it will be using the default _root_ user instead of _www-data_ user)

2. In the FPM container, type:  
`update-alternatives --config php`

3. Select the PHP version from the list (and enter), and done.  
The PHP version should be changed properly now.

Please give it a try and let me know if it works for you.

Cheers,  
Agus

---

<div class="post-metadata">

### Author: ![designlobby](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/designlobby/32/1308_2.png) [@designlobby](https://community.kinsta.com/u/designlobby)
#### Post date: [December 5, 2022, 2:15pm UTC](https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923/3 "2022-12-05T14:15:53Z")

</div>

Works perfectly, thanks Agus!  
Gareth

---

<div class="post-metadata">

### Author: ![Agus](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/agus/32/1515_2.png) [@Agus](https://community.kinsta.com/u/Agus)
#### Post date: [December 6, 2022, 12:36am UTC](https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923/4 "2022-12-06T00:36:46Z")

</div>

Awesome!  
thank you for the update and glad to hear it works perfectly Gareth! 👍

Cheers,  
Agus

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/8/80f8c4e56fecc02327a0964e6bf63a716483529f.png) [@system](https://community.kinsta.com/u/system)
#### Post date: [December 9, 2022, 12:38am UTC](https://community.kinsta.com/t/error-updating-docker-php-version-for-wp-cli/1923/5 "2022-12-09T00:38:00Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
