PHP-sem_在linux CentOs上获得未定义的runnin

PHP-sem_在linux CentOs上获得未定义的runnin,php,linux,mutex,semaphore,Php,Linux,Mutex,Semaphore,我犯了这个错误 Call to undefined function sem_get() <pre> starts <? try { echo "instance\n"; $mutex = new Mutex(633); echo "Acquire \n"; $mutex->Acquire(); echo "\n\n Atomic magic \n\n"; echo "release \n"; $mutex-&g

我犯了这个错误

Call to undefined function sem_get()
<pre>
starts
<?
try {

    echo "instance\n";
    $mutex = new Mutex(633);
    echo "Acquire \n";
    $mutex->Acquire();
    echo "\n\n Atomic magic \n\n";
    echo "release \n";
    $mutex->Release();
    echo "null \n";
    $mutex = null;
    echo "end \n";

}
catch (Exception $e)
{
    echo $e;
    echo "\n<hr>\n";
    var_dump(error_get_last()); 
}
它在PHP版本5.3.27、Apache/2.2.15和CentOS上运行

我找不到这样做的原因,而且我们有一个(几乎)相同设置的测试服务器,它工作正常(可能是不同的PHP扩展,因为我们在其他项目中也使用这个服务器)

我正在运行的测试如下所示:


开始

谢谢

您确定它已安装吗?使用起来好像没有加载,谢谢!
<?php
class Mutex
{
    protected $_Id;
    protected $_SemId;
    protected $_IsAcquired = false;

    /**
     * @param int $id Identifier of the Mutex, must be a number
     */
    function __construct($id)
    {
        if (!is_int($id))
        {
            throw new Exception('The Mutex identifier must be a number');
        }

        $this->_Id = $id;

        if (!($this->_SemId = sem_get($this->_Id, 1)))
        {
            throw new Exception('Error getting semaphore');
        }

    }

    public function Acquire()
    {
        if (!sem_acquire($this->_SemId))
        {
            throw new Exception('Error acquiring semaphore');
        }

        $this->_IsAcquired = true;
    }

    public function Release()
    {
        if (!$this->_IsAcquired)
        {
            return;
        }

        if (!sem_release($this->_SemId))
        {
            throw new Exception('Error releasing semaphore');
        }

        $this->_IsAcquired = false;
    }
}
?>