I had an issue which I first related to my PHP debugger (xDebug) setup until I found out that I have to click Continue (F5) in my IDE (NetBeans) 6 times until the page is displayed.
Note: I break at first line of PHP which is in index.php. Of course same thing happens if you have a breakpoint in index.php…
Can somebody explain the cause of this effect and/or possibilities to trace it?
Thanks 😉
If the page you’re loading contains assets that are also output as the result of a Zend controller then the debugger will start for every one of these. For example, say you’re serving javascript and CSS files through a Zend controller so that it can inject some dynamic blocks into them for whatever reason, every time you load a page that uses them, index.php will be invoked and the various things Zend does to resolve the URL will be done.
This will also happen when you’re trying to reference a resource that doesn’t exist. the rewrite rules in place are designed such that any request that doesn’t resolve to an actual file in the filesystem will trigger the Zend index.php script.
If your page has any Zend-generated resources on it or has links to resources that don’t exist then you’ll see the index.php script get invoked multiple times.
On a side note, this is a good reason why you should only ever generate dynamic content through Zend. I’ve run into projects where the developer was serving everything through a Zend controller. Given how heavyweight and expensive the Zend framework is to invoke, this can really hammer a site’s performance.