We are thinking about deploying a PHP accelerator (turck MMcache -- good, bad, ugly??) to accelerate a PHP project and I am unable to google an answer to the following question:
(please forgive my ignorance... coming from a Perl background -- but I'm really loving PHP!)
From an acceleration standpoint, is it better to dynamically load code based on user actions (see below), or break the project into action files?
In other words, if we are loading all of our code via 'index.php' dependant upon the user's action, will an accelerator help? Or would breaking the project out into separate php files be better?
For instance: Action -- download a file
Seperate files:
www.foo.com/download.php
Dynamic loading:
www.foo.com/index.php?action=download
if (in_array($_GET['action'], $valid_actions)) {
require('lib/' . $_GET['action'] . '.php'); // the 'require'd file, download.php is then executed
}
else
{
echo 'bad request';
exit;
}
The issue is that we have hundreds of actions -- index.php does a lot of house keeping and setup. Retrofitting to individual files would be tonnes of work (and is less desirable on our side, for a number of reasons).
Therefore, I would like to avoid the separate files route, if I can. However, would all of the code (for the entire project, regardless of action performed) be compiled into index.php? Wouldn't this then become a memory issue?
Thanks for your help and forgive my ignorance.