Skip to main content

lsphp Configuration

Learning Focus

By the end of this lesson you will know how to set up the lsphp external application in WebAdmin, configure the command path, and verify it runs correctly.

What lsphp Configuration Does

The lsphp external application definition tells OpenLiteSpeed which PHP binary to use, how to communicate with it, and what resource limits to apply.

Configuring in WebAdmin

Step 1: Navigate to External Apps

  1. Go to Server ConfigurationExternal App (or per-vhost External App)
  2. Click Add

Step 2: Fill in the Settings

SettingValueNotes
Namelsphp84Descriptive name
Addressuds://tmp/lshttpd/lsphp.sockUnix domain socket path
Max Connections35Adjust based on RAM
Command/usr/local/lsws/lsphp84/bin/lsphpPath to the lsphp binary
Instances1Usually 1 for auto-management
EnvironmentPHP_LSAPI_MAX_REQUESTS=1000Optional tuning

Step 3: Save and Test

# Verify the binary exists
ls -la /usr/local/lsws/lsphp84/bin/lsphp

# Reload OpenLiteSpeed
sudo /usr/local/lsws/bin/lswsctrl restart

# Check that lsphp processes start
ps aux | grep lsphp | grep -v grep

# Test PHP execution
curl http://localhost/info.php
info

The Command path must point to the correct lsphp binary for your desired PHP version. Different versions have different binary paths (e.g., lsphp81, lsphp83, lsphp84).

Common Configuration Mistakes

MistakeSymptomFix
Wrong binary path503 error on PHP pagesVerify path with ls -la
Socket permission issueConnection refusedCheck /tmp/lshttpd/ permissions
Max connections too lowSlow under loadIncrease, but check RAM
Missing PHP extensionsApplication errorsInstall missing lsphp84-* packages

Key Takeaways

  • The external app definition connects OpenLiteSpeed to a specific PHP binary.
  • Always verify the binary path, socket path, and connection limits.
  • Test with a simple PHP file after any configuration change.

What's Next