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

來源:互聯網
上載者:User
我在我的環境裡, 寫了如下一個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未關閉

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.