《运维--PlayBook》更新中.......!请访问: https://ops.cnmysql.com
pdo_mysql模块安装
如果没有安装pdo模块的需要先安装pdo模块,不然在编译pdo_mysql模块的时候会报如下错误:
configure: error: Cannot find php_pdo_driver.h.
1、进入源码模块目录编译pdo模块
cd /home/soft/nginx/php-5.5.14/ext/pdo
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
2、编译pdo_mysql
cd /home/soft/nginx/php-5.5.14/ext/pdo_mysql
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
编译完后vi php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/pdo_mysql.so
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/pdo.so
重启php-fpm
/etc/init.d/php-fpm restart
php -m 查看php的模块
或者:/usr/local/webserver/php/bin/php -r "phpinfo();"|grep -i pdo_mysql
开启php-fpm状态页有助于我们分析当前php请求的情况,来决定php-fpm参数是否设置合理。
nginx配置:
location /status {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
}
php-fpm配置:
pm.status_path = /status
状态页sample:
pool: www
process manager: static
start time: 20/Sep/2013:15:59:36 +0900
start since: 944
accepted conn: 300499
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 999
active processes: 1
total processes: 1000
max active processes: 438
max children reached: 0
slow requests: 0
nginx配置:
location /status {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
}
php-fpm配置:
pm.status_path = /status
状态页sample:
pool: www
process manager: static
start time: 20/Sep/2013:15:59:36 +0900
start since: 944
accepted conn: 300499
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 999
active processes: 1
total processes: 1000
max active processes: 438
max children reached: 0
slow requests: 0