Skip to content

Optimize PHP ​

Tune PHP without hiding the real bottleneck. Shared hosting exposes only the settings permitted by your plan.

Measure before changing settings ​

Back up the site, choose a repeatable page or API request, and record load time, server response time, errors, memory and CPU use. Test while signed out and signed in. Change one thing at a time on staging before applying it to production.

Steps ​

  1. Use a supported PHP version compatible with the application and required extensions. Test upgrades on staging.
  2. Check whether OPcache is enabled for web requests. Ask support about limits if the cache fills; command-line PHP settings may differ from the website.
  3. Keep production errors out of the browser and retain private error logs. Remove temporary diagnostic pages after checking them.
  4. Profile slow database queries, external API calls and repeated filesystem work before raising execution time or memory limits.
  5. Treat a PHP memory limit as a per-request allowance, not a speed setting. Excessive limits and concurrency can exhaust account or server memory.
  6. Use safe application caching. Do not disable OPcache timestamp checks unless your deployment reliably invalidates that cache after each release.

Check the result ​

Repeat the same measurements and confirm login, forms, uploads and checkout still work. Keep the change only if it improves the measured problem without causing errors. Clear only the relevant cache and keep a rollback copy.

Last reviewed ​

2026-10-28