swoole错误“uncaught error: class 'swoole_server' not found”的解决办法
如果你在执行swoole对应文件时,报下面的错误,
php fatal error: uncaught error: class 'swoole_server' not found in /mnt/windows/swoole/swoole-src/examples/server/echo.php:2stack 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:2stack trace:
出现这个错误的原因是因为php配置文件还没加有swoole扩展进去,直接执行php swoole的文件时,会报这个错。
推荐:《swoole教程》
可以通过下面的方法解决:
第一步:给php.ini文件加swoole扩展
vi /data/sort/php/bin/php.ini
新增:
extension=swoole
第二步:查看是否加入swoole扩展到php成功
php -m
可以看到多了个swoole扩展
第三步,再执行php swoole文件,即可发现运行正常,没有报错
以上就是运行swoole报错怎么办的详细内容。