大头

PHP性能之语言性能优化:安装VLD扩展——检测性能

使用Linux命令安装

//下载安装包
wget http://pecl.php.net/get/vld-0.14.0.tgz

//解压包
tar zxvf vld-0.14.0.tgz 

//进入编译、安装目录
cd vld-0.14.0/

//扩展PHP的扩展木块
phpize

//使用locate找到php-config路径
locate php-config
如果提示没有该命令,则运行如下命令
yum -y install mlocate
updatedb   //更行数据,即可用

//配置编译的php-config路径
./configure --with-php-config=/usr/local/php/bin/php-config --enable-vld

//编译安装
make && make install

//编辑php.ini文件,激活扩展
extension==vld.so

最后重启服务器,就OK

在我安装时,一直提示没有 configuer 文件,查看了一下README文件,原来可以通过git安装,以下是git安装。

通过git安装VLD扩展

步骤如下:

git clone https://github.com/derickr/vld.git cd vld phpize ./configure --with-php-config=/usr/local/php/bin/php-config --enable-vld make && make install

最后别完了,在php.ini文件里激活vld扩展

每一在命令安装时都解释了。

检查性能

php  -dvld.active =1 –dvld.execute=0 test.php

vld扩展主要的两个参数列表

-dvld.active  默认为0。代表是否在运行PHP文件是激活vld挂钩,

-dvld.execute 默认为1。代表只显示中间代码,不执行生成的中间代码,可以置0,表示不执行中间生成代码

更多的参数列表可以百度

也可以参考:http://blog.csdn.net/21aspnet/article/details/7002644

posted @ 2017-06-10 20:51  and大头  阅读(231)  评论(0编辑  收藏  举报

大头