留言无法显示,php server.php报错(看不懂啥原因)

留言无法显示,php server.php报错(看不懂啥原因)

http://img1.sycdn.imooc.com//climg/5de6606e094ee31219200979.jpghttp://img1.sycdn.imooc.com//climg/5de6606e094ee31200000000.jpg留言发送出去没有在上面显示,是空白的

http://img1.sycdn.imooc.com//climg/5de660d709f8419e12810726.jpg这是php -S 192.168.121.136:9901 -d ./ 运行时相关代码

还有php server.php报错:

connection open: 1/var/www/html/websocket/server/server.php:11:

bool(false)

PHP Fatal error:  Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41

PHP Stack trace:

PHP   1. {main}() /var/www/html/websocket/server/server.php:0

PHP   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53

   73.8491     405720   3. {closure:/var/www/html/websocket/server/server.php:16-46}() /var/www/html/websocket/server/server.php:53


[2019-12-03 21:12:18 *15942.1] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41.

[2019-12-03 21:12:18 $15938.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=255, signal=0

connection close: 1

connection open: 2/var/www/html/websocket/server/server.php:11:

bool(false)

PHP Fatal error:  Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41

PHP Stack trace:

PHP   1. {main}() /var/www/html/websocket/server/server.php:0

PHP   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53

  104.4516     405704   3. {closure:/var/www/html/websocket/server/server.php:16-46}() /var/www/html/websocket/server/server.php:53


[2019-12-03 21:12:48 *16002.1] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41.

[2019-12-03 21:12:48 $15938.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=255, signal=0

connection open: 3/var/www/html/websocket/server/server.php:11:

bool(false)

PHP Fatal error:  Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41

PHP Stack trace:

PHP   1. {main}() /var/www/html/websocket/server/server.php:0

PHP   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53

  117.7138     405704   3. {closure:/var/www/html/websocket/server/server.php:16-46}() /var/www/html/websocket/server/server.php:53


[2019-12-03 21:13:02 *15941.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41.

[2019-12-03 21:13:02 $15938.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0

connection close: 4

connection close: 2

connection close: 5

connection open: 7/var/www/html/websocket/server/server.php:11:

bool(false)

connection close: 6

PHP Fatal error:  Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41

PHP Stack trace:

PHP   1. {main}() /var/www/html/websocket/server/server.php:0

PHP   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53


Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php on line 41


Call Stack:

    0.0005     395760   1. {main}() /var/www/html/websocket/server/server.php:0

    0.0051     399368   2. swoole_websocket_server->start() /var/www/html/websocket/server/server.php:53

  190.4915     414496   3. {closure:/var/www/html/websocket/server/server.php:16-46}() /var/www/html/websocket/server/server.php:53


[2019-12-03 21:14:14 *16028.1] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

Stack trace:

#0 [internal function]: {closure}(Object(swoole_websocket_server), Object(swoole_websocket_frame))

#1 /var/www/html/websocket/server/server.php(53): swoole_http_server->start()

#2 {main}

  thrown in /var/www/html/websocket/server/server.php on line 41.

[2019-12-03 21:14:15 $15938.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=255, signal=0


正在回答

登陆购买课程后可参与讨论,去登陆

4回答

同学你好,1. 报错信息:在 /root/index.php 文件中的第三行,出现未捕获RedisException:连接被拒绝。查看代码未发现有与index.php文件相关的代码,所以请同学查看 /root/index.php文件。

2. 错误原因:redis 所在的服务器防火墙引起的,可以尝试关闭防火墙。

关闭防火墙:service iptables stop 

祝学习愉快!

  • 陈莺莺呀 提问者 #1
    慕小尤老师,重启之后现在已经没有报错了,功能也已经实现。非常感谢。只有一个小问题,就是留言板的留言无法显示头像,麻烦看下我最新截图,这个不知什么原因?
    2019-12-08 18:53:28
guly 2019-12-07 10:10:10

你好,安装好apcu后,建议在apcu向后兼容性,需要在APCu的顶部添加APCu向后兼容模块以使其工作。安装 apcu_bc,操作步骤:(下载链接: (https://pecl.php.net/package/apcu_bc))

pecl install apcu_bc

如果解决您的问题请采纳,祝学习愉快!

  • 提问者 陈莺莺呀 #1
    老师,使用perl install apcu_bc,报错:Can't open perl script "install": 没有那个文件或目录
    2019-12-08 11:24:03
  • 好帮手慕小尤 回复 提问者 陈莺莺呀 #2
    同学你好,需要根据https://pecl.php.net/package/apcu_bc 连接下载apcu_bc然后再使用pecl install apcu_bc 命令。祝学习愉快!
    2019-12-08 11:31:57
  • 提问者 陈莺莺呀 回复 好帮手慕小尤 #3
    怎么根据https://pecl.php.net/package/apcu_bc 连接下载apcu_bc,使用什么命令?
    2019-12-08 12:47:03
guly 2019-12-04 14:49:49

你好,首先一个错误一个来调试,

1、PHP Fatal error:  Uncaught Error: Call to undefined function apc_fetch() in /var/www/html/websocket/server/server.php:41

建议切换PHP版本为7以上进行调试,或者按照以下链接方法进行修改:

https://www.go2live.cn/program/php/php-fatal-error-uncaught-error-call-to-undefined-function-apcu_fetch.html

祝学习愉快!



  • 提问者 陈莺莺呀 #1
    老师,我的php版本是php7.2.24,该版本已经移除了APCu,因此报错。根据您给的链接进行安装APCu,操作到重启php-fpm时,报错提示:PHP Warning: Module 'apcu' already loaded in Unknown on line 0
    2019-12-06 20:15:13
  • 提问者 陈莺莺呀 #2
    老师,我的php版本是php7.2.24,该版本已经移除了APCu,因此报错。根据您给的链接进行安装APCu,操作到重启php-fpm时,报错提示:PHP Warning: Module 'apcu' already loaded in Unknown on line 0
    2019-12-06 20:15:13
  • 提问者 陈莺莺呀 #3
    于是我将php.ini中的extension=apcu.so注释掉,不再报错。使用php -m查看,已存在apcu。但这样操作后再执行php server.php,依旧报错Fatal error: Uncaught Error: Call to undefined function apc_fetch()
    2019-12-06 20:19:47
提问者 陈莺莺呀 2019-12-03 21:21:57

源码都是用的老师的源码,只是改了ip,这个报错看不懂

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
PHP典型功能与Laravel5框架开发
  • 参与学习           人
  • 解答问题       722    个

掌握开发中必备技能解锁缓存、支付,邮件和短信发送等高端接口运用,直击工作重难点,通过开发简书项目熟练掌握Laravel5的开发技术。完成以上三个阶段的学习,成为满足企业需求的开发工程师。

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师