Skip to content

Knowledgebase

Choosing the correct PHP executable for a cron job

cpanel-whm, development

The PHP executable used by cron can differ from the version serving the website. Select the application’s required supported command-line runtime explicitly rather than assuming a change in MultiPHP Manager automatically changes every scheduled command.

Information to have ready

Check the application’s supported PHP version and extensions. Record the current cron command and locate the available PHP binaries through the panel information or support. Do not guess a path copied from a different server.

01 Choose the correct PHP executable for a cron job

  1. Open Cron Jobs and identify the relevant application command.
  2. From authorised shell access, run the proposed executable with -v to confirm its version and use appropriate diagnostics to confirm required extensions.
  3. Update the cron command to use that executable’s absolute path followed by the application’s documented script and arguments.
  4. Preserve the script’s working directory, environment and output handling. A correct PHP version alone does not load the application’s configuration automatically.
  5. Test a safe invocation and the next scheduled run, then compare the application’s runtime requirements and last-run status.

02 Example: inspect the exact PHP binary selected for cron

On a cPanel account with Terminal or SSH enabled, test the full executable path supplied for your application. The path below is an EasyApache PHP 8.4 example and works only when that runtime is installed and supported for your application.

Code or configuration example
/opt/cpanel/ea-php84/root/usr/bin/php -v
/opt/cpanel/ea-php84/root/usr/bin/php --ini
/opt/cpanel/ea-php84/root/usr/bin/php -m

Read the result: Read the version, loaded configuration paths and extension list. Compare them with the application's CLI requirements and with its web runtime. A matching major version does not guarantee that the same extensions or INI settings are active in both environments.

Use the verified absolute binary path in the reviewed cron command. If this example path is absent, ask for the installed path rather than creating symlinks or copying a binary from another server. Avoid publishing full runtime diagnostics if they reveal private paths or configuration details.

Confirm the expected result

The scheduled task should report the intended runtime and complete its work without missing-extension or syntax errors. Recheck after a hosting migration or runtime retirement.

Troubleshoot unexpected results

If the executable is unavailable, ask which supported binary applies to the service. CloudLinux and EasyApache paths can differ. Do not install a private unsupported PHP build into the account as a routine workaround.

Why does the website work while cron fails?

The two processes can use different PHP versions, configuration files, extensions and environment variables. Compare those differences with the exact error before raising limits or changing the website’s working runtime.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support