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
Next revision Both sides next revision
litespeed_wiki:php:configuring-lsws-for-php [2018/09/18 20:35]
Michael Alegre [Step 3: Configure the script or context handler]
litespeed_wiki:php:configuring-lsws-for-php [2019/05/28 19:27]
Jackson Zhang [Step 4: Perform a Graceful Restart]
Line 19: Line 19:
 If your PHP runs into 503 errors, this is often indicative of a problem with PHP. Please see our [[litespeed_wiki:​php:​503-errors|503 troubleshooting guide]] for the necessary steps to diagnose and fix these errors. If your PHP runs into 503 errors, this is often indicative of a problem with PHP. Please see our [[litespeed_wiki:​php:​503-errors|503 troubleshooting guide]] for the necessary steps to diagnose and fix these errors.
  
-===== Step 1: Install ​PHP through repositories ===== +===== Step 1: Install ​LSPHP through repositories ===== 
-If you are not using Control Panel php or cloudlinux PHP, you may need to install ​PHP Binary through rpms/​apt-get packages. ​+If you are not using Control Panel or CloudLinux, you may need to install ​the LSPHP Binary through rpms/​apt-get packages. ​
  
 |[[litespeed_wiki:​php:​rpm|Installing LSPHP via RPM]]|The fastest way to get PHP for CentOS| |[[litespeed_wiki:​php:​rpm|Installing LSPHP via RPM]]|The fastest way to get PHP for CentOS|
Line 78: Line 78:
 ===== Step 3: Configure the script or context handler ===== ===== Step 3: Configure the script or context handler =====
  
-Script and context handlers tell the server which files go to a certain application. A script handler uses a file's suffix (and associated MIME types). Script handlers differentiate content based on the file’s suffix (and the coressponding ​MIME type). Setting up an external application ​as a script handler ​(in the Script Handler tab at either the server or virtual host level) will cause the server to send certain types of files to that external application. When configured as a context handler, an external application will be used for content based on its location, not its file type. The web server will send content to the external application as long as the request’s URL matches the URI specified in the context settings.+Script and context handlers tell the server which files go to a certain application. Script handlers differentiate content based on the file’s suffix (and the corresponding ​MIME type). Setting up script handler for an external application (in the Script Handler tab at either the server or virtual host level) will cause the server to send certain types of files to that external application. When configured as a context handler, an external application will be used for content based on its location ​instead ​its file type. The web server will send content to the external application as long as the request’s URL matches the URI specified in the context settings.
  
 Both handler types can be configured in the WebAdmin Console with script handlers configured under **Configuration > Server > Script Handler** or **Configuration >Virtual Hosts > your_virtual_host > Script Handler**, and context handlers configured at the virtual host level under **Configuration > Virtual Hosts > your_virtual_host > Context**. Both handler types can be configured in the WebAdmin Console with script handlers configured under **Configuration > Server > Script Handler** or **Configuration >Virtual Hosts > your_virtual_host > Script Handler**, and context handlers configured at the virtual host level under **Configuration > Virtual Hosts > your_virtual_host > Context**.
 +
 +To create a server level script handler for LSPHP, first got to **Configuration > Server > Script Handler** in the WebAdmin Console. Here, add a new script handler and set **Suffix** to ''​php''​ or ''​php5''​ for example, depending on the suffix of your PHP scripts. **Handler Type** should be set to ''​LiteSpeed SAPI''​ and **Handler Name** set to the name of your previously created external application.
  
 {{ litespeed_wiki:​lsphp-script-handler-1.png?​800 }} {{ litespeed_wiki:​lsphp-script-handler-1.png?​800 }}
  
 {{ litespeed_wiki:​lsphp-script-handler-2.png?​800 }} {{ litespeed_wiki:​lsphp-script-handler-2.png?​800 }}
 +
 +===== Step 4: Perform a Graceful Restart =====
 +Perform a graceful restart to apply these changes and begin using the defined external application for scripts matching the suffix set in the related script handler. This can be done in the WebAdmin Console under **Actions > Graceful Restart**.
 +
 +
 +===== How to enable PHP SuEXEC on LSWS native =====
 +If you want to run PHP as user:group instead of webserver user such as ''​nobody'',​ you will need to create external apps (name should be unique and different than server level external apps and other virtual host external apps, for example, lsphp_$vhost;​ also set it to run as username:​usergroup to implement PHP SuEXEC) and script handler pointing to the newly created external app under each virtual host.
 +{{ :​litespeed_wiki:​php:​lsws-navie-php-suexec.png?​800 |}}
  • Admin
  • Last modified: 2019/10/18 20:27
  • by Jonathan Kagan