Skip to main content

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

TypeAddress FormatPerformanceUse Case
Unix Domain Socketuds://tmp/lshttpd/lsphp.sockFaster (no network stack)Same-server PHP
TCP Socket127.0.0.1:5000Slightly slowerRemote 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
ProblemCauseFix
Socket file missingServer not running or crashedRestart OpenLiteSpeed
Permission denied on socketWrong ownershipCheck /tmp/lshttpd/ ownership
Connection refusedPHP not runningVerify 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