has anyone been using Eclipse 3.3.1 + PDT in order to use debugging via Zend or XDebug?
So far I couldn't get the debugger configured.
You may have a look here up from the entry "by Süreç Özcan - Tuesday, 1 April 2008, 10:56 PM" in order to get a first idea of my trials and problems.
I open a new thread since the current discussion place is not including debugging.
I was really excited about it at first, now I'm just waiting for somebody else to make it "just work". Though, I'm interested to know if anybody manages to get this to work, not having a debugger does make my job a bit more painful.
PS.- Mathieu, what do you use for development now?
11.04.2008 by Mike Rogers:
Here are the steps I take to get PDT running with the debugger. I've done this a few times now, so hopefully I don't miss any steps.
1. Grab Eclipse PDT 1.0.2 All-in-One package from here:
2. Install XAMPP, which will install the LAMP (minus Linux of course) stack into windows. Get it from here:
3. Get Xdebug from:
4. Rename the xdebug dll to “php_xdebug.dll” and move it into C:\xampp\php\ext (assuming you installed xampp there). Overwrite if the file already exists.
5. Open the C:\xampp\apache\bin\php.ini file in a text editor.
a. Find the line “implicit_flush = Off” and change it to “implicit_flush = On”.
b. Find the line “max_execution_time = 180” (or a diff number), and change it to “max_execution_time = 0”.
i. This makes it so the scripts don’t time out during debugging.
c. Find the “[Zend]” section down near the bottom and make it look like this:
zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll"
d. Find the “[XDebug]” section below and make it look like this:
6. Restart apache.
7. Create a phpinfo page and check to see if xdebug is loading. It should say “with Xdebug v2.0.2, Copyright (c) 2002-2007, by Derick Rethans” near the top to the left of the Zend logo.
8. Load up Eclipse and choose a workspace (a new one because we want to start fresh with default settings).
9. Change apache’s httpd.conf and add a virtual path for this workspace (or change the default working directory).
10.Optional step. Update eclipse and all its plugins by going to “Help -> Software Updates -> Find and install” and then choose “Search for updates…” (the first option). Eclipse has a lot of bugs, so I try to stay updated.
11.Switch to the PHP perspective and create a new PHP project called “test”.
12.Create a new file in it called “test.php” and put the following:
$hello = “hello”;
13.Save it and set a breakpoint at the “echo $hello;” line.
14.Load up the eclipse preferences and go to “PHP -> PHP Executables”.
15.Add “C:\xampp\php\php.exe” with the debugger type set as XDebug.
16.Go to “PHP -> Debug”.
a. Make sure the Default Settings has “XDebug” as the “PHP Debugger”, “Default PHP Web Server” as the “Server”, and the PHP executable you added earlier as the “PHP Executable”.
b. Uncheck “Break at first line.”
17.Press ok to save and leave preferences.
18.Go up to the toolbar and click “Window -> Web Browser” and choose the web browser you want to load when debugging (in my case Firefox).
19.Go up to toolbar and click “Run -> Open Debug Dialog”.
a. Double click on “PHP Web Page”.
b. Click on “Browse” beside file and choose “test.php” in the test project.
c. Deselect “Auto Generate” and fix the path in the right field so it points to the proper location (in my case /test/test.php).
d. Click on Debug.
e. When the window pops up asking you to change perspectives “PHP Debug”, do it. The browser should load the page, and it should freeze and output the debug information in Eclipse.
Presto. Let me know if there is any confusion. I just went through these steps from start to finish and debugging worked. If it still doesn’t work, then there might be something system-specific that I can try to help you with.
Hi Mike, thank you very very much for you detailed instructions. :o) I have tried going through all the steps you have been listing except for reinstalling xampp. Trying out debugging your suggested test.php I receive a message from firefox: "Unable to connect: Firefox can't establish conntection to the server at localhost" So I guess I have still sth. in the php.ini that shouldn't be like it is and sadly enough I have never backuped that file from the beginning before starting editing it. So before I really have to setup xampp from scratch (since it is working properly at the moment) I would like to ask you to send me your php.ini-file and I would like to compare it with mine. If it still won't work I will have to contact you again about system-specific settings. one more question to 9. Change apache's httpd.conf and add a virtual path for this workspace (or change the default working directory): in the httpd.conf-file I commented out my so far used workspace and replaced it with my new trial workspace "workspace_debug" - is that what I should do there? DocumentRoot "D:/oezcan/workspace_debug" <Directory "D:/oezcan/workspace_debug"> And another question to Eclipse 3.3 in general - Do you know if using Mark Occurrences (when going e.g. onto a variable it shows all occurrences of it highlighted) works? Thanks a lot Mike, Süreç
Mike's answer: I've attached my php.ini and httpd.conf file for your convenience. I didn't use a virtual directory, but changed the default document directory. Mark occurrences functionality works in my installation... but I might have changed a few settings in Eclipse... I'm not sure.
Hi Mike, alright, I got XDebug working!!! :))))))))) Following your description step 16: 16.Go to "PHP -> Debug". a. Make sure the Default Settings has "XDebug" as the "PHP Debugger", "Default PHP Web Server" as the "Server", and the PHP executable you added earlier as the "PHP Executable". I had to add ":8080" in the "Configure..."-part next to the "PHP Server" Now the only problem is that I receive a "Fatal error" while debugging inside the Moodle workspace trying to debug e.g. edit_multichoice_form.php: Fatal error: Class 'question_edit_form' not found in D:\oezcan\workspace\moodleSue\moodle\question\type\multichoice\edit_multichoice_form.php on line /20 /Did you have a similar problem? If so, what did you do in order to be able to debug inside of the Moodle-folder-structure? I am using Moodle 1.8.2+. May it has to do something with missing require_once-calls e.g. "require_once ('../edit_question_form.php');"? I have tried it out but it doesn't really work still. Very kind greetings, Süreç
Mike's answer: Glad to hear that debugging is working (partially?). It shouldn't matter what directory structure the web application has (Moodle in this case), since it's loading from the web server. What I always do is set the main file to load as "<projectname>/index.php", at the root of the project folder. That way, Moodle loads from the start page and then I browse to the page with the break point. I've never had any issues like what you speak of.
1. You set a breakpoint into that file you want to debug (e.g.
2. In the eclipse menu you go to Run->Open Debug Dialog
3. click to the correct "PHP Web Page" (if created already) and in
the Advanced-tab I have selected "debug all pages". in order to do
what you mention shall I rather click "start debug from" and type
in "http://localhost:8080/moodle/index.php" instead and check
"continue debug from this page" as well? Or is this not what you
mean? Where do you set the main file to load as
"<projectname>/index.php" (e.g. "moodleSue/index.php" in my case).
4. now clicking the "debug"-button should load the indes.php-page in
5. from there on I will have to click through the pages until I get
to the page I set my breakpoint at
6. then I should be able to go back to eclipse and do a "step over"
in order to step through each code line, right? but from where
does it know that I have arrived that far in the code - only
because I browsed manually until the right spot?
7. When I am done I "terminate" the debug modus through the red
button in eclilpse.
I am looking forward for your next help!
i am new in the Moodle world and my English is not very good!!!. I hope that you understand me; thank you very much for the information, the Debugging configuration it is very complicated but you have explained very well and finally, i managed to...
Now comes the problem.......
I can not see de data of the MySql and i can not see the content of the courses and other options...it is necessary change the eclipse configuration???
I can not find any solution at this time. You could help me?
Thank you very much.
As far as I understand you would like to see the database entries.
Through your made installation of Moodle you should have a folder named 'moodledata' at the same folder-level as you will find your 'moodle'-folder. In order to see it in Eclipse you should open a project in Eclipse not from the 'moodle'-folder but from one folder above. This way it will include the 'moodledata'-folder as well and should be displayed. If you don't want to do that I think you should be able to just create a new project of your 'moodledata'-folder.
If you want to see all database entries you should use phpMyAdmin. There you will be able to see the content of the courses. As far as I know Eclipse is just for coding so that it is useful to work in the 'moodle'-folder. For database-entries you should configure phpMyAdmin (which has nothing to do with Eclipse). You may search in the moodle-docs for it. It was described somewhere.
I hope this is what you wanted to know!?
Did you get the debugger working?
The problem is solved!!! Already i can access the XAMPP console and i do debugger Moodle; We must change in DocumentRoot "C: / program files / xampp / htdocs" <Directory "C:/program files/xampp/htdocs"> and eclipse import project php.