简体   繁体   中英

Swoole server only can be used in PHP CLI mode

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM