pthreads和apc一起使用错误:分段错误


pthreads and apc using together on error : Segmentation fault

我在php, phread和apc模块中安装并工作没有问题。问题是pthreads和apc一起使用,参见示例代码..

<?php
//use pthreads module
class Client extends Thread {
public function __construct($socket){
$this->socket = $socket;
$this->start();
}
public function run(){
$client = $this->socket;
if ($client) {
apcu_store('testkey123', "keyvalue", 2400);
$data=apcu_fetch('testkey123');
socket_write($client, $data);
socket_shutdown($client);       
socket_close($client);
}
}
}
$server = socket_create_listen(13000);
while(($client = socket_accept($server))){
$clients[]=new Client($client);
}
?>

见顶部代码返回错误分段错误(在线:apcu_store('testkey123', "keyvalue", 2400);)

我让新的脚本看到底部测试apc工作..

<?
apcu_store('testkey123', "keyvalue", 2400);
echo apcu_fetch('testkey123');
//work return keyvalue
?>

如何修复这个第一个脚本?

我找到了一个解决办法。apcu或apc引擎非常快速替代php信号量,共享内存和IPC -> SHM在所有条件下快速工作

shm_attach — Creates or open a shared memory segment
shm_detach — Disconnects from shared memory segment
shm_get_var — Returns a variable from shared memory
shm_has_var — Check whether a specific entry exists
shm_put_var — Inserts or updates a variable in shared memory
shm_remove_var — Removes a variable from shared memory
shm_remove — Removes shared memory from Unix systems

考虑以下页面了解更多信息:http://us3.php.net/manual/en/book.sem.php