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

Bug/Get Help: Octane:install and octane:start not working in Windows environment #282

Closed
francsiswanto opened this issue May 18, 2021 · 6 comments

Comments

@francsiswanto
Copy link

  • Octane Version: 1.0.0
  • Laravel Version: 8.41.0
  • PHP Version: 8.0.6
  • Server & Version: RoadRunner 2.0.0
  • Database Driver & Version: MySQL 8.0.23
  • O/S: Windows 10 Pro

Description 1:

Command of "artisan octane:install" not working properly and force me to download rr binary manually at https://github.com/spiral/roadrunner-binary/releases, this is the error messages:

E:\WebOnline\Apps\NSA\api\testoct>php artisan octane:install

 Which application server you would like to use?:
  [0] roadrunner
  [1] swoole
 > 0
0K

 Unable to locate RoadRunner binary. Should Octane download the binary for your operating system? (yes/no) [yes]:
 > yes
  Symfony\Component\Process\Exception\ProcessFailedException 
  The command "D:\PHP\php80nts\php.exe "./vendor/bin/rr" get-binary -n --ansi" failed.

Exit Code: 255(Unknown error)

Working directory: E:\WebOnline\Apps\NSA\api\testoct
Output:
================

Error Output:
================
  at E:\WebOnline\Apps\NSA\api\testoct\vendor\symfony\process\Process.php:267
    263      */
    264     public function mustRun(callable $callback = null, array $env = []): self
    265     {
    266         if (0 !== $this->run($callback, $env)) {
    267             throw new ProcessFailedException($this);
    268         }
    269
    270         return $this;
    271     }

  1   E:\WebOnline\Apps\NSA\api\testoct\vendor\laravel\framework\src\Illuminate\Support\HigherOrderTapProxy.php:34
      Symfony\Component\Process\Process::mustRun(Object(Closure))

      E:\WebOnline\Apps\NSA\api\testoct\vendor\laravel\octane\src\Commands\Concerns\InstallsRoadRunnerDependencies.php:175
      Illuminate\Support\HigherOrderTapProxy::__call("mustRun")

Description 2:

Command of "artisan octane:start" also not working with this error messages:

E:\WebOnline\Apps\NSA\api\testoct>php artisan octane:start

  Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" function
  s are not disabled by your php.ini's "disable_functions" directive.

Comparing to other package:

Since laravel/octane does not working on my laptop, I've tried other package, https://github.com/spiral/roadrunner-laravel with brand new installation of Laravel 8 and it is working, and also working on my existing Laravel 8 project without major problem.

Please help, how do I fix this problem?

Thank you.

@woodspire
Copy link

Laravel Octane will not work on Windows.

The pcntl extension is required and it is not available on windows.

https://www.php.net/manual/en/pcntl.installation.php

@themsaid
Copy link
Member

Use Sail https://github.com/laravel/sail

@francsiswanto
Copy link
Author

Laravel Octane will not work on Windows.

The pcntl extension is required and it is not available on windows.

https://www.php.net/manual/en/pcntl.installation.php

Thank you for this info, it would be way better if documentation in https://laravel.com/docs/8.x/octane mention about this fact.

@iVampireSP
Copy link

iVampireSP commented Dec 26, 2023

I found a magic way to run roadrunner on windows.

before do this, download roadrunner manually

php artisan make:command StartOctane
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class StartOctane extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:start-octane {--host=127.0.0.1} {--port=8000} {--workers=1}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $path = storage_path('logs/octane-server-state.json');
        if (file_exists($path)) {
            unlink($path);
        }

        $this->call('octane:start', [
            '--host' => $this->option('host'),
            '--port' => $this->option('port'),
            '--workers' => $this->option('workers'),
        ]);
    }
}

then run

php .\artisan app:start-octane

You will see it works!!!

direct run octane:start on windows
image

use command
image

@HassanDomeDenea
Copy link

HassanDomeDenea commented Jan 31, 2024

@iVampireSP
I tried your code, I downloaded road-runner as stated here:
https://roadrunner.dev/docs/intro-config/current/en
by using the following commands:

composer require spiral/roadrunner-cli
./vendor/bin/rr get-binary

and I got the file rr.exe in the root of my project.

then copied your command, but got the following error:
image

Although when I run the regular octane:start I get the usual error:
image

Any ideas ?

@ezalorpro
Copy link

@iVampireSP I tried your code, I downloaded road-runner as stated here: https://roadrunner.dev/docs/intro-config/current/en by using the following commands:

composer require spiral/roadrunner-cli ./vendor/bin/rr get-binary

and I got the file rr.exe in the root of my project.

then copied your command, but got the following error: image

Although when I run the regular octane:start I get the usual error: image

Any ideas ?

I encountered the same issue after runing the custom command suggested by @iVampireSP . The solution was to install spiral/roadrunner-http:^3.3.0, after that, the command suggested by @iVampireSP works.

Explanation:

Octane checks for Roadrunner installation using the isRoadRunnerInstalled() function, which verifies the existence of the PSR7Worker::class. This class is part of the roadrunner-http package.

If you want to know where i got the roadrunner-http, you can check the function ensureRoadRunnerPackageIsInstalled() function inside Laravel\Octane\Commands\Concerns\InstallsRoadRunnerDependencies, in there you have this:

image

Oh and sorry for commenting on a closed issue. Cheers!

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

No branches or pull requests

6 participants