How to change the version of php in PHP Intelephense?

How to change the version of php in PHP Intelephense?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How to Change PHP Version in Intelephense

When you upgrade your IIS server from PHP 7.3 to PHP 7.4, it is common to expect Visual Studio Code to detect the new environment immediately. However, VS Code relies on local configuration and extension settings rather than automatically scanning your IIS installation path. If you are seeing Intelephense cling to the old PHP version despite the server update, the solution lies within the settings.json file, but locating it requires a specific search strategy if the UI doesn't surface the option immediately.

The core issue is that VS Code treats the PHP runtime as a local setting rather than a system-wide one for IntelliSense purposes. The extension uses an internal setting to determine which executable path or version string to associate with your files. To change this, you must navigate to File > Preferences > Settings and ensure you are editing the correct scope. If you are currently viewing the "User" settings (which apply globally), look for the search bar at the top.

Type intelephense into the search field rather than just php. This distinction is critical because generic php searches often surface language server configurations that don't exist or are irrelevant to Intelephense specifically. Once you locate the Intelephense section, look for the setting labeled php.version. You will see a dropdown menu populated with available versions detected on your system.

If the list is empty or only shows 7.3, VS Code has failed to detect the new PHP executable. This usually happens because the environment variable path hasn't been updated in VS Code's context, or the specific PHP binary isn't registered in the PATH where the shell session that VS Code spawns uses. In this scenario, you can manually specify the full path to the PHP 7.4 executable.

Navigate to File > Preferences > Settings, then click on the "Open Settings (JSON)" icon in the top-right corner to edit the user settings file directly. Add or modify the following entry:

"intelephense.phpVersion": "/full/path/to/php7.4/bin/php.exe",

Alternatively, if you prefer using version strings, you can set:

"intelephense.phpVersion": "7.4",

However, specifying the full path is often more robust when dealing with IIS environments where multiple PHP versions might be installed side-by-side in different directories. You must ensure that the intelephense extension is restarted after making these changes. Sometimes VS Code caches the old configuration; if the settings don't take effect immediately, try reloading the window via Ctrl+Shift+P, typing Reload Window, and executing the command.

A common pitfall in IIS environments is assuming that changing the global PHP version on the server updates the local development tools instantly. Intelephense is a language server protocol implementation that needs explicit direction regarding which runtime to analyze for type hints, syntax errors, and autocompletion. Without this manual override or automatic detection, the editor will continue to parse code against the 7.3 grammar, leading to confusing warnings about deprecated functions or missing classes that were actually removed in 7.4.

If you are working on a Laravel project hosted on IIS, ensuring the correct PHP version is critical for compatibility with specific package versions. While general PHP environments benefit from the manual path configuration, modern frameworks often require specific dependency managers to align with the server runtime. If you encounter persistent issues where Intelephense refuses to recognize the new version despite correct settings, verify that the PHP executable you are pointing to is indeed running the 7.4 binaries by checking its php -v output within a terminal on your local machine.

For developers managing complex multi-version setups, consider using symlinks or environment variables to create a consistent path structure before configuring Intelephense. This reduces the likelihood of human error when switching between versions for different projects.

Our network