Fatal error: Call to undefined function sem_get()

Adam picture Adam · Mar 9, 2011 · Viewed 8.4k times · Source

I'm new to PHP and I'm trying to run code I got from someone else on my Windows development machine. I installed PHP 5 and Apache 2.2, but when I try to run it I get the error:

Fatal error: Call to undefined function sem_get()

The line it's being thrown from is:

private function UpdateCounter($semkey, $memkey, $count)
{
    $sem_h = sem_get($semkey, 1);//this line is the problem
    ...
}

Answer

Pascal MARTIN picture Pascal MARTIN · Mar 9, 2011

The sem_get() function is provided by the Semaphore, Shared Memory and IPC component.

Quoting the introduction of it's manual section :

This extension is not available on Windows platforms.