Jason,
I’m starting a separate thread for this topic.
For profiling php, I use xdebug and wincachegrind to view results. http://xdebug.org/
Xdebug is a great tool because it also lets you view and step through code as it executes on the server. (hence the debug!
Xdebug adds additional overhead to the processing though, so I wouldn’t recommend enabling it in your production environment.
Kevin,
I think it would be very useful to the developers to know exactly how people are using xdebug and other tools to do debugging. It’s tricky business in an mixed PHP, Javascript, HTML, +MYSQL code set. Are you using a IDE editor or some combination of command line web tools (like firebug)?
I use NetBeans which has integration to xdebug (and git) but only with spotty results. It seems to work for a while and then stop. Eclipse (as used by my guys on MacOS) seems to be very solid, or they get it better than I do
I’m interested in your thoughts. My challenge is debugging the Javascript, I have not been able to wrap my head around that very well so far. It’n not one of my strong languages in any case, so extra hard.
Tony,
My development environment is NetBeans 7.0.1 under Windows 7.
I run my test server as ubuntu on a virtualized machine on the same physical machine using vmware player.
I configure NetBeans to access the remote web site and connect to it with sftp and have “upload on save” enabled.
I had some trouble before where xdebug would stop working because dhcp would give my virtual server a new ip address, but both it and my “host server” have static ip addresses now so that hasn’t been an issue.
I also stick the netbeans project files in a different directory than the source files, since I couldn’t figure out how to get git ignore to work.
As for javascript debugging, I primarily use a combination of firebug and “window.alert” messages. I just look at the firebug javascript console for errors, and don’t use the firebug debugger, although it would probably be a good thing to try sometime. window.alert in javascript works well as a “breakpoint” to see where your code has gotten to, just don’t accidently let that code get into production.
What I am looking for for javascript is a tool that will let me see what events fire when.
The other thing is that I’ve learned to make sure to separate my javascript from my php code in files as much as possible.
For MySQL, I use the mysql workbench to inspect the database.
This one shows the profile of the batch_reminders.php file for patient reminders.
Load up wincachegrind (or kcachegrind on linux) to view this file. It breaks down what lines of code take how much time.
Here’s the output where I’ve changed sql.inc so as to not log adodb->execute calls. https://github.com/yehster/profileOEMR/raw/master/batchNoLog.zip
Interestingly the batch with logging on takes 5.5 seconds, while with logging off takes 1.5 to process 8 patients and 1 reminder both times.
How you configurate the environment to work with netbeans, because i installed netbeans then go to project, new project, choose php, then with existing resources and when i run the project the navigator stays in a infinite bucle triyng to load the index. And what about the database? how add the database to netbeans?
Did you set the run configuration options on your project? Mine is set to run as remote server, and I point the url to my server’s address. I also typically don’t use the run button. It’s easy enough to just keep a separate browser running. When I need to debug, I use the debug project button.
I don’t do anything with the database using netbeans. I use MySQL workbench for my database operations.
Suggest that you check out http://forums.netbeans.org/ for netbeans support. They are certainly more knowledgeable than I.