This is not really an issue the problem is the following
Many people like me develop their apps in windows platforms and the production servers runs in Forge with Ubuntu.
Since horizon requires PHP extensions that are not compatible with windows developers might get composer issues saying that ext-pcntl or ext-posix are missing so people are not able to install the package and they probably wont use horizon in their local development only on production environments
So I think we should mention this in the Laravel docs: That Horizon is not compatible with windows, however users can install it by running composer install with the option --ignore-platform-reqs
PS: I created a PR on Laravel docs for this (https://github.com/laravel/docs/pull/3686)
We run multiple workers on Windows machines (because of Adobe After Effect) and we need Horizon for monitoring our workers. Is there no other solution for running this on Windows?
And yes, I agree this should be mentioned in the Laravel docs.
In my tests there is no way to run horizon on windows there is a way to compile one of the dependencies but that didn't work for me.
From: Jeffrey van Hees notifications@github.com
Sent: Friday, November 24, 2017 9:54 AM
To: laravel/horizon
Cc: Nadin arturo; Author
Subject: Re: [laravel/horizon] Windows installation (#170)
We run multiple workers on Windows machines (because of Adobe After Effect) and we need Horizon for monitoring our workers. Is there no other solution for running this on Windows?
And yes, I agree this should be mentioned in the Laravel docs.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/laravel/horizon/issues/170#issuecomment-346833668, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFTcs0klbu9PRMSz980UrGjJgVmKjfgpks5s5sqMgaJpZM4PpclK.
Hey everyone. We'd be open to deprecate usage of pcntl and posix and make Horizon work on Windows if anyone can ever send in a PR to the next major version which would solve this in a clean way.
@driesvints any update on getting horizon to work on windows?
@tcope25 nope but we're open to pull requests.
Why not use exec("kill -9 $pid"), which is available natively and can be switched out with the relevant windows kill command, depending on context? This would come with the added benefit that process workers need to be owned by the www user. Or am I missing something?
At the moment we're not looking to implement Windows support for Horizon ourselves but we're open to PRs which implement this in a clean way. Although I have to say that the internals would need to be overhauled by a lot in order to do so.
I've just run into this problem myself now, and I didn't want to open a new issue (so that the above context doesn't get lost).
I mainly use Windows as my dev environment too, and I've just spent some time looking at the Horizon code. I get why it would be a big overhaul to get it to run in Windows, but it doesn't seem impossible:
PHP has a built-in process control library that should work on Windows, and make it possible to spawn/kill worker threads from a supervisor: https://www.php.net/manual/en/book.exec.php
The pcntl functions have to do with listening for and processing signals, but it should be possible to listen for the Windows equivalent of SIGKILL using https://www.php.net/manual/en/function.sapi-windows-set-ctrl-handler.php
For the others (pause, continue, etc), a more universal solution might be to use a long-running PHP process bound to a socket (ReactPHP style) and have the artisan commands interact with that. Or if redis is a hard requirement, use that to manage process signals.
I may well end up going down this path to get it to work, but before I do, I wanted to check if I wouldn't be duplicating any effort.
I have no plans to support Windows on this library and recommend using WSL2 when developing on Windows.
So this is definitely possible with PHP 7.4: https://vimeo.com/480989385 - I'm about halfway to a complete implementation. Most of it just involves checking against PHP_OS_FAMILY (since PHP 7.3) and running slightly different commands. The signals that use pcntl can also be implemented as a really tiny shared memory block. I'll probably finish this up by next week.
If there's no plans to maintain this as an official part of Horizon, I have no problems maintaining my own fork - this solves a big problem for me :)
@woganmay definitely feel free to publish a fork 👍
Most helpful comment
Hey everyone. We'd be open to deprecate usage of pcntl and posix and make Horizon work on Windows if anyone can ever send in a PR to the next major version which would solve this in a clean way.