我在php,phread和apc模块instalaled做一个插座彗星聊天应用程序没有问题。问题是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(&#39; testkey123&#39;,&#34; keyvalue&#34;,2400);)
我使新脚本看到底部测试apc工作..
<?
apcu_store('testkey123', "keyvalue", 2400);
echo apcu_fetch('testkey123');
//work return keyvalue
?>
如何解决这个第一个脚本?请帮帮我!
答案 0 :(得分:0)
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