Home >PHP Framework >Swoole >What should I do if I get an error when running swoole?

What should I do if I get an error when running swoole?

藏色散人
藏色散人Original
2020-04-06 09:25:383321browse

What should I do if I get an error when running swoole?

What should I do if I get an error when running swoole?

Solution to the swoole error "Uncaught Error: Class 'swoole_server' not found"

If you are executing the swoole corresponding file, the following error will be reported ,

PHP Fatal error:  Uncaught Error: Class 'swoole_server' not found in /mnt/windows/swoole/swoole-src/examples/server/echo.php:2
Stack trace:
#0 {main}
  thrown in /mnt/windows/swoole/swoole-src/examples/server/echo.php on line 2
 
Fatal error: Uncaught Error: Class 'swoole_server' not found in /mnt/windows/swoole/swoole-src/examples/server/echo.php:2
Stack trace:

The reason why this error occurs is because the php configuration file has not yet added the swoole extension. When the php swoole file is directly executed, this error will be reported.

Recommendation: "swoole tutorial"

can be solved by the following method:

The first step: to php. ini file with swoole extension

vi /data/sort/php/bin/php.ini

Newly added:

extension=swoole

Step 2: Check whether adding swoole extension to php is successful

php -m

You can see more swoole extensions

The third step is to execute the php swoole file again and you will find that it runs normally and no errors are reported

The above is the detailed content of What should I do if I get an error when running swoole?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Why use swooleNext article:Why use swoole