# PHP version switching not working

**URL:** https://community.kinsta.com/t/php-version-switching-not-working/5300
**Category:** Application Support
**Created:** [July 26, 2025, 12:25pm UTC](https://community.kinsta.com/t/php-version-switching-not-working/5300 "2025-07-26T12:25:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![juliaset](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/juliaset/32/3975_2.png) [@juliaset](https://community.kinsta.com/u/juliaset)
#### Post date: [July 26, 2025, 12:25pm UTC](https://community.kinsta.com/t/php-version-switching-not-working/5300/1 "2025-07-26T12:25:57Z")

</div>

The PHP version switching feature in DevKinsta is not working. Despite setting a site to use PHP 8.3 in the DevKinsta interface, the actual containers continue to run PHP 7.4.33, preventing the use of PHP 8+ syntax in WordPress development.

## Environment Details

- **DevKinsta Version** : 2.13.4
- **Operating System** : macOS
- **Docker Version** : 28.3.2, build 578ccf6
- **Site Name** : ncwit
- **Expected PHP Version** : 8.3
- **Actual PHP Version** : 7.4.33

## Current Docker Images

All DevKinsta images are version 1.3.6 and appear to be 16 months old:

```auto
kinsta/devkinsta_mailhog 1.3.6 f060baef253c 16 months ago 392MB
kinsta/devkinsta_adminer 1.3.6 0e94ac87d142 16 months ago 94.8MB
kinsta/devkinsta_nginx 1.3.6 b123f3cff7e8 16 months ago 53.3MB
kinsta/devkinsta_db 1.3.6 fb86d6cbbb8a 16 months ago 397MB
kinsta/devkinsta_fmp 1.3.6 edc7803a86f1 16 months ago 647MB

```

## Steps Taken to Reproduce/Fix

1. **Changed PHP version in DevKinsta interface** :

2. **Verified the issue** :

3. **Attempted complete rebuild** :

4. **Checked for updates** :

## Expected Behavior

When I set a site to use PHP 8.3 in the DevKinsta interface, the actual PHP runtime in the containers should be PHP 8.3, allowing the use of PHP 8+ language features.

## Actual Behavior

The DevKinsta interface shows PHP 8.3 is selected, but the containers continue to run PHP 7.4.33. This creates a development/production environment mismatch since our production servers run PHP 8+.

## Impact

- Cannot use PHP 8+ syntax features in local development
- Development environment doesn’t match production environment (PHP 8+)
- wp-cli fails due to PHP syntax errors when code uses PHP 8+ features
- Blocks local WordPress development workflow

## Questions

1. **Are the 1.3.6 Docker images the latest available?** If not, how can I force DevKinsta to download newer images?
2. **Is there a manual way to update the Docker images** that DevKinsta uses?
3. **Should PHP version switching work with the current version of DevKinsta?** If so, what might be preventing it from working correctly?
4. **Are there any configuration files or settings** I can check/modify to troubleshoot this issue?
5. **Is there a recommended alternative** for local WordPress development with reliable PHP 8+ support?

Please let me know what additional information or diagnostic steps would be helpful to resolve this issue.

---

<div class="post-metadata">

### Author: ![ShawnC](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/shawnc/32/880_2.png) [@ShawnC](https://community.kinsta.com/u/ShawnC)
#### Post date: [July 27, 2025, 12:50am UTC](https://community.kinsta.com/t/php-version-switching-not-working/5300/4 "2025-07-27T00:50:32Z")

</div>

Continuing the discussion from [PHP version switching not working](https://community.kinsta.com/t/php-version-switching-not-working/5300/2):

Howdy @juliaset 👋,

Thank you kindly for sharing those details.

Please find answers to each of your questions below, as well as steps to switch the PHP version in command line.

1. **Are the 1.3.6 Docker images the latest available?**  
Yes, these are the latest

2. **Is there a manual way to update the Docker images** that DevKinsta uses?  
You can delete the images and relaunch DK. That should force it to update the images. But, 1.3.6 are the latest.

3. **Should PHP version switching work with the current version of DevKinsta?** If so, what might be preventing it from working correctly?  
It is technically switching the PHP version as intended. However, the switcher just switches the PHP-FPM version. It doesn’t relink the PHP executable for commands run via the command line.

4. **Are there any configuration files or settings** I can check/modify to troubleshoot this issue?  
Please follow the steps I’ll provide below.

5. **Is there a recommended alternative** for local WordPress development with reliable PHP 8+ support?  
DevKinsta supports PHP 8+, and can be reliably used to develop a WordPress site. The alternative would be to set up a local LAMP/LEMP stack if they want.

I tried the following on my instance of DevKinsta, and it worked.

If you’d like to switch the PHP version used when executing `PHP` commands from the terminal, you can do the following:

`docker exec -u root -it devkinsta_fpm bash`

Then, run the following:  
`update-alternatives --config php`

That should allow you to select which PHP version to use…

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/6/64c68f0182b64b6cd1c218a3b6697f204844bf2d.png)

Alternatively, you can set the PHP version in a non-interactive way by specifying the PHP binary to use.

For example, to immediately set PHP 8.3 for use, you can run the following:  
`update-alternatives --set php /usr/bin/php8.3`

---

<div class="post-metadata">

### Author: ![juliaset](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/juliaset/32/3975_2.png) [@juliaset](https://community.kinsta.com/u/juliaset)
#### Post date: [July 28, 2025, 2:40pm UTC](https://community.kinsta.com/t/php-version-switching-not-working/5300/5 "2025-07-28T14:40:18Z")

</div>

Thank you so much for the detailed response and clear explanation of how DevKinsta handles PHP versions.

Following your instructions, I was able to set the PHP CLI to 8.3 and am able to run wp-cli again. Issue resolved!

---

<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: [July 31, 2025, 2:41am UTC](https://community.kinsta.com/t/php-version-switching-not-working/5300/6 "2025-07-31T02:41:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ShawnC](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/shawnc/32/880_2.png) [@ShawnC](https://community.kinsta.com/u/ShawnC)
#### Post date: [July 31, 2025, 2:19pm UTC](https://community.kinsta.com/t/php-version-switching-not-working/5300/7 "2025-07-31T14:19:29Z")

</div>

@juliaset

No problem friend.

I’m glad that worked out.

Stay awesome 🤙
