Why do two terminals show different PHP versions?

2 weeks ago 19
ARTICLE AD BOX

I have a legacy project that I've been working on for a while. It works on PHP version 8.1.10, and I can change the PHP version in Laragon without any issues.

That is, until I start working on a new project using Laravel 12 with PHP version 8.3.9. After that, when I go back to the legacy project, the npm command no longer works.

When I try to run npm run dev, which used to work without problems, I now only see this output:

PS C:\laragon\www\cbt> npm run dev npm error Missing script: "dev" npm error npm error To see a list of scripts, run: npm error npm run npm error A complete log of this run can be found in: C:\Users\Mine\AppData\Local\npm-cache\_logs\2026-01-08T03_32_39_034Z-debug-0.log

I tried to fix the problem by checking the PHP version. That's when I noticed that there are two different PHP versions being used, depending on the terminal.

In the VS Code terminal, PHP shows version 8.3.9. In the Laragon terminal, PHP shows version 8.1.10.

checking php version on each terminal

the actual version on the Laragon

Read Entire Article