Socket Configuration
Learning Focus
By the end of this lesson you will understand the difference between Unix sockets and TCP connections for PHP worker communication, and when to use each.
Socket Types
| Type | Address Format | Performance | Use Case |
|---|---|---|---|
| Unix Domain Socket | uds://tmp/lshttpd/lsphp.sock | Faster (no network stack) | Same-server PHP |
| TCP Socket | 127.0.0.1:5000 | Slightly slower | Remote PHP or containers |
Default Configuration
OpenLiteSpeed defaults to Unix domain sockets, which is optimal when PHP runs on the same server.
Troubleshooting Socket Issues
# Check if the socket file exists
ls -la /tmp/lshttpd/
# Check permissions
stat /tmp/lshttpd/
# If socket is missing, restart OpenLiteSpeed
sudo /usr/local/lsws/bin/lswsctrl restart
# Verify lsphp is running after restart
ps aux | grep lsphp | grep -v grep
| Problem | Cause | Fix |
|---|---|---|
| Socket file missing | Server not running or crashed | Restart OpenLiteSpeed |
| Permission denied on socket | Wrong ownership | Check /tmp/lshttpd/ ownership |
| Connection refused | PHP not running | Verify external app config |
Key Takeaways
- Unix sockets are the default and fastest option for same-server PHP.
- Use TCP sockets only for remote PHP workers or container setups.
- Socket permission issues are a common cause of PHP 503 errors.
What's Next
- Return to the PHP Integration module for the complete overview.