workerman icon indicating copy to clipboard operation
workerman copied to clipboard

Run in production

Open omegaalfa opened this issue 2 years ago • 4 comments

How do I run it with my online apache server for testing, I can only run it on the local machine through the command line

omegaalfa avatar Feb 20 '22 16:02 omegaalfa

I have the same issue. On local machine I can just use the (Laravel) command and it works. But when I try to run the same command in production I get the following back:

Usage: php yourfile <command> [mode]
Commands:
start           Start worker in DEBUG mode.
                Use mode -d to start in DAEMON mode.
stop            Stop worker.
                Use mode -g to stop gracefully.
restart         Restart workers.
                Use mode -d to start in DAEMON mode.
                Use mode -g to stop gracefully.
reload          Reload codes.
                Use mode -g to reload gracefully.
status          Get worker status.
                Use mode -d to show live status.
connections     Get worker connections.

DeBelserArne avatar Feb 20 '22 17:02 DeBelserArne

@omegaalfa workerman only run on the php command line. Workerman does not rely on Apache, it only relies on php cli. You must start it with command which may like php start.php start or php start.php start -d(for daemon mode).

walkor avatar Feb 21 '22 02:02 walkor

@aFluxx Show your command please.

walkor avatar Feb 21 '22 02:02 walkor

@walkor

Sorry I wasn't notified before. I was using a Laravel Command to run the process, but this wasn't working, so I had to do some extra steps.

I've added the option to provide some of the parameters workermann expects:

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'websocket:bitmart {action} {deamon}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Start a Bitmart websocket connection (action="start, stop") (deamon="on,off)';

Then in the actual implementation I access the global $argv and set the indexes accordignly:

        global $argv;

        $argv[1] = $action;
        $argv[2] = $deamon == "on" ? '-d' : '';

This did the trick!

DeBelserArne avatar Feb 23 '22 17:02 DeBelserArne