Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
litespeed_wiki:php:enable_opcode_cache [2018/08/07 14:17]
Jackson Zhang [For shared hosting environments:PHP SuEXEC]
litespeed_wiki:php:enable_opcode_cache [2018/08/07 14:34]
Jackson Zhang [For shared hosting environments:PHP SuEXEC]
Line 18: Line 18:
 You may follow [[litespeed_wiki:​php:​which_php_setup_am_i_using#​which_suexec_mode_am_i_using|this wiki]] to check which SuEXEC mode you are using. suEXEC Daemon Mode and suEXEC ProcessGroup Mode support opcode cache while the default suEXEC Worker Mode does not. If using opcode cache, you will need to change to suEXEC Daemon Mode or suEXEC ProcessGroup Mode. You may follow [[litespeed_wiki:​php:​which_php_setup_am_i_using#​which_suexec_mode_am_i_using|this wiki]] to check which SuEXEC mode you are using. suEXEC Daemon Mode and suEXEC ProcessGroup Mode support opcode cache while the default suEXEC Worker Mode does not. If using opcode cache, you will need to change to suEXEC Daemon Mode or suEXEC ProcessGroup Mode.
  
 +=== How to setup suEXEC Daemon mode ===
 To set up suEXEC Daemon mode, you need only adjust your server-level LSPHP external application settings in the WebAdmin console > Configuration > External App > your LSPHP external application:​ To set up suEXEC Daemon mode, you need only adjust your server-level LSPHP external application settings in the WebAdmin console > Configuration > External App > your LSPHP external application:​
  
Line 23: Line 24:
   Set Run On Start Up to "​suEXEC Daemon"​.   Set Run On Start Up to "​suEXEC Daemon"​.
  
 +=== How to setup ProcessGroup mode ===
 To set up ProcessGroup,​ you need to place the directive LSPHP_ProcessGroup in an httpd.conf file. This can be done at the server or virtual host level. If done at the server level, all virtual hosts will use ProcessGroup. If done at the virtual host level, only that virtual host will use ProcessGroup. To set up ProcessGroup,​ you need to place the directive LSPHP_ProcessGroup in an httpd.conf file. This can be done at the server or virtual host level. If done at the server level, all virtual hosts will use ProcessGroup. If done at the virtual host level, only that virtual host will use ProcessGroup.
  
Line 32: Line 34:
   </​IfModule>​   </​IfModule>​
  
 +=== ProcessGroup mode vs PHP-FPM ===
 Process Group Mode is similar to Apache php-fpm mode. The difference is: with Apache, the parent process of php-fpm is not controlled by Apache, and it keeps running; with LiteSpeed, LiteSpeed uses LSAPI, and the PHP will exit if idle for a while (in a shared hosting environment and set at [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps/​lsapi#​extMaxIdleTime|"​Max Idle time"​]]). ​ For LSWS 5.2.8 and lower versions, PHP processes will stop when LSWS restarts, and the opcode cache will be reset. Starting from LSWS 5.3RC2 and above, LSPHP will run in detached mode and an LSWS restart //​won'​t//​ stop PHP processes. The LSPHP parent will just follow the timeout where [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps/​lsapi#​extMaxIdleTime|"​Max Idle time"​]] is set. Process Group Mode is similar to Apache php-fpm mode. The difference is: with Apache, the parent process of php-fpm is not controlled by Apache, and it keeps running; with LiteSpeed, LiteSpeed uses LSAPI, and the PHP will exit if idle for a while (in a shared hosting environment and set at [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps/​lsapi#​extMaxIdleTime|"​Max Idle time"​]]). ​ For LSWS 5.2.8 and lower versions, PHP processes will stop when LSWS restarts, and the opcode cache will be reset. Starting from LSWS 5.3RC2 and above, LSPHP will run in detached mode and an LSWS restart //​won'​t//​ stop PHP processes. The LSPHP parent will just follow the timeout where [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps/​lsapi#​extMaxIdleTime|"​Max Idle time"​]] is set.
 +
 +=== Does opcode cache shared between multi-core processes? ===
 +For LSWS 2CPU and above licenses, you have an option to [[litespeed_wiki:​cpanel:​multi-litespeed-processes|configure LSWS to use multi CPU cores]]. For LSWS 5.2.x and below, When a domain served by multi-CPU cores, Opcache cache cannot be shared between CPU cores. ​ So when you test a phpinfo.php page, you might see cache hits like the following when refreshing a phpinfo.php page.
 +  http://​example.com/​phpinfo.php
 +    ​
 +  505
 +  0
 +  1
 +  506
 +  507
 +  1
 +  2
 +
 +From LSWS 5.3RC2 and above version, LSWS can share opcache between Multi CPU processes.
 ==== For non-shared hosting environments:​PHP non-SuEXEC ==== ==== For non-shared hosting environments:​PHP non-SuEXEC ====
  
  • Admin
  • Last modified: 2019/05/17 21:18
  • by Kacey Schroeder