0

I am using Swoole server and slim framework, especially this library:

Slim Swoole Link

I have followed the tutorial, and gives me this error:

Fatal error: Swoole\Server::__construct(): swoole_server only can be used in PHP CLI mode. in /Users/powermilk/Documents/Proyectos/prueba/public/index.php on line 48

the line 48 has the below code:

$http = new swoole_http_server("0.0.0.0", 8081);

I don't understand why happens this if I quit the library code everything works nice, but I am not able to run slim with Swoole.

The server is running over Nginx.

Muhammad Usman
  • 1,403
  • 13
  • 24
Ratchet
  • 223
  • 1
  • 5
  • 13

1 Answers1

0

I'm the writer of the library. Yes, you have to create your "front controller"ish file and execute it from CLI. Sort of, from terminal, "php name_of_your_file.php" and leave it running.

Pachico
  • 26
  • 1
  • Okay, it tried to execute from Nginx server. One question, are you going to write a library for use sockets in slim framework? – Ratchet Oct 02 '18 at 07:27
  • I'm not planning it at the moment since I haven't seen a use case for me. But if you're interested and need a hand, I could help you out. – Pachico Dec 10 '18 at 11:48