通过开启Apache的Keep-Alive属性来支持php对mysql的持久连接
2012-10-26 09:23
756 查看
php对mysql的持久连接函数为:mysql_pconnect()
/etc/httpd/conf/httpd.conf # 需要在Apache的配置文件设置几个参数
# KeepAlive: Whether or not to allow persistent connections (more than one request per connection). Set to "Off" to deactivate.
Keep-Alive on
# MaxKeepAliveRequests: The maximum number of requests to allow during a persistent connection. Set to 0 to allow an unlimited amount. We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 0
# KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection.
KeepAliveTimeout 15 # 客户端发送HTTP请求成功之后,Apache将不会立刻断开socket,而是一直监听客户端这一请求,持续时间为15秒,如果超过这一时间,Apache就立即断开socket。
注意:Apache的版本为2.0以上。
/etc/httpd/conf/httpd.conf # 需要在Apache的配置文件设置几个参数
# KeepAlive: Whether or not to allow persistent connections (more than one request per connection). Set to "Off" to deactivate.
Keep-Alive on
# MaxKeepAliveRequests: The maximum number of requests to allow during a persistent connection. Set to 0 to allow an unlimited amount. We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 0
# KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection.
KeepAliveTimeout 15 # 客户端发送HTTP请求成功之后,Apache将不会立刻断开socket,而是一直监听客户端这一请求,持续时间为15秒,如果超过这一时间,Apache就立即断开socket。
注意:Apache的版本为2.0以上。
相关文章推荐
- 配置Apache 2.2+PHP 5.2.9支持OCI通过Oracle9i Client连接Oracle
- HTTP实现长连接(TTP1.1和HTTP1.0相比较而言,最大的区别就是增加了持久连接支持Connection: keep-alive)
- 配置Apache 2.2+PHP 5.2.9支持OCI通过Oracle9i Client连接Oracle
- 配置Apache 2.2+PHP 5.2.9支持OCI通过Oracle9i Client连接Oracle
- 小程序通过apache服务器利用php连接mySQL
- javascript连接mysql与php通过odbc连接任意数据库
- php连接mysql提示Call to undefined function mysql_connect() 或 ZenCart MySQL支持问题的解决
- apache/mysql/php编译安装及支持xcache和fastcgi方式运行
- centos7 开启PHP mysql nginx/apache 服务
- PHP 通过MYSQL扩展库 连接MYSQL例子
- CentOS 6.4系统通过yum安装 LAMP(Apache+MySQL+PHP)安装步骤及其卸载步骤
- golang开发的一个mysql连接代理池,支持多种语言客户端(PHP范例)
- Mac OS X Snow Leopard 开启Web共享,建立Web服务器:Apache+PHP+MySql
- PHP持久连接mysql_pconnect()函数使用介绍
- windows纯手工安装php和Apache以及连接mysql
- android 通过php 连接 mysql
- CentOS安装Apache,PHP,PHPMySQL支持
- Android通过PHP连接MySQL(读取)
- 让php支持mysql,gd,apache,jpeg,freetype的编译配置指令
- php+apache+mysql环境配置时apache服务不能开启的解决