Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,770 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
124
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của beyondcode/herd-community

Tất cả issue của beyondcode/herd-community

Issue tương tự

Thêm issue về CLI

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.