linux php 安装xdebug

我的环境是PHP 5.2.5,下载的xdebug是Xdebug v2.2.1 源码包
PHP 5.3.20用的是Xdebug v2.1.0 {版本一定要匹配}
下载地址为:http://xdebug.org/files/xdebug-2.2.1.tgz
安装过程是:
1、tar zxvf xdebug-2.2.1.tgz
cd xdebug-2.2.1
2、运行 phpize [如果没有将phpize加入$PATH,则应该使用全路径]
phpize
3、然后运行./configure --with-php-config=/usr/local/php/bin/php-config这个根据自己的目录定
之后是 make && make install

Read More

CI框架自带的验证工具及汉化

本人自己还是很喜欢CI框架自带的验证工具的,使用方式如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**  
*@blog<http://www.phpddt.com>
*/
public function do_login()
{

if ($this->form_validation->run('do_login') == FALSE)
{
$this->load->view('login');
}
else
{
$usr = $this->input->post("username",TRUE);
$psw = $this->input->post("password",TRUE);
$user = $this->user_mdl->validate_user($usr,$psw);
if($user)
{
/** 验证成功,更新用户信息,设置session,自动跳转 */
$data['last_active'] = time();
$this->user_mdl->update_user($user->uid,$data);
$session_data = array(
'uid' => $user->uid,
'username' => $user->username
);
$this->session->set_userdata($session_data);
redirect('admin/meta');
}
else
{
$this->session->set_flashdata('error', '用户名或密码不正确');
redirect('admin/login');
}
}
}

在view页面,你只要<?=validation_errors()?>就可以获取错误信息,但是提示是英文的,其实是有汉化包的哦!

Read More

LINUX下一款不错的网站压力测试工具webbench

1
2
3
4
wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz  
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install

如果在编译webbench的时候,出现/bin/sh: ctags: command not found,如下所示

1
2
3
4
5
6
7
8
[root@webbench-1.5]# make  
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c: In function ‘alarm_handler’:
webbench.c:77: warning: unused parameter ’signal’
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)

Read More