I see two distinct problems within the debug file that have an effect on the script’s execution time. The details are as follows:
02:39:28.5277 - 02:39:41.6541: 13.1264 seconds - Total execution time
Detected bottlenecks:
02:39:28.548 - 02:39:29.048: 0.500 seconds - SQL execution
02:39:29.4073 - 02:39:40.8563: 11.449 seconds - minClean()
02:39:40.8659 - 02:39:41.3703: 0.5071 seconds - SQL execution
Total bottleneck lag: 12.4761 seconds
Remaining time used: 0.6503 seconds
Before I get into the numbers, I’d like to point out that , due to an omission on my part in my earlier post, some of the proper information isn’t getting to the debug script correctly. The upgraded debugging script has been re-designed to show exactly which line, in what function, of which file, the runDebug function was called, but it requires all of the function calls to be modified to look like the following:
runDebug([DEBUG_LEVEL], __FILE__, __FUNCTION__, __LINE__,[MESSAGE]);
The above function call uses PHP’s “Magic Constants” to supply runDebug with the name of the file, the name of the function the call was made from, and the line number of the call itself. This proves to be extremely useful for debugging, but only if the call is properly structured. The first value is the “debug level” (3 is default, and most common), which is explained in the comments in debugging.php - The 2nd through 4th should be fairly self-explanatory and they are all structured the same way, with 2 underscores each, at both the beginning of the constant, and also at the end - That’s a total of four underscores per constant. This is important, if you don’t want your script to break. . The last, of course, is the message that’s passed to the debugger for output. I know that there are literally dozens of these function calls (perhaps over a hundred - I never counted them) across a goodly number of files, but if the editor that you use can do a “search and replace” using regular expressions, it’s likely to be a relatively painless process to change all of the function calls over. I’m no good with RegEx, so I did all of mine the “old fashioned” way, and it took me a couple of hours. But in doing so, I’ve EASILY saved that amount of time and more in debugging my version of the script.
Now, on to the bottlenecks I’ve found: I have some questions, first (of course!)
1.) Is the SQL server on the same address (e.g. localhost) as the web server, or is it located elsewhere?
2.) Which version of MySQL and PHP are running? (You can find this easily enough by creating a PHP file (hidden from the public - There is a LOT of data in the resulting page, much of it exploitable by the wrong person) with only the command
phpinfo();
within the file. If your MySQL server is on the same web host/address, you’ll see the version info for that on the resulting page, as well. If not, then if you have access to a DB manager like phpMyAdmin you can locate the MySQL version there.
If you have access to phpMyAdmin, or some other database manager, you can also use it to test the execution time of a simple query. This will tell you if there’s a lag/latency problem between your web server and your DB server, or if the DB server is just slow. If it’s just plain slow, there may not be much you can do about it. If there’s a lag problem between the two servers, you may be able to contact your web hosting provider and see if there’s something that can be done.
Now: minClean… This is a prickly problem, because I’ve been plagued with problems here in the past. I’ve made several modifications to my version of Program O; some of which I’ve publicly documented, and I think I’ve even made some changes to this function, as well. The problem is that I’ve also made several fundamental changes to the overall structure of the entire script (such as moving the response array into a session variable, to maintain state across requests - essential when using jQuery, or other AJAX calls with the script), and therefore none of the functions that I’ve modified will simply “drop into” Program O without making some substantial changes. As you’ve said that you’re no PHP wizard, this may prove to be a bit problematic. I’m more than happy to help in any way I can, but something of this nature requires an ability to communicate that exceeds the limitations of a forum. I have a contact page for my website that you can use to email me (or you can use the handy-dandy link under my avatar), that will allow me to send you contact details that I would rather not make public. Also, if you have Skype installed, you are always free to call me that way, too. There’s a button in the left sidebar of this page that you can use for that.
While I’m waiting on the info I’ve requested, I’ll do a side-by-side comparison of my version of minClean(), and the original. If I changed more than the fundamental structure stuff I mentioned, I’ll post a “reverted upgrade” of the script. If all I did was change $response_Array to $_SESSION[‘response_Array’], then there’s no real point in posting it; but I’ll check it out, just to be sure.