laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.76k stars 294 forks source link

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

Closed francsiswanto closed 3 years ago

francsiswanto commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

francsiswanto commented 3 years ago

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 commented 9 months ago

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 commented 8 months ago

@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 commented 7 months ago

@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!