ShopX

Menu

24/7 Support
Back to Blog
OpenCart technical support
PHP CLI vs PHP-FPM in OpenCart: diagnosing cron discrepancies

PHP CLI vs PHP-FPM in OpenCart: diagnosing cron discrepancies

An OpenCart storefront and a scheduled import can use the same PHP source and run under different environments. The storefront may execute in a PHP-FPM pool, while cron calls a CLI executable resolved from a different path. A successful browser request gives you only one side of the comparison. Record the effective version, PHP SAPI, enabled extensions and execution limits for both sides before changing the application.

Practical check. Start with one failing task. Compare the values collected by the processes that run it, then test the fix through the actual scheduler.

Compare the processes that actually run

Run php -v, php --ini and php -m using the exact executable and account configured in the scheduler. An interactive shell and cron may have different working directories and PATH values. For the browser side, use the information exposed by the hosting panel or a temporary, access-controlled diagnostic in staging. Keep the comparison to known configuration fields and required extensions. A public phpinfo() page can expose deployment details.

CheckWhat it showsWhere to verify
Executable and SAPIVersion and pool from the host panelExact cron binary and php -v
ConfigurationEffective pool and scanned ini filesphp --ini
ExtensionsCheck the extension the module usesphp -m
Working directoryConfigured web contextVerify under the scheduler account

Reproduce the failing job

If cron cannot load mbstring while the storefront can, find the configuration scanned by the scheduled executable. Select the right binary or activate the extension for that runtime. Use absolute paths for PHP and the script, then verify whether the scheduled account can read the inputs and write to the intended temporary directory. A site-wide permission change rarely helps diagnose a mismatch in one job.

Run a small read-only scenario from the actual scheduler and keep the exit code, duration and a sanitized error code. Compare those results with the same operation in the web environment. If differences remain, check FPM pool overrides and effective limits. Batch long imports and persist a cursor so a process interruption can be recovered without repeating completed work.

Frequently asked questions

Why does php -v differ from the site's version?

It reports the executable called by the current shell. Your web server can use a different FPM pool.

Why did changing php.ini have no effect?

Confirm which file the runtime loads and whether the hosting panel has applied the change to the relevant worker processes.

What should go into the job log?

Record a stable job code, exit status, duration and a bounded error identifier. Keep environment variables and authentication details out of the log.

Share:
← Previous
crm prom: a practical guide to connecting and processing orders

Related Posts

Instant deliveryFiles immediately after payment
Regular updatesLatest module versions
Secure paymentProtected purchase
Technical supportWe will help with the setup