Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows installation #170

Closed
nadinyamaui opened this issue Sep 30, 2017 · 18 comments
Closed

Windows installation #170

nadinyamaui opened this issue Sep 30, 2017 · 18 comments

Comments

@nadinyamaui
Copy link

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 (laravel/docs#3686)

@jeffreyvanhees
Copy link

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.

@nadinyamaui
Copy link
Author

nadinyamaui commented Nov 24, 2017 via email

@driesvints
Copy link
Member

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.

@tcope25
Copy link

tcope25 commented Feb 1, 2019

@driesvints any update on getting horizon to work on windows?

@driesvints
Copy link
Member

@tcope25 nope but we're open to pull requests.

@SavageDan
Copy link

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?

@driesvints
Copy link
Member

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.

@woganmay
Copy link

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.

@taylorotwell
Copy link
Member

I have no plans to support Windows on this library and recommend using WSL2 when developing on Windows.

@woganmay
Copy link

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 :)

@driesvints
Copy link
Member

@woganmay definitely feel free to publish a fork 👍

@xwiz
Copy link

xwiz commented Jun 4, 2021

Any updates @woganmay ?

@dorshiff
Copy link

dorshiff commented Mar 10, 2022

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 Any update on that? did you fork a version that will work on Windows?

@woganmay
Copy link

Hey @dorshiff - we ended up moving to Laravel Sail internally, which removed the need for running Horizon on Windows itself. It doesn't look like I published any of the code I wrote either, and this was almost 18 months ago!

Is this something you're blocked on?

@dorshiff
Copy link

dorshiff commented Mar 11, 2022 via email

@nikspyratos
Copy link

nikspyratos commented May 9, 2024

Hey @woganmay, any chance you still have that code at all?

While Sail and Homestead are options, in the age of Herd, something like this could be very useful for making Horizon viable for Herd & Windows based devs. Might be a bit above my head but happy to take a look at reviving it?

EDIT: Wogan DM'd me some of the idea, will look at perhaps reviving the idea for Windows Herd users...

@studioycm
Copy link

so if using Herd Pro on windows will not help, how can i get horizon whill developing on windows and still have the Herd Pro benifits?
I'm not familiar with a way to use WSL and still have a nice Herd Pro cgi to run everything

@nikspyratos
Copy link

nikspyratos commented Sep 23, 2024

so if using Herd Pro on windows will not help, how can i get horizon whill developing on windows and still have the Herd Pro benifits? I'm not familiar with a way to use WSL and still have a nice Herd Pro cgi to run everything

You can't, or at least the solution defeats the purpose of Herd: Just use a Docker container for PHP (in WSL or not) or use PHP in WSL directly.

But if you're doing that, you can also just go ahead and install most of Herd's other tooling as well on your containerised setup or WSL and just not use Herd.

Or just don't use Horizon on local at all. You basically have to decide if not using Horizon on local is a deal breaker for you.

In the end I also just ditched Windows anyway instead of trying to develop a workaround.

PS. Horizon isn't the only package affected by Windows-related PHP issues. Pail won't work, and any third party package using Prompts without a non-Prompts fallback won't work either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests