downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

msg_receive> <msg_get_queue
[edit] Last updated: Fri, 24 May 2013

view this page in

msg_queue_exists

(PHP 5 >= 5.3.0)

msg_queue_existsVérifie si une file de messages existe

Description

bool msg_queue_exists ( int $key )

Vérifie si la file de messages représenté par la clé key existe.

Liste de paramètres

key

La clé de la file.

Valeurs de retour

Cette fonction retourne TRUE en cas de succès ou FALSE si une erreur survient.

Voir aussi



msg_receive> <msg_get_queue
[edit] Last updated: Fri, 24 May 2013
 
add a note add a note User Contributed Notes msg_queue_exists - [3 notes]
up
0
tkuschel at loytec dot com
10 months ago
Following code will do the job:
<?php
$key
= 0;
while (
true) {
  echo
$key,"...\r";
  if (
msg_queue_exists($key))
   echo
"\r",$key,'::Exists',"\n";
  
$key++;
}
?>
up
0
michael dot hajuu at gmail dot com
2 years ago
A simple script for checking what message queues are in use on a [presumably new] server environment.

Run with php-cli

<?php
$k
= 0;
while (
true) {
  echo
$key,"...\r";
  if (
msg_queue_exists($key))
   echo
"\r",$key,'::Exists',"\n";
  
$key++;
}
?>
up
0
jaredm
3 years ago
A workaround for those not yet running 5.3 on *nix:

<?php
function queue_exists($key) {
    if(
function_exists("msg_queue_exists")) {
        return
msg_queue_exists($key);
    } else {
       
$aQueues = array();
       
exec("ipcs -q | grep \"^[0-9]\" | cut -d \" \" -f 1", $aQueues);
        if(
in_array($key,$aQueues)) return true;
        else return
false;
    }
}
?>

Maybe a bit slow and kludgey, but it works.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites