I have set up the Xdebug correctly and I can see it is running but does not debugging.
Also I have set up php.ini
[xdebug]
xdebug.remote_enable=1
xdebug_remote_autostart=1
;zend_extension=xdebug
zend_extension = "C:\laragon\bin\php\php-7.4.19-Win32-vc15-x64\ext\php_xdebug-3.0.4-7.4-vc15-x86_64.dll"
xdebug.remote_host = "http://127.0.0.1:8000/"
enter code here
Related
I have eclipse Neon in Linux Ubuntu 16.04
When I run a odoo server, it works everything fine in port 8069
But, when I debug the same odoo server, (now, the port is 8072) it appears to freeze in a infinite loop. In the browser doesn't appear anything (Waiting for localhost...), and the log shows this:
...
25138 INFO mydb openerp.modules.loading: 81 modules loaded in 0.73s, 0 queries
25138 INFO mydb openerp.modules.loading: Modules loaded.
25138 INFO mydb openerp.addons.base.ir.ir_http: Generating routing map
192.168.1.31 - - [2016-09-12 12:14:51] "GET / HTTP/1.1" 200 24082 21.358104
25138 INFO mydb openerp.addons.bus.models.bus: Bus.loop listen imbus on db postgres
This is my odoo9-server.conf (renamed openerp-server.conf):
[options]
admin_passwd = myAdminPass
db_host = False
db_port = False
db_user = myUserName
db_password = myDatabasePass
addons_path = /etc/odoo/server/addons,/etc/odoo/server/addons_extra
logfile = None
xmlrpc_port = 8069
log_level = debug
Is there something wrong?
To debug your odoo+python code in eclipse, start eclipse in debug perspective and follow the given steps:
1: Stop your Odoo running server by pressing "ctr+c".
2: In eclipse go to Menu "Run/Debug Configurations". In configuration window under "Python Run", create new debug configuration(Double click on 'Python Run').
3: After creating new debug configuration follow the given steps:
3.1: In "Main" tab under "Project", select the "server" project or folder (in which Odoo Server resides) from your workspace.
3.2: Write location of 'openerp-server' or 'odoo.py' under "Main Module".
Ex: ${workspace_loc:odoo/openerp-server}.
3.3: In "Arguments" tab under "Program Arguments", click on button "Variables" and new window will appear.
3.4: Then create new "Variable" by clicking on "Edit Variables" button and new window will appear.
3.5: Press on "New" button and give your addons path as value.
Ex: --addons ../addons,../your_module_path
3.6: Press Ok in all the opened windows and then "Apply".
4: Now into "PyDev Package Explorer" view go to odoo and right click on "openerp-server" or odoo.py file, Select 'Debug As --> Python Run'.
5: Now in "Console" you can see your server has been started.
6: Now open your .py file which you want to debug and set a break-point.
7: Now start your module's form from 'gtk' or 'web-client' and execution will stop when execution will reach to break-point.
8: Now enjoy by debugging your code by pressing "F5, F6, F7" and you can see value of your variables.
Source: https://stackoverflow.com/a/12298831/1312904
To invoke pdb, add this line
import pdb; pdb.set_trace() anywhere you want to set a breakpoint
and then start your odoo with the --debug flag set, something along the lines of
./odoo.py --addons=addons,myaddons --debug
and then when you execute an action on the server that hits the point where you invoked pdb, the execution will immediately stop and you'll have a pdb prompt that you can use to debug
Finally I got the solution.
In the Debug Configurations, I changed the content of Main Module and I wrote this:
${workspace_loc:my_project/openerp-gevent}
The important part is the openerp-gevent
Now, the debug works fine
I code in Yii framewor, using Netbeans 8.0.1 and also Eclipse. My local developement environment is build on XAMPP. I can see, that breakpoints set anywhere within Wordpress code works just fine. But, when I try to set a breakpoint on any Yii's controller or action, XDebug won't stop at that point. It only work on index.php of my project.
However, xdebug_break() work for controllers, but not actions.
My php.ini settings for XDebug are:
[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.2.5-5.5-vc11.dll
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = 127.0.0.1
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_log = "c:/xampp/tmp/xdebug_remot.log"
xdebug.show_local_vars = 9
xdebug.max_nesting_level = 250
xdebug.auto_trace=1
xdebug.remote_server = 127.0.0.1
I'm trying to deal with this problem for about a week and still didn't come with any solution.
I have a netbeans project with a directory tree like this:
<source folder>
|
|---> gui <web root folder>
| |
| L---> datos.php
|
L---> index.php
datos.php changes the working directory to .. (source folder) and includes index.php like this:
chdir('..');
require 'index.php';
If I put a breakpoint inside datos.php, the debugger breaks on it correctly, but when putting one in index.php it ignores it.
The strange thing is 6 months ago I had the same problem and I was able to fix it. Now I don't know why it stopped working and what I did back then to fix it.
More info:
xdebug log shows the following command for breakpoint setting:
breakpoint_set -i 315 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51
breakpoint_set -i 316 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/gui/datos.php -n 39
In both cases xdebug responds with state="enabled"
And if I debug manually, I can use the following command to set the breakpoint, which works:
breakpoint_set -i 315 -t line -s enabled -f file:///../index.php -n 51
But I don't know how could I make netbeans issue the breakpoint_set command with the same file:///../index.php argument and not file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php or any other way I can make this work.
Thanks in advance for any help!
You always can try using xdebug_break();
For example :
<?php
for ( $i=1, $j=0; $i<10; $i++) {
xdebug_break();
echo "<br>Line $i"; // will stop here
}
?>
will add a breakpoint in the following line.
Hope that helps a little...
Breakpoints are working again. I don't have any clues to why they didn't worked before but now they do. I can't remember doing any changes in xdebug or Netbeans either.
xdebug.log shows me the same as before, but now it stops at the setted breakpoint:
<- breakpoint_set -i 4 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4" state="enabled" id="14290001"></response>
<- run -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php" lineno="51"></xdebug:message></response>
However, if anyone knows why this could had happend, sharing it could be helpful either way: probably me or someone else will be able to avoid having similar troubles in the future.
This issue is more specific to people who are using remote servers for their web apps.
I had the same problem. Xdebug ignores breakpoints really helped me however i have given solution more specific to netbeans, but the essence is the same, which ever IDE you are using. Just map your local project path with your remote server path.
My environment is WINDOWS 7 and website is hosted on UBUNTU VM. I am using NETBEANS from Windows 7 and has setup a remote project.
My xdebug logs
<- breakpoint_set -i 4 -t line -s enabled -f file:///C:/Users/ali/Documents/NetBeansProjects/test.com.au/cgen/src/Acme/TestBundle/Controller/CreateController.php -n 39
->
The real problem was the project path in netbeans [C:/Users/ali/Documents/NetBeansProjects/test.com.au] and the project path on the webserver. /home/ali/sites/test.com.au
Fix: In Netbeans click on your project > properties > Run Configuration > Advanced > Just put the appropriate server path and equivalent project path. It will work fine.
Same problem was solved by commenting xdebug.extended_info = 0. Also one may switch it to 1.
To get it to work again i changedxdebug.remote_host=127.0.0.1 to xdebug.remote_host=localhost in php.ini
below is my config for xdebuga
xdebug.remote_enable=1
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_autostart = 1
xdebug.show_local_vars = 1
xdebug.profiler_enable = 1
output_buffering=off
xdebug.idekey=netbeans-xdebug
I'm currently trying to get Netbeans as an IDE to work with PHP Files. Part of the work is to get Xdebug to run properly. I have gotten Xdebug to work on a Windows machine but this is my first try on Linux.
I have gotten the correct module I followed the instructions on http://xdebug.org/wizard.php
I have a Correct phpinfo() output also, with the Xdebugsection pressent and everything. I can't post the output of my phpinfo() but everything seems ok there. The configuration in my php.ini file is as follows:
[XDebug]
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9101
[ZendModules]
Xdebug
I only want to be able to connect to the port 9101 (The port Xdebug listens on). I have gotten the following small script from a website to do so.
<?php
$address = '127.0.0.1';
$port = 9101;
print $port . " " .$address . "\n";
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
print "sock = " . $sock . "\n";
socket_bind($sock, $address, $port) or die('Unable to bind');
print "socket bind worked \n";
socket_listen($sock);
print "listening on sock\n";
$client = socket_accept($sock);
echo "connection established: $client";
socket_close($client);
socket_close($sock);
?>
When I run this script, I get the following output:
michael#michael-Inspiron-N5030:~$ php5 testXdebug.php
9101 127.0.0.1
sock = Resource id #4
socket bind worked
listening on sock
This means the Script will not finish running, it just stops there an nothing else happens.
does somebody have an idea what might be causing this?
I try to config xdebug but doesn't work I use:
XAMPP 1.7.4 , Netbeans 7.0
Xdebug installed: 2.1.0rc1
Server API: Apache 2.0 Handler
Windows: yes - Compiler: MS VC6 - Architecture: x86
Zend Server: no
PHP Version: 5.3.5
Zend API nr: 220090626
PHP API nr: 20090626
Debug Build: no
Thread Safe Build: yes
Configuration File Path: C:\WINDOWS
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
And php.ini:
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.collect_return = 1
xdebug.default_enable = 1
xdebug.extended_info = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = "DBGp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
Now the problems:
Menu attach Debugger is still disabled or grayed out.
When I try to debug the break point is never hit. Scripts run like a normal.
Following is the URL of I get when I click Debug main project:
http://localhost/index.php?XDEBUG_SESSION_START=netbeans-xdebug
When I close the browser debugger does not stop. It shows the waiting for connection status.
When I click the stop debugging button in NetBeans gives a messagebox There is no connection from xdebug detected with in some seconds xdebug is not configured or xdebug is not installed.
Please guide me to resolve the above mentioned issues and debug the project.
First are you able to see xdebug in http://localhost/xampp/index.php ? If NOT then probably you are NOT editing the right php.ini file? Seems like XAMPP is using the php.ini file in:
c:\xampp\apache\bin\php.ini
Enter your configuration for xdebug in that file, restart Apache and you should be able to connect.
There was no need for me to change anything in Netbeans to get it to work.
Screenshots here: http://rudyegenias.wordpress.com/2011/07/03/xampp-xdebug-xdebug-not-showing-in-phpinfo/
? to use XDebug on Netbeans & XAMPP
use http://xdebug.org/wizard.php to inspect your system and download best xdebug.dll
place that .dll in C:/xampp/php/ext
edit C:/xampp/php/php.ini adding following
[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.2.3-5.5-vc11.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.show_local_vars=on
xdebug.output_buffering=off
restart Apache web server
I've struggled with a lot of other setting but this is best to do the job