Skip to content

Improve PHP Performance

  • Consider using one of our LiteSpeed Cache Plugins. These should make your site fly.

  • Install and enable PHP opcode cache.

  • Check the real time stats for the number of PHP processes during peak time (LSWS Web Admin > Actions > Real-Time Stats > External Application), check In Use, Idle, and WaitQ. If WaitQ is frequently higher than 0, the PHP max concurrency setting may need to be increased. For shared hosting environments, where PHP SuEXEC is normally used, PHP suEXEC Max Conn needs to be increased. See our PHP Concurrency documentation for more information on determining if PHP SuEXEC is used and how to increase the max concurrency of PHP.

  • If you see something like: [STDERR] Reached max children process limit: 10, extra: 3, current: 13, please increase LSAPI_CHILDREN in stderr.log, try to increase LSAPI_CHILDREN. In a control panel environment, you would change the PHP suEXEC Max Conn setting, found under Configuration > Server > General > Using Apache Configuration File, not the LSAPI_CHILDREN setting in External Apps.

  • Check your top output to determine which processes are using too much CPU/memory. Buggy PHP code could be causing these performance issues.

  • If the server has enough free memory, put PHP sessions and opcode cache disk storage under /dev/shm.

  • Have you enabled the timezonedb module for your PHP? It's common to see poorer performance after moving to a cloud server with shared storage, as the I/O latency sometimes causes trouble. A server with local disk may not notice the absence of the PHP timezonedb module with built-in DB, but it can be very costly for a cloud server with shared storage since PHP will scan hundreds of directories.

  • cPanel/WHM users should disable the PHP open_basedir feature.

  • Try PHP 7 instead of PHP 5.x. PHP 7 claims to be twice as fast as PHP 5.x.

  • Make sure PHP xdebug and snmp modules are disabled if you don't need them. The xdebug module is for developer IDE integration only and should not be installed by default. The snmp module will scan and parse available MIB files, but not everyone needs snmp support.