Maintenance

Troubleshoot Local Apache and PHP Port Conflicts

Identify which local process owns HTTP, HTTPS and database ports before changing development stack configuration.

Local stacks often fail to start because another service already owns a required port. Installing multiple bundles can leave Apache, Nginx, IIS or a database service competing for the same network address.

Identify the port owner

On Windows, use netstat -ano to identify listening ports and their process IDs, then inspect the process in Task Manager or with tasklist. On Linux and macOS, tools such as lsof -i or ss -ltnp can show listeners. Common defaults include 80 and 443 for web traffic and 3306 for MySQL-compatible databases, but local configuration may differ.

Choose one service owner

Decide which stack should own each port. Stop an unused service through its normal service manager rather than killing random processes. If changing a port, update the web server, local hostname URL, virtual host and any application callback URLs consistently.

Check firewall and binding settings

A service bound only to loopback is not reachable from other devices. A service bound to all interfaces may be exposed beyond the developer's machine. Use the narrowest binding that supports the task and avoid opening firewall ports unnecessarily.

Read the service logs

A port conflict is only one possible startup failure. Review Apache, Nginx or database logs for syntax errors, missing modules, permissions and corrupted configuration. Preserve database data directories while troubleshooting.

Document the local stack

Record port overrides and service dependencies so the next developer does not repeat the same investigation. Avoid running multiple local stacks simultaneously unless their ports and service ownership are intentionally separated.

Further reading

Share this page Help other developers discover this resource.