Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug]: herd restart skips PHP versions used only by isolated sites ("Restarting PHP $_sock_...")

オープン
#1,770 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
cli

調査の方向性

Start by locating PhpFpm::utilizedPhpVersions() and isolatedDirectories(), which the issue identifies as the current version-discovery paths; inspect how stopIfUnused() uses the same version list. Reproduce with a global PHP version and a site isolated to another version, then run herd restart and check whether both PHP-FPM processes get new PIDs. Done when every version used by a site is restarted without the invalid $_sock_ name.

索引モデルが issue の本文から書いたものです。

説明

fixed-in-next-release macOS
Platform

macOS

Operating system version

macOS 27.0.1 (26A434)

System architecture

ARM64 (M1, M2, etc)

Herd Version

2.0.2 (Build: 71)

PHP Version

Not version-specific: any version that only isolated sites use. Here: global PHP 8.5.10, a site isolated to PHP 8.4.25.

Bug description

herd restart (and herd restart php) does not restart PHP-FPM for a version that only isolated sites use. Here the global PHP is 8.5 and a site is isolated to 8.4: herd restart prints Restarting PHP $_sock_... and Restarting PHP 8.5..., and afterwards only 8.5 has a new PHP-FPM process; 8.4 keeps its pid and start time (log below). Sites isolated to the global version are not affected, because the global version is always restarted.

Expected: every PHP version that a site uses is restarted.

Impact: low, but silent. Code changes are not affected (with Herd's default OPcache settings PHP picks them up by itself). But for a version that only isolated sites use, a php.ini change (for example memory_limit, upload_max_filesize or an extension) is not applied, and stuck PHP-FPM workers are not cleared, although the CLI says "Herd services have been restarted."

Cause, in herd.phar 2.0.2: in PhpFpm::utilizedPhpVersions(), the first entry of Herd::SUPPORTED_PHP_VERSIONS is 'php', which nginxSockName() turns into $herd_sock_. That is the start of every isolated site's socket name ($herd_sock_84), so the strpos() check matches it first, and str_replace(['herd', '.sock'], ...) turns it into $_sock_. Herd rejects that name ("Invalid PHP version provided", log below), but runAppleScript() discards stderr, so no error shows. stopIfUnused() uses the same list.

Suggestion: read each site's version from its # ISOLATED_PHP_VERSION= line, as isolatedDirectories() already does. Fixing only the prefix match wouldn't be enough: the str_replace() expects herd84.sock-style names and would give $_sock_8.4.

Workaround: quit and reopen Herd.

The same Restarting PHP $_sock_... line shows in output pasted in #402 (Herd 1.4.1) and #1597 (Herd 1.24.2), so this is probably not new.

Steps to reproduce
  1. Herd 2.0.2 with global PHP 8.5.
  2. Isolate a site to 8.4: herd isolate 8.4 --site=example (Herd installs 8.4 if needed).
  3. Note the PHP-FPM main processes: ps -o pid,lstart,command -p $(pgrep -d, -P $(pgrep -x Herd)) | grep fpm
  4. Run herd restart.
  5. Run the ps command again: 8.5 has a new pid and start time, 8.4 still has the old ones.
Relevant log output
PHP-FPM main processes before herd restart (from ps):
PHP 8.4 started Oct 19 22:35:05 2026 (pid 61676)
PHP 8.5 started Oct 19 22:03:47 2026 (pid 57366)

$ herd restart
Restarting DNSMasq...
Restarting PHP $_sock_...
Restarting PHP 8.5...
Restarting Nginx...
Herd services have been restarted.

PHP-FPM main processes after:
PHP 8.4 started Oct 19 22:35:05 2026 (pid 61676)
PHP 8.5 started Oct 19 22:35:35 2026 (pid 61898)

$ osascript -e 'tell application "Herd" to restart php service "$_sock_"'
27:56: execution error: Herd got an error: Invalid PHP version provided. Available versions are: 8.6, 8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4 (10)
主要言語
言語のデータがありません
スター
124
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

beyondcode/herd-community のほかの issue

beyondcode/herd-community の issue をすべて見る

似ている issue

CLI の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。