Category: php

5

Mac 下安装 PHP 扩展 vld & xhprof


最近因为经常离线调试,所以开始重新在本机搭环境,还好 原本就自带了

[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 
sudo pecl install -f 

不过安装 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 的效果了。

4

利用 XCode 开发 PHP 的方法


平台上也试了不少的 IDE 和 Editor ,各有特色吧。

之前听说过有人在 XCode 上做 开发,所以今天我也试了一下,和 Textmate 一样,采用 Esc 键做为自动补全的快捷键,但是有下拉列表,并且在输入时会有提示。

在 Create Project 时选择最左侧的 Other 里面的 Empty Project

New Project.jpg

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

Project.jpg

test3.php - xcode_php_test.jpg

代码这样就导入进来了。

但是当我们编辑时会发现一些 PHP 语法的关键字颜色不对,那么可以去修改下面的文件。

cd //Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/
vim PHP.xclangspec

0

require_once 和 require 的性能比较


之前大家都是在程序里写上简单的 require_once 和 require 然后直接跑一遍 ab 来看时间,这回 Konstantin Rozinon 在 apache 模式下看了一下 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 里统一负责根据 5 的 __call 这个特性来去 require_once 相应的文件,一些性能上的损耗可以通过其它方式来弥补。比如 APC、XCache、Eacc 这些,opcode 现在成了 PHP 的必需品了。

原文:点击进入

btw: zend studio 7 beta 真慢……

0

PEAR 2009年1月12日更新


0

PHP招聘信息-PHP/MySQL DEVELOPER-TORONTO


Divaris Alexander Corporation is looking for an experienced to contribute as a contractor in the current development of our 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 . 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 standards
Working knowledge of XML, CSS and
PHP 4 and 5 (4 years +)
MySQL 4.11 and 5.1 (4 years +)
Additional Skills:
Working knowledge in a Environment
Knowledgeable in database modeling and tools(programs)
Flex 2 or 3 and
Coldfusion
Based in , 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

2

PHP:set_error_handler ……need more


本来想自己写个 处理的 logger 结果发现通过 set__handler 没办法捕获到 fatal & parse 唉,真愁人呐。

.net 上也没有找到办法,后来反到是在 zend.com 上找到了解决 catch fatal error 的办法就是在 auto_prepend_file 和 auto_append_file 上做手脚。

prepend 的文件里面有一个 string 里面是个 error page 的 包括一个 script 可以把错误信息发送到 的一个 api 上。

而在 append 的文件里通过 ob_get_contents() 来把那个 string 给去掉,如果能去掉就说明程序中间的执行流程正确,无错,如果有 fatal error 则没有办法到达 append 文件这步,所以会显示那个 html 页面。

方法还可以,但是因为每个 php 都要 prepend & append 可能效率会不行,和 Xuanyan 讨论了一小会暂时还是没有什么好办法来捕获 fatal & parse error 。

:(

0

XCache & XDebug on road


终于配置上 XCache 和 XDebug 了,可惜的是 --bridge 一直没搞好,只有双击运行 JavaBridge 后才行,唉,要是能内置到 PHP 里就好了。

继续研究 &

如果说之前在 UUSee 是向上研究,既“抽象”、“架构”的话,那么来 IMobile 之后研究方向则是向下,研究底层,研究以前没注意到的更细节的地方了。

:)

Good days, good luck.

Random Posts Recent Comments

  • 女友糖尿病害我蛀牙 Says:

    汗一个…...

  • Htj06 Says:

    zhenyouchuangyi...

  • 电商圈 Says:

    试图该怎么建立啊,,怎在程序中是吸纳...

  • edward Says:

    看得人心旷神怡,好文,情不自禁的顶一下...

  • Daniel Says:

    我也在处理这个问题,没有找到好的方法。我用了楼上兄弟的方法,还是可以的。不知道您找到好的方法了吗、我暂时楼上兄弟的方法。...

  • 卡,卡 Says:

    弱弱问一句:博主,你博客的模板这样设计pv高吗?...

  • 站长工具 Says:

    博主,兔年快乐!...

  • health Says:

    great post!!I hope I can read more in your website....

  • pdu Says:

    好博文,支持分享...

  • 站长工具 Says:

    博主的文章很不错,我是站长工具-站长精灵的作者,一款专业的SEO工具软件(可以帮您提高博客的流量),想跟您交换个链接,不知可否...

Tag Cloud

arm audio blog brew cache class debug flash google html j2me java javascript Joke linux lua mobile mtk php python ror ruby server shell stream unix web windows 优化 动态加载 女人 女生 平台 开发 手机 技术 流媒体 测试 漫画 生活 男人 男生 缓存 芯片