Skip to content

[Bug]: Default PHP socket (herd.sock) not created on macOS, causing 502 Bad Gateway #1604

@memorasolutions

Description

@memorasolutions

Environment

  • Herd Version: 1.24.2
  • Operating System: macOS Sequoia 15 (Darwin 25.0.0)
  • PHP Versions Installed: 8.2, 8.3, 8.4, 8.5
  • Architecture: Apple Silicon (ARM64)

Description

After restarting Herd, all sites return 502 Bad Gateway or ERR_CONNECTION_REFUSED. Nginx starts correctly but cannot communicate with PHP-FPM.

Root Cause

The default PHP socket herd.sock is not created, while version-specific sockets exist:

  • herd82.sock
  • herd83.sock
  • herd84.sock
  • herd.sock (missing)

Nginx configuration references herd.sock for sites without isolated PHP versions, causing the 502 error:

connect() to unix:/Users/.../Herd/herd.sock failed (2: No such file or directory)

Workaround

Creating a symlink resolves the issue temporarily:

ln -sf ~/Library/Application\ Support/Herd/herd84.sock ~/Library/Application\ Support/Herd/herd.sock
herd restart

Expected Behavior

Herd should automatically create herd.sock pointing to the default PHP version, or nginx configs should reference the versioned socket directly.

Additional Context

A secondary issue was discovered: a deleted site (___CRÉATION_DEVIS___.test) had orphaned SSL config files (.conf, .key) but the certificate (.crt) was missing. This prevented nginx from starting entirely with the error:

cannot load certificate "...___CRÉATION_DEVIS___.test.crt": No such file or directory

Removing the orphaned files from ~/Library/Application Support/Herd/config/valet/Certificates/ and Nginx/ allowed nginx to start.

Suggested Fix

  1. Ensure herd.sock symlink is created/updated when PHP default version changes
  2. Clean up orphaned SSL/nginx configs when a site is removed or unlinked

Reported by: Stéphane Lapointe (stephane@memora.ca)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions