贴: Warning: msg_get_queue(): failed for key 0x610005bd: File exists in

php中文网
发布: 2016-06-23 13:55:10
原创
1716人浏览过

我在我的环境里, 写了如下一个php文件: 
$msg_key = ftok(__FILE__, 'a');
$seg = msg_get_queue($msg_key, 0666);
?>
然后用命令行执行不能输出错误. 

但在网页执行的时候, 就会发生以下错误: 
Warning: msg_get_queue(): failed for key 0x610005bd: File exists in /var/www/html/test/sysvmsg.php on line 4

困扰了我一个下午, 求高手赐教. 
我的环境:linux + apache + php 5.3.3


回复讨论(解决方案)

看看php的文档说http://php.net/msg_get_queue

echo 100 > /proc/sys/fs/mqueue/msg_max

ftok 返回一个整数
msg_get_queue 发送一个消息

十六进制的 0x610005bd 是十进制的 1627391421

你得到并发送的不就是这个数吗?

If you are getting this message on your *NIX box:
 
Warning: msg_get_queue() [function.msg-get-queue]: failed for key 0x12345678: No space left on device in /path/to/script.php on line 1
 
you may use the command "ipcrm" as root to clear the message queue. Use "man ipcrm" to get more info on it.
 The default setting for maximum messages in the queue is stored in /proc/sys/fs/mqueue/msg_max. To increase it to a maximum of 100 messages, just run:
 echo 100 > /proc/sys/fs/mqueue/msg_max
 
Please ensure to follow a good programming style and close/free all your message queues before your script exits to avoid those warning messages. 
这是手册里的,跟你的情况是一致的吧!

你可以用命令ipcrm做为root清楚消息队列,再用 man ipcrm得到更多的信息。
在队列默认最大的消息存储在/proc/sys/fs/mqueue/msg_max里,想增加最多100条消息的话,可执行
 echo 100 > /proc/sys/fs/mqueue/msg_max

http://www.baidu.com/baidu?wd=Warning%3A+msg_get_queue%28%29%3A+failed+for+key+0x610005bd%3A+File+exists+in+%2Fvar%2Fwww%2Fhtml%2Ftest%2Fsysvmsg.php+on+line+4&tn=monline_dg

最终查明原因是: SELinux未关闭

豆包AI编程
豆包AI编程

智能代码生成与优化,高效提升开发速度与质量!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号