View Full Version : Troubles from exceeding apache MaxClient limit with first OO application

03-05-2009, 10:38 AM
I'm getting the following errors on my server and I'm worried it has something to do with my PHP script:

[error] child process 23767 still did not exit, sending a SIGKILL
[error] server reached MaxClients setting, consider raising the MaxClients setting

Basically all my websites on the server stop working, I call tech support for the server to fix it, and they gave me the above errors. It has happened 3 times today and seems to happen when I have tried to run some scripts from an app I'm working on. I don't know much about server admin, but could this be my app eating up too many resources somehow? I googled the error and read that if a very dynamic site can cause this error, if it's not written to conserve resources appropriately for the level of traffic. My sites get very little traffic, they are mostly in development, and certainly no one else is accessing this particular application right now except me testing parts of it. So, my first question: is this possible that i am causing the problem???!!!

I am just starting to figure out object oriented programming, the app is basically a CMS... my second question is: am I going about this all wrong and is there is a way to use less server resources... basically this is the structure of what I have, 4 classes:

a simple DataAccess class that stores a database connection, runs a few functions that automate basic CRUD queries with a MySQL database

a User class, with functions to log a user in, email them, create/delete/update accounts, check if they are logged in before each page loads, etc.

a Content class that deals with site content for editing, so it has functions to save, publish, delete, return lists of pages, etc.

then i have an 'Editor' class that shows all the editing interface stuff and works with the other classes. When I create a new editor class, the constructor creates a DataAccess object. Later, functions in the Editor class pass this DataAccess object as a parameter when instantiating the other 2 classes, so that they can use the same connection to update/retrieve data. (eg. a user object is created and logs in the current user, a content object is created and load content from the database to be edited.)

The Content and User class do things, and the Editor class presents an interface to the user - shows error messages, buttons, forms, comments, formatted lists of pages, etc.

I've read a lot about separating the data, presentation and business layers when writing applications, and I'm trying to do things right, but most of my previous experience is with more procedural programming. Any tips or criticisms on making things run efficiently would be much appreciated!