欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-04-25 23:08:08
...
我在我的环境里, 写了如下一个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未关闭