Re: [PHP] Includes eating up my time



Hi Dave,

PHP general list,

This is probably obvious to people who are good at PHP, but I'm

I have a PHP based CMS (content management system) built, which has
grown and become quite robust. It's now spread out over about 30 files,
and each file represents one class within the object oriented design.
Each are a couple hundred lines of code, and two or three of the most
critical classes are over a thousand lines of code.

It may just be a 'dave' thing but my stuff does that too :-)

While first building it, I didn't really anticipate quite that many
files. What I did is have a file called "includes.php", which list all
the files to be included. Then I in turn included "includes.php" at the
beginning of my "index.php" file. Every page request passes through the
"index.php" file, so that basically means every single file is included
at the start of every new page request.

Ahh the 'dave' thing returns :-)

I'm using Zend Studio, which has a "profile" option, which shows how
long it takes for my PHP scripts to complete a request. It has a
breakdown showing percentages of which scripts are using that processing
time.

Real dave's use vi & top :-P

My second question is: Is there a systematic way of determining how to
incrementally include files that people use? Or is it just a constant
process of testing and checking?

Thank you for any advice.

What version of PHP are you using ? I moved over to 5 and it has a nice
cute feature :-

<http://uk3.php.net/__autoload>

which basically only loads classes when they are required. PHP 5 has
some other nice to have features and will cause you a bit of work if
you migrate to it BUT it is worth the effort especially in the light of
888 :-)

As for your performance problems, the times are heavily dependant on the
hardware and underlying OS & server load etc. without further info,
diagnosing problems will be dificult.

TTFN



Dave
php/general-2007-07-31.tx php-general martin@xxxxxxxxxxxxx
+----------------------------------------------------------------------------+
| Dave Restall, Computer Nerd, Cyclist, Radio Amateur G4FCU, Bodger |
| Mob +44 (0) 7973 831245 Skype: dave.restall Radio: G4FCU |
| email : dave@xxxxxxxxxxx Web : Not Ready Yet :-( |
+----------------------------------------------------------------------------+
| Big book, big bore. |
| -- Callimachus |
+----------------------------------------------------------------------------+
.



Relevant Pages

  • Re: Securing an Email script
    ... request to our sales office. ... Since you do ZERO checking on the values it's nothing BUT security ... very powerful PHP function to validate form fields and other ...
    (comp.lang.php)
  • Re: Object Oriented Content System - the idea
    ... >I expected php to be smarter then that. ... >form like bytecode in memory for the next request. ... each action added some stuff to a "response" XML document. ... that map/object/data and formats it for HTML display using an includeed PHP ...
    (comp.lang.php)
  • Re: Securing an Email script
    ... request to our sales office. ... Since you do ZERO checking on the values it's nothing BUT security issues. ... very powerful PHP function to validate form fields and other strings - ...
    (comp.lang.php)
  • Re: Modular PHP
    ... How can I catch an event in PHP. ... Everything is done with XML, so you will want to be familiar with XSLT ... the function itentified by the Handler attribute in the above XML, ... It's also worth noting that all the XML parsing for the request map ...
    (comp.lang.php)
  • Re: JSP script riddled with errors - cant resolve them - please help
    ... As far as declarations are concerned, in PHP we don't often do ... >> I do not possess the ability to translate PHP into JSP, ... >> function getPage() { ... > and request is not understood there. ...
    (comp.lang.java.help)