Posted: January 6, 2011 at 11:26 am | Tags: debug, mac, php, vld, xhprof
最近因为经常离线调试,所以开始重新在本机搭环境,还好 Mac 原本就自带了 PHP 。
[515][MacBookPro: /tmp]$ which php
/usr/bin/php
[516][MacBookPro: /tmp]$ php --version
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
既然有 php 那就先试试直接用 pecl 来安装。
sudo pecl install -f vld
sudo pecl install -f xhprof
不过安装 xhprof 时提示说要在扩展的目录里,查了一下 PECL Bug #16438 里面说是 pecl 里 xhprof 包的问题。那么问题也就很好解决了,直接把源码包下载下来安装即可。
wget http://pecl.php.net/get/xhprof-0.9.2.tgz
tar zxf xhprof-0.9.2.tgz
cd xhprof-0.9.2/extension
phpize
./configure
make
make install
然后修改 /etc/php.ini 如果没有这个文件就 sudo cp /etc/php.ini.default /etc/php.ini。
在 php.ini 中增加 extension=vld.so 和 extension=xhprof.so 和针对这两个扩展的详细配置,这个可以在网上搜到。
然后在 ~/.bash_profile 里增加 alias phpo=’php -dvld.active=1′
以后再打 phpo xxxx.php 就可以看到 vld 的效果了。
Posted: June 2, 2010 at 6:45 pm | Tags: mac, php
在 Mac 平台上也试了不少的 IDE 和 Editor ,各有特色吧。
之前听说过有人在 XCode 上做 PHP 开发,所以今天我也试了一下,和 Textmate 一样,采用 Esc 键做为自动补全的快捷键,但是有下拉列表,并且在输入时会有提示。
在 Create Project 时选择最左侧的 Other 里面的 Empty Project

然后选位置保存即可,如果有代码想添加进来直接在菜单的 Project 里有 Add to Project


代码这样就导入进来了。
但是当我们编辑时会发现一些 PHP 语法的关键字颜色不对,那么可以去修改下面的文件。
cd /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/
vim PHP.xclangspec
Posted: July 8, 2009 at 5:15 pm | Tags: cache, class, debug, html, php
之前大家都是在程序里写上简单的 require_once 和 require 然后直接跑一遍 ab 来看时间,这回 Konstantin Rozinon 在 apache debug 模式下看了一下 lstat64 的操作数量,对比结果说 require_once 和 require 在时间上相关非常非常小,但是在读文件时是用绝对路径还是相对路径对性能还是有一些影响,因为绝对路径会少一些 stat。
引用原文:
- When using absolute_path there are fewer stat() system calls.
- When using relative_path there are more stat() system calls because it has to start stat()ing from the current directory back up to / and then to the include/ directory.
个人习惯上还是推荐用 require_once,并且这个不是显示的写在各个文件中,而是在中心的 loader 里统一负责根据 php5 的 __call 这个特性来去 require_once 相应的文件,一些性能上的损耗可以通过其它方式来弥补。比如 APC、XCache、Eacc 这些,opcode cache 现在成了 PHP 的必需品了。
原文:点击进入
btw: zend studio 7 beta 真慢……
Posted: December 13, 2007 at 3:09 pm | Tags: actionscript, developer, hire, html, java, javascript, job, linux, mysql, php, resume, toronto, web, 工作, 招聘
Divaris Alexander Corporation is looking for an experienced PHP developer to contribute as a contractor in the current development of our web based property tax platform.
Duties/ Responsibilities:
Database Modeling.
Preparation of application architecture.
Design and implement application.
We are looking for a well-organized, conscientious person with skills in PHP programming and a working knowledge of MySQL. You will be required to interact with our team and deploy the application features quickly, maintaining quality and reliability.
Experience required:
Organizations Skills
Communication Skills (oral and written in English)
Understanding of HTML standards
Working knowledge of XML, CSS and JavaScript
PHP 4 and 5 (4 years +)
MySQL 4.11 and 5.1 (4 years +)
Additional Skills:
Working knowledge in a Linux Environment
Knowledgeable in database modeling and tools(programs)
Flex 2 or 3 and Actionscript
Coldfusion
Based in Toronto, Divaris Alexander Corporation, incorporated in 1987, provides property assessment and municipal tax consulting services for industrial, commercial, investment and special use property owners and occupants.
We require that you be based in Toronto and able to work onsite.
Apply via email to info[at]dival.com
Posted: September 29, 2007 at 6:17 pm | Tags: error, html, php, ror, server
本来想自己写个 error 处理的 logger 结果发现通过 set_error_handler 没办法捕获到 fatal error & parse error 唉,真愁人呐。
在 php.net 上也没有找到办法,后来反到是在 zend.com 上找到了解决 catch fatal error 的办法就是在 auto_prepend_file 和 auto_append_file 上做手脚。
prepend 的文件里面有一个 string 里面是个 error page 的 html 包括一个 script 可以把错误信息发送到 server 的一个 api 上。
而在 append 的文件里通过 ob_get_contents() 来把那个 string 给去掉,如果能去掉就说明程序中间的执行流程正确,无错,如果有 fatal error 则没有办法到达 append 文件这步,所以会显示那个 html 页面。
方法还可以,但是因为每个 php 都要 prepend & append 可能效率会不行,和 Xuanyan 讨论了一小会暂时还是没有什么好办法来捕获 fatal & parse error 。
:(
Posted: September 28, 2007 at 4:03 pm | Tags: cache, debug, fastcgi, java, lighttpd, mobile, php, server, web
终于配置上 XCache 和 XDebug 了,可惜的是 php-java-bridge 一直没搞好,只有双击运行 JavaBridge 后才行,唉,要是能内置到 PHP 里就好了。
继续研究 FastCGI & Lighttpd
如果说之前在 UUSee 是向上研究,既“抽象”、“架构”的话,那么来 IMobile 之后研究方向则是向下,研究底层,研究以前没注意到的更细节的地方了。
:)
Good days, good luck.