The question might prompt many people to express a definitive Good or bad quickly, but please continue reading...

I've got a simple website where you will find 30 php pages (each one has some php server side code + HTML/CSS etc...). No complicated hierarchy, nothing. Just 30 pages.

I in addition have a group of purely back-finish php files - those that have code to save stuff to database, doing authentication, delivering emails, processing orders and so on. These is going to be used again by individuals 30 content-pages.

I've got a master php file that I send a parameter. This identifies which of individuals 30 files is required also it includes the right content-page. But every one of individuals may need a flexible quantity of back-finish files to become incorporated. For instance one content page may need nothing from back-finish, while another may need the database code, while another thing may need the emailer, database and also the authentication code etc...

I suppose whatever back-finish page is needed, could be incorporated within the appropriate content page, only one small alternation in the road and I must edit hundreds of files. It will likely be too cumbersome to check on which content page is asked for (switch-situation kind of factor) and can include the right back-finish files, within the master php file. Again, I must make many changes if your single path changes.

Being lazy, I incorporated ALL back-finish files inthe master file to ensure that no content page can request something that's not incorporated.

First question - is a sensible practice? if it's made by anybody whatsoever.

Second, maybe there is a performance problem or any type of problem because of me including all of the back-finish files no matter whether or not they are essential?

EDIT

The web site will get between 3000 - 4000 visits each day.

You need to benchmark. Time the execution of the identical page with various includes. However I guess it will not make much difference with 30 files.

But it can save you yourself time and merely enable APC within the php.ini (it's a PECL extension, so you have to install it). It'll cache the parsed content of the files, that will quicken things considerably.

BTW: There's no problem with idleness, it's a virtue )

If your internet site is object-oriented I'd recommend using auto-loading (http://php.internet/manual/en/language.oop5.autoload.php).

This utilizes a miracle method (__autoload) to search for a category if needed (it's lazy, exactly like you!), therefore if a specific page does not need all of the classes, it does not need to get them!

Again, though, this is dependent on if it's object-oriented or otherwise...

It'll decelerate your website, though most likely not with a noteworthy amount. It does not appear just like a healthy method to organize the application, though I'd re-think it. Attempt to separate the applying logic (eg. the majority of the server-side code) in the presentation layer (eg. the HTML/CSS).

it's not necessarily a bad practice when the files are small , consists of just definition and configurations. when they really run code, or very large, it'll result in a performance problem. now - in case your site has 3 site visitors an hour or so - who cares, for those who have 30000... that's another problem, and you have to continue to work harder to reduce that.

Thinking about how big your site should you haven't observed a downturn, why attempt to repair it?

If this involves bigger sites, the very first factor you could do is install APC. Despite the fact that your present approach to including files may not benefit just as much from APC as it may, APC will still do an incredible job speeding stuff up.

If response-speed continues to be problematic, you should look at including all your files. APC could keep a cached version of the sourcefiles in memory, but could only do that well if you will find no conditional includes.

Only if your PHP application reaches a size where memory exhaustion is really a large risk (observe that for many large-scale websites Memory isn't the bottleneck) you might like to conditionally include areas of the application.

Rasmus Lerdorf (the guy behind PHP) concurs: http://pooteeweet.org/blog/538