Array
(
[id] => 22
[title] => 这是一个测试的写入1111
[content] => 这是一个测试的写入cont1111
[created] => 1417686531
[status] => 1
)
0.014184951782227
The server is not running
PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in 1.php on line 3
Warning: mysqli::__construct(): (08004/1040): Too many connections in 1.php on line 3
连接失败:Too many connectionss
$start = microtime(true);
$conn = new \mysqli('localhost', 'root', '123456', 'man_db_read', 3306);
if($conn->connect_error){
die('连接失败:'.$conn->connect_error);
}
$sql = "SELECT * FROM man_articles LIMIT 1";
$result = $conn->query($sql);
if($result->num_rows > 0){
while($row = $result->fetch_assoc()){
print_r($row);
}
}else{
echo 'no record!';
}
$conn->close();
print_r(microtime(true) - $start);
exit;
{
"database": {
"account": {
"root": {
"user": "root",
"password": "123456"
}
},
"serverInfo": {
"server1": {
"write": {
"host": ["127.0.0.1"],
"port": 3306,
"timeout": 0.5,
"account": "root"
},
"read": {
"host": ["127.0.0.1"],
"port": 3306,
"timeout": 0.5,
"account": "root"
}
}
},
"databases": {
"man_db_read": {
"serverInfo": "server1",
"startConns": "swoole_cpu_num()*10",
"maxSpareConns": "swoole_cpu_num()*10",
"maxSpareExp": 3600,
"maxConns": "swoole_cpu_num()*20",
"charset": "utf8mb4"
},
"man_db_write": {
"serverInfo": "server1",
"startConns": "swoole_cpu_num()*10",
"maxSpareConns": "swoole_cpu_num()*10",
"maxSpareExp": 3600,
"maxConns": "swoole_cpu_num()*20",
"charset": "utf8mb4"
}
}
}
}
"server": {
"user": "root",
"password": "123456",
"charset": "utf8mb4",
"host": "0.0.0.0",
"port": "3366",
"mode": "SWOOLE_PROCESS",
"sock_type": "SWOOLE_SOCK_TCP",
"logs": {
"open":true,
"config": {
"system": {
"log_path": "ROOT/logs",
"log_file": "system.log",
"format": "Y/m/d"
},
"mysql": {
"log_path": "ROOT/logs",
"log_file": "mysql.log",
"format": "Y/m/d"
}
}
},
"swoole": {
"worker_num": "swoole_cpu_num()",
"max_coro_num": 6000,
"open_tcp_nodelay": true,
"daemonize": true,
"heartbeat_check_interval": 60,
"heartbeat_idle_time": 600,
"reload_async": true,
"log_file": "ROOT/logs/swoole.log",
"pid_file": "ROOT/logs/pid/server.pid"
},
"swoole_client_setting": {
"package_max_length": 16777215
},
"swoole_client_sock_setting": {
"sock_type": "SWOOLE_SOCK_TCP"
}
}
}