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?

藏色散人
Release: 2020-04-06 09:25:38
Original
3284 people have browsed it

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:
Copy after login

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
Copy after login

Newly added:

extension=swoole
Copy after login

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

php -m
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template