我在linux 环境下用socket.io 出现的问题及处理
Unknown command: cronMessage
Usage: php yourfile [mode]
Commands:
start Start worker in DEBUG mode.
Use mode -d to start in DAEMON mode.
stop Stop worker.
Use mode -g to stop gracefully.
restart Restart workers.
Use mode -d to start in DAEMON mode.
Use mode -g to stop gracefully.
reload Reload codes.
Use mode -g to reload gracefully.
status Get worker status.
Use mode -d to show live status.
connections Get worker connections.
这是出现的第一个问题
解决方案,socket.io类库 提供了windows ,liunx 两种环境监听端口的方法,我出现了这个问题是因为在liunx 环境下使用的windows 监听端口的方法
只用进入项目根目录运行 php start.php start 即可
我又出现的第二个问题 posix_getpid()函数无法找到
运行 yum install php-posix
博主在Linux环境中使用Socket.IO时遇到了两个问题。首先,由于使用了错误的监听方法(适合Windows而非Linux),导致了'Unknown command:cronMessage'错误。解决方案是使用适用于Linux的启动命令。其次,遇到posix_getpid()函数未找到的问题,通过运行'yum install php-posix'解决了此问题。这表明在跨平台开发时需要注意环境差异并确保正确安装依赖。

被折叠的 条评论
为什么被折叠?



