PHP: Xdebug access denied exit with code 0 - php

I have set the PHP project on Mac with XAMPP and installed Xdebug there, but on my PhpStorm I get:
I did not manage to find anything on the web.
My php.ini
[xdebug]
;zend_extension=xdebug.so
zend_extension=/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9002
xdebug.remote_log="/mnt/log/xdebug.log"
xdebug.remote_autostart=1
xdebug.idekey=phpstorm
xdebug.remote_mode = req

I might be coming late to the party, but make sure XDebug has Write access to the folder, let alone if you're using Docker.
If it's local, then just out of investigation try:
chmod 777 /mnt/log/xdebug.log
However, I'd rather choose to state a folder for the logging over a file.
If it's running within Docker, then "chmod" the actual mounted folder instead.

Related

Net beans debugger on mac not working

my net beans debugger on my mac is not working and I am not sure why.
This is the php.ini file on my MAMP. Its located in my php5.6.2. folder.
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.6.2/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=8080
xdebug.remote_autostart=1
My local host is running on port 8080 so here are the changes I made in the netbeans preference.
I am not sure if the next picture should have that path name or should I change it to the path name of the file that my project folder is located in ??
So other than this when I run the debugger it shows
http://localhost/pocketAllowence/index.php?XDEBUG_SESSION_START=netbeans-xdebug
It doesnt show localhost:8080 and then the rest. So not sure what to do to fix it.

Debug PHP With Xdebug in Netbeans and via FTP

I have a PHP application that runs on a Debian server where I've installed apache 2.2.4 and xdebug.
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.0.2
xdebug.remote_port=9000
All the PHP files are saved on this server. The Server IP is : 192.168.0.2
The problem is that I'm opening the PHP project via FTP with Netbeans on a Windows 7 environment where apache is NOT installed!
Is it possible to debug in this scenario and does someone have any links for direction how to configure this scenario?
Please any help would be appreciated.
Thanks in Advance
Now i found a solution.
These links helped me:
http://wiki.netbeans.org/HowToConfigureXDebug
http://www.google.de/?gws_rd=ssl#q=php+netbeans+xdebug+configuration
The xdebug.ini i modified like this:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.idekey=netbeans-xdebug
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.0.103
xdebug.remote_port=9001
The IP adress 103 is the adress of my local machine and i had to add the idekey to the ini.

Debugging console script over vagrant ssh

I need to debug a console script run from within my development VM (because of different machine state).
I'm using Netbeans, and I can debug scripts called from the browser just fine.
How do you achieve this, is this possible?
I tried Debugging php-cli scripts with xdebug and netbeans?, but I think this applies only to running the script locally.
My current xdebug configuration:
[XDEBUG]
xdebug.max_nesting_level=200
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.collect_params=4
So, following this https://www.adayinthelifeof.nl/2012/12/20/debugging-remote-cli-with-phpstorm/, I found out that you need to specify the remote host.
Xdebug must know where to send the data to.
I ended up editing my xdebug configuration to look like this:
[XDEBUG]
xdebug.max_nesting_level=200
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.collect_params=4
xdebug.remote_host=HOST_IP #changed this, removed remote_autostart
So now you just have to turn debugging on in Netbeans and run export XDEBUG_CONFIG="idekey=netbeans-xdebug" in your VM's console.
Next run the script you want to debug.

Xdebug installed on Mac Native apache

I am trying to get XDEBUG up and going but having trouble getting the cookie to show. Below is what is put in my php.ini file. I restarted apache. I did a phpinfo() call and I do see xdebug enabled and the settings set. But when I do a localhost/?XDEBUG_SESSION_START=1 I am expecting to see a Cookie set to 1 in my browser right ?
zend_extension ="/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.profiler_output_dir="/tmp"
when I run php -m I do not see it but I do see it in phpinfo
couldnt figure the exact answer but I went and downloaded the php.ini.default file from repo and set the following in the php ini
zend_extension ="/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.idekey=foo
xdebug.profiler_enable=On
and it worked. could of been because of remote host. who knows. it worked. this is the bare minimum configurations for mac and this is if your going by the follwing installations for xdebug on mac
http://kubyshkin.ru/posts/installing-php-xdebug-extension-on-mac-os-x-10-7-lion.html

Xdebug configuration with PHP fastcgi and eclipse?

I have been using eclipse-pdt in conjunction with xdebug and apache without problems, for over one year. Things worked flawlessly and I could do all the interactive debugging I wanted from within eclipse (using my own machine as a server).
Now I switched from apache to nginx (and therefore PHP runs now not as an Apache service but as fast-cgi) and I can't find a way to configure eclipse to work nicely with xdebug. I am neither sure if the problem is with xdebug or with eclipse (or both) to be sure.
In the eclipse configuration I already changed the reference to the PHP configuration file to /etc/php5/cli/php.ini.
Attempts with php.ini version 1
With the following php.ini file
zend_extension=/usr/lib/php5/20060613/xdebug.so
I see that xdebug is working (for example if I do a var_dump() I get the xdebug version of it, not the plain PHP one)
I can't have the interactive debugging from eclipse: the browser opens up and loads the page completely with the typical URL containing ...?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=..., but the program execution does not stop at breakpoints
In the bottom-right corner of eclipse I see a suspicious message: "Launching =put_the_name_of_my_project_here=: 57%" that alternates with the "refreshing workspace" one.
Attempts with php.ini version 2
If I use this other version of the file (which is what it worked until I switched to nginx):
zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req
I can't access any page of my sites at all.
PS: Additional data on my machine:
- OS: GNU/Linux - Ubuntu 9.10 64 bit.
- PHP: 5.2.10-2ubuntu6.3 with Suhosin-Patch 0.9.7; Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with Xdebug v2.0.4
- Eclipse: see screenshot.
xdebug and FastCGI use the same default port (9000). Change the port of XDebug in your php.ini file like this:
xdebug.remote_port=9001
and update your IDE settings to use 9001.
What Beau said is correct (couldn't vote since I'm new!).
Generally, addging to /etc/php5/cgi/php.ini (or locate php.ini) the lines like
zend_extension = /PATH_TO/xdebug.so ## <-- NOTE the absolute path, not relational (For ex on Windows: "C:\nginx-1.9.13\php\ext\php_xdebug-2.6.0RC2-7.0-vc14-nts.dll")
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9900 ## <-- Yours will be probly 9000 or other..
does the job.
So after the change,
./php-fastcgi stop
./php-fastcgi start
This worked for me.
Try restarting your php. Because you have php-fastcgi, restarting nginx doesn't seem to do it. When I rebooted my whole server the change took effect.
I had the same problem and solved it.
In file /etc/php5/apache2/php.ini add:
[xdebug] xdebug.remote_enable=On
xdebug.remote_autostart=off
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req
In file /etc/php5/cli/php.ini add:
zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=On
xdebug.remote_autostart=off
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req
Restart Apache:
sudo service apache2 restart
Problem in solution is "xdebug.remote_autostart = on".
If you set in file config "xdebug.remote_autostart = on". This will force Xdebug to start a debug session for every request that is done on this server, without having to specify in the request that a debug session is wanted.
You need change
"xdebug.remote_autostart = off"
And restart web service.
In this example is Apache.
You can read more here: http://doc.waterproof.fr/phpedit/debugging_profiling/configuration/debugger_with_xdebug
GoodLuck!

Categories