Search code examples
phplinuxcentossemaphore

Call to undefined function sem_get() for implemeting queue in PHP


I want to implement queues in PHP using FIFO. For this, I have installed Semophore.

enter image description here

But I am getting the error "Call to undefined function sem_get()"

It seems like it is showing in phpinfo, but still giving error

Any help?


Solution

  • I was unable to work but I have implemented a queue using Redis in PHP

    $redis = new Redis(); 
    $redis->connect('127.0.0.1', 6379); 
    //set the data in redis string 
    $redis->set("quenename", "enter queue name");    
       
    //Getting data in redis string   
    $redis→get("quenename");
    

    #Further, the code has been updated using redis library

    $redis = $this->redis();
    $ret = $redis->connect(REDIS_HOST, ZGH_REDIS_PORT);
    $res = $redis->lPush(REDIS_HRGAME_PUSH_BATCH_KEY,$pushInfo);
    

    #I am not adding the whole code. This is just for the solution if someone also trying to implement same in PHP.