Monthly Archives: 七月 2011

关于doitphp,thinkphp,yii,ci,doophp等框架的性能对比测试

“Never guess, Get data”翻译成中国话就是:“不要胡乱猜测,拿出数据来证明”。前几天对常用的PHP框架进行了对比测试。内容如下: 测试环境: 硬件环境: THINKPAD T61笔记本 CPU:INTEL CORE(TM2) DUO T770 内存:2G 硬盘:320G 7200 显卡:集成显卡 软件环境: 操作系统:win 2003 sp2 PHP环境:Apache/2.2.17 (Win32) PHP/5.3.6 数据库:mysql 5.5.10 测试工具:apache bench (即:ab) 测试内容:ab -c 10 -n 1000 测试网址 让这些框架从同一个数据库,同一个数据表读出1000条数据,并在视图中显示出来,且视图采用视图渲染(即:layout和widget应用)。保证最后输出页面内容相同(HTML完全一样)。 测试结果: 1、原生php: 注:上图测试数据是500次的测试数据,在测试1000时,由于系统报错,故测试了500次。 所用时间:2.032秒(1.016*2) 平均每秒请求次数:492.31次 … Continue reading

Posted in 学习笔记 | Tagged , , , , | 5 Comments

使用PHP下载文件

使用PHP下载文件方法很多,比较常用的就是使用函数:readfile。演示代码如下: 代码一: header(‘Content-Description: File Transfer’); header(‘Content-Type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=’.basename($file_path)); header(‘Content-Transfer-Encoding: binary’); header(‘Expires: 0′); header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0′); header(‘Pragma: public’); header(‘Content-Length: ‘ . filesize($file_path)); readfile($file_path); 代码二: $fileinfo = pathinfo($thefile); header(‘Content-type: application/x-’.$fileinfo['extension']); header(‘Content-Disposition: attachment; filename=’.$fileinfo['basename']); header(‘Content-Length: ‘.filesize($thefile)); readfile($thefile); exit;

Posted in 我的代码 | Tagged | Leave a comment

centos上安装php运行环境(手记)

-, 配置apache 1.关闭防火墙 service iptables stop chkconfig iptables off 2.开启apache service httpd status service httpd start 3.更改http.conf配置 ServerTokens OS  –> ServerTokens Prod ServerSignature On –> ServerSignature Off DirectoryIndex index.html index.html.var –> DirectoryIndex index.html index.php 更改管理员邮箱 #ServerName new.host.name:80 –> 根据需要自行修改 Options … Continue reading

Posted in 学习笔记 | Tagged , , | Leave a comment

常用的HTTP 状态

header(‘HTTP/1.1 404 Not Found’); header(‘HTTP/1.1 403 Access forbidden’); 常用的HTTP 状态列表: 100 : Continue, 101 : Switching Protocols, 102 : Processing, 200 : OK, 201 : Created, 202 : Accepted, 203 : Non-Authoritative Information, 204 : No Content, 205 : Reset … Continue reading

Posted in 学习笔记 | Tagged , | Leave a comment

关于DoitPHP的性能测试

自DoitPHP对外发布以来,首次进行对DoitPHP与其它PHP框架进行性能对比测试 测试数据如下:http://bbs.doitphp.com/thread-6-1-1.html (注:文章中有截图,需注册才能看到)。 关于DoitPHP的命名。Doit = do + it, 来源于某公司的广告词:“JUST DO IT”。

Posted in 学习笔记 | Tagged | 2 Comments

mysql社区版服务器5.5.14发布

mysql官方网站发布了mysql社区版服务器的最新版本,5.5.14 下载地址: http://www.mysql.com/downloads/mysql/

Posted in 学习笔记 | Tagged | Leave a comment

PHP5.4新特性

据PHP官方报税PHP 5.4 alpha1 版已经发布了,下面就介绍一这个版本的新特性: Added: Traits language construct 新的语法结构,trait,用法看这里:https://wiki.php.net/rfc/traits Added: Array dereferencing support 以后可以这样用了 function fruit() { return array(‘a’ => ‘apple’, ‘b’ => ‘banana’); } echo fruit()['a']; Added: DTrace support DTrace是一个性能分析工具, 可以跟踪出函数调用点,返回点等数据.具体可以查看:http://blog.experimentalworks.net/2010/04/php-5-3-99-dev-and-dtrace-part-i/ Improved: Improved Zend Engine memory usage and performance … Continue reading

Posted in 学习笔记 | Leave a comment

停止空谈,开始行动

今夕何夕兮?来京工作已两年;今日何日兮?新的征程已开始。两年前的今天,我正式在现在的公司上班,“逝者如斯,不舍昼夜”,转眼两年就过去了。回顾自己,并没有多少的改变,赚钱不多,单身依旧,也不知何时功成名就。梦想,梦想,自己有梦,不敢去想。在这两年里所幸还能博览群书,彻底颠覆了“愚民教育”时的认识,思维更加开阔。这两年的学习和技术研究,虽没有带来自己物质的改变,却远胜于自己物质的改变。曾经的博客在来京后,工作繁忙,无暇维护而停止,如今又再次开放,从而揭开新一轮挑战的序幕。这只是一个开始,停止空谈,开始行动。

Posted in 心情随笔 | Leave a comment