1

I am trying to get my php debugger for NetBeans to work in Ubuntu. When I try to start a debug session, it tries forever to establish a connection, but eventually it gives me an error message saying no connection to netbeans-xdebug was available. I have installed php5-xdebug, but when I try to see it using phpinfo() it doesn't show. My php/apache2/php.ini has these lines of code:

zend_extension=/usr/lib/php5/20090626/xdebug.so
[debug]
; Remote settings
xdebug.remote_autostart=off
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

; General
xdebug.auto_trace=off
xdebug.collect_includes=on
xdebug.collect_params=off
xdebug.collect_return=off
xdebug.default_enable=on
xdebug.extended_info=1
xdebug.manual_url=http://www.php.net
xdebug.show_local_vars=0
xdebug.show_mem_delta=0
xdebug.max_nesting_level=100
;xdebug.idekey=

; Trace options
xdebug.trace_format=0
xdebug.trace_output_dir=/tmp
xdebug.trace_options=0
xdebug.trace_output_name=crc32

; Profiling
xdebug.profiler_append=0
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name=crc32

As you can see, I have tried to solve it myself, but I just can't get it to work. Any help would be greatly appreciated...

2
  • Are you sure the so file is there on that path? Commented Jul 5, 2012 at 9:33
  • Yes, checked that as well, it's there... Commented Jul 5, 2012 at 9:38

2 Answers 2

6

Find out first from where your php.ini is call using the flowing command line in ubuntu:

php -i |grep "php.ini"

You can test if xdebug it is working with the folowing code in a php file:

<?php
function test(){
    echo "Called @ ".xdebug_call_file().
    ":".xdebug_call_line()." from".
    xdebug_call_function();
}
test();

?>

and run the script like that: php -e myphpfile.php

you will get something like: Called @ /var/www/testxdebug.php:8 from{main}root@magento b

good luck

Sign up to request clarification or add additional context in comments.

2 Comments

BTW, phpinfo display /etc/php/7.0/apache2/php.ini however your command (php -i |grep "php.ini") display /etc/php/72/cli/php.ini now what?
FYI: This is because you calling the current used php.ini from commandline. Than of course it shows "cli" folder. phpinfo() is tipically called from apache and shows you the result what than shows you the php.ini file apache works with.
0

i guess that you've edited the wrong php.ini

i don't if it is the case in your machine, at least in mine, there's four directories in the /etc/php5/ folder: /apache2, /apache2fiter, /cli ; sometimes you need to edit the php.ini file under the /apache2filter folder to activate Xdebug~ hope it works

1 Comment

How does php (debian 9) decides to switch php.ini? it was displaying it at first, later I installed php-mbstring that must have caused it to switch to 7.2 from 7.0 folder. There are also 7.3 and 7.4 this is totally stupid mess, I was editing apache2/php.ini ??? now I see a bunch of cli/php.ini files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.