Re: [PHP] Includes eating up my time
- From: dave@xxxxxxxxxxx (David Restall - System Administrator)
- Date: Tue, 31 Jul 2007 11:18:34 +0100
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 |
+----------------------------------------------------------------------------+
.
- Prev by Date: RE: [PHP] Blooging Portal
- Next by Date: Re: [PHP] PHP and Java: accessing Java classes from PHP
- Previous by thread: Flash 8 UI controls
- Next by thread: if inside an echo.
- Index(es):
Relevant Pages
|