Skip to content

Checking the PHP runtime used by Composer

development

The PHP used by Composer can differ from the PHP serving the website. A successful dependency install with one runtime does not prove the web process has the same version or extensions.

What you need before you begin

Identify the panel-selected web PHP version and the CLI executable available to the account. Keep temporary diagnostic output private and remove it after checking.

01 Check the PHP runtime used by Composer

  1. Run php -v with the intended CLI path and inspect the extensions required by the project. Compare this with the hosting panel’s web runtime information.

  2. When several PHP versions are installed, invoke Composer with the correct explicit PHP executable or approved wrapper.

  3. Review any Composer platform emulation in the project configuration. It influences dependency resolution but does not install the emulated PHP version or extensions on the server.

  4. Run composer check-platform-reqs against the installed release using the intended target runtime. Resolve missing extensions through the supported panel or administrator process.

  5. Check scheduled commands and workers as well as web requests, because each can use a different executable.

02 Example: compare the CLI interpreter with the website

Run these read-only commands in the application’s authorised shell. They identify the interpreter, loaded configuration files and extensions used by your terminal, which may differ from the PHP handler selected in the hosting panel.

Command example
php -v
php --ini
php -m
composer check-platform-reqs --no-dev

Compare the version and required extensions with the panel’s web-PHP settings and the application’s private runtime report. If Composer uses a wrapper or a different interpreter, run it with the approved explicit PHP path. Repeat the comparison for a queue worker or scheduled task when only that execution path fails.

Expected result: You can explain which PHP installation serves the website and which runs Composer. A missing extension is corrected in the relevant runtime, without publishing a full phpinfo() page or changing dependency versions merely to hide a handler mismatch.

Confirm the expected result

Verify the same application feature works from web and CLI paths. Confirm the actual runtime meets the selected package requirements without ignored platform checks.

Troubleshoot unexpected results

A missing-class or syntax error only on the website can indicate the web handler differs from Composer’s CLI environment. Changing the lock file may be unnecessary if the selected handler is wrong.

A common question

Does config.platform upgrade my hosting PHP version?

No. It describes a target for dependency resolution. The hosting runtime must still be configured separately and verified against the installed application.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support