Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bahjaat's avatar
Level 26

Laravel Herd 502 Bad Gateway with Artisan call method

Using Herd since the 'beginning' and totally satisfied with it.

The only thing is that when I use

Artisan::call(... some command ...)

Herd is responding with a '502 Bad Gateway' message.

The only log-files from Herd I saw were:

  • ~/Library/Application Support/Herd/Log/nginx-error.log
  • ~/Library/Application Support/Herd/Log/php-fpm.log

php-fpm.log file is empty and nginx-error.log had records from 1 month old.

Also reinstalled Herd with these instructions: https://herd.laravel.com/docs/1/troubleshooting/uninstalling

0 likes
3 replies
LaryAI's avatar
Level 58

The issue seems to be related to the Herd package and the 502 Bad Gateway error. Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Check the Herd documentation and GitHub repository for any known issues or troubleshooting steps specific to the 502 Bad Gateway error.

  2. Verify that the command you are trying to run with Artisan::call() is correct and does not have any syntax errors or missing dependencies.

  3. Check the server logs for any additional error messages or warnings related to the 502 Bad Gateway error. In this case, you mentioned the nginx-error.log file, but it only had records from 1 month ago. Make sure to check the most recent logs for any relevant information.

  4. Verify that the server environment meets the requirements for running the Herd package and the Laravel framework. Check the PHP version, extensions, and any other dependencies required by Herd.

  5. If possible, try running the command directly from the command line to see if it produces any errors or warnings. This can help isolate the issue and determine if it is specific to the Artisan::call() method or if it is a broader issue with the Herd package.

  6. Consider reaching out to the Herd package maintainers or posting a question on the Laravel forums or GitHub repository for further assistance. They may have specific insights or suggestions for troubleshooting the 502 Bad Gateway error with Herd.

Please note that without more specific information or access to the code and server environment, it is difficult to provide a precise solution.

Bahjaat's avatar
Level 26

Update: After reinstallation the nginx-error.log is filled with this message:

2023/11/03 18:20:19 [error] 73215#2175036: *31 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: .............test, request: "POST /livewire/message/admin.horizon.overview HTTP/2.0", upstream: "fastcgi://unix:/Users/edwin/Library/Application Support/Herd/herd.sock:", host: "........test", referrer: "https://..........test/admin/queue/overview"
Bahjaat's avatar
Bahjaat
OP
Best Answer
Level 26

Nevermind. Had something to do about that the horizon:status command was not enabled when NOT running in console. Had te register is separately in de AppServiceProvider before I could use it. Solved.

Please or to participate in this conversation.