I ran into a problem with Apache’s mod_rewrite module this afternoon while setting up a Zend Framework web application. I had just setup a virtual host for my app and was setting up rewrite rules to forward requests to ZF’s front controller. However, I wanted requests for existing filesystem resources (such as CSS, JS, and image files) to be served directly by Apache, bypassing the Zend Framework.
Loosely following the ZF Quick Start Guide, I copied these rules into my VirtualHost configuration:
Continue reading “Fun with Rewrite rules and Zend Framework”
Its important for programmers to be able to quickly identify all usage of a function. Knowing where and how a function is called helps greatly in understanding the intent of the code and allows the programmer to refactor with confidence.
There aren’t any tools for PHP that identify function usage, the way one might do with Java using Eclipse. The recent release of Zend 6 for Eclipse comes closer with its refactor feature, but only refactors within a single file and not across a project.
I solve this need with a handy grep call. The following grep finds all usage and definitions of a PHP function, and omits results from .svn directories. Just replace FUNC_NAME with the name of the function you’re investigating.
Continue reading “Identifying function usage in PHP code”