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
Previous revision
litespeed_wiki:php_lsapi_command [2013/09/24 19:37]
Michael
— (current)
Line 1: Line 1:
-====== LSPHP Command Line Mode ====== 
  
- 
- 
- 
- 
- 
-===== Summary ===== 
- 
-LSPHP(LSAPI + PHP) command line mode is for PHP binary running on a remote server that does not necessarily have web server running to process PHP scripts reside on local web server (separate). This setup is suitable for service scalability as PHP processing is offloaded to a remote server. 
- 
- 
- 
- 
-===== Setup ===== 
- 
-==== Start lsphp from command line on remote server ==== 
- 
-LSPHP is an executable and can be started manually and bound to IPv4, IPv6, or Unix domain socket addresses with the command line option ''​-b socket_address''​ 
- 
-Examples: 
- 
-Have LSPHP bind to port 3000 on all IPv4 and IPv6 addresses: 
- 
-  /​path/​to/​lsphp -b [::]:3000 
- 
-Have LSPHP bind to port 3000 on all IPv4 addresses: 
- 
-  /​path/​to/​lsphp -b *:3000 
- 
-Have LSPHP bind to address 192.168.0.2:​3000 : 
- 
-  /​path/​to/​lsphp -b 192.168.0.2:​3000 
- 
-Have LSPHP accept requests on Unix domain socket "/​tmp/​lsphp_manual.sock":​ 
- 
-  /​path/​to/​lsphp -b /​tmp/​lsphp_manual.sock ​ 
- 
-Environment variables can be added before the LSPHP executable: 
- 
-  PHP_LSAPI_MAX_REQUESTS=500 PHP_LSAPI_CHILDREN=35 /​path/​to/​lsphp -b IP_address:​port 
- 
-==== Setup LSAPI external app and script handler ==== 
- 
-(WebAdmin console > Configuration > Server or Virtual Host > External App) 
- 
-Address => IP_address: port (in step above) 
-auto start => no 
- 
- 
- 
- 
- 
-===== Load Balancing Backend PHPs ===== 
- 
-To load balance backend PHPs, create a "load balancer"​ external app, use backend PHPs (lsapi external app) as members and have script handler use the "load balancer"​ instead of php external app via Admin Console ​ 
- 
-  * Create LSAPI external app for each backend PHP as does in the typical setup above such as '​remote php #1' for remote server #1, '​remote php #2' for remote server #2, ..., '​remote php #n' for remote server #n, etc. 
- 
-  * Create a Load Balancer external app with backend LSAPI external apps in its workers list. 
- 
-    Name:   ​lsphp5_cluster 
-    Workers: ​ LSAPI::​remote php #​1,​LSAPI::​remote php #​2,​...,​LSAPI::​remote php #n 
- 
-  * Create a script handler for suffix php and tie to the load balancer external app (lsphp5_cluster) just created. 
- 
-    Suffixes: php 
-    Handler Type: Load Balancer 
-    Handler Name: [Server Level]: lsphp5_cluster 
- 
- 
- 
- 
-===== Note ===== 
- 
-  * PHP scripts on local web server need to be rsync'​d over to the remote server with exact path. 
- 
-  * If local web server is chroot'​d,​ then chroot needs to map to file system root of the remote server. e.g. if web server chroot is /​usr/​local/​opt,​ then /​usr/​local/​opt/​lsws/​DEFAULT/​html (default lsws vhost docroot) needs to be rsync'​d over and placed on remote server as /​lsws/​DEFAULT/​html. 
- 
-  * If no chroot, then /​usr/​local/​lsws/​DEFAULT/​html should be rsync'​d over as /​usr/​local/​lsws/​DEFAULT/​html. 
- 
-  * For load balancing backend PHP setup, since PHP runs on different servers, a central shared PHP session storage like memcached, etc is recommended as LSWS load balancing is not session aware. An ideal set up is using LiteSpeed Load Balancer which is session aware in front of LiteSpeed web server clusters. 
  • Admin
  • Last modified: 2013/09/24 19:37
  • by Michael