I'm using Netbeans 7.3 and xDebugon WAMP. Here is my configuration of xDebugin php.ini:
zend_extension = "c:/wamp/bin/php/php5.4.3/ext/php_xdebug-2.2.3-5.4-vc9.dll"
[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
If I put a break point on my ajax script, it stops on the break point. If I go line by line with F8 to the end of the script, I get "500 Internal Server Error" as a result. Without the break point, everything is OK. I even get this error on my controller action in Yii. If I go with break point line by line, I get 500 error in the browser. Without the break point, it's working fine. I tried with other versions of xDebug, it's the same.
Any ideas?
500 (Internal Server Error) in phpstorm 9.0 when enabling xdebug breakpoints.
Validate your whatches for php session. Errors in whatches can generate errors in executing php code. Errors disapears when you disable xdebug listening or correct/remove whatches.
Related
Please guide me
No one here knows how to solve the problem!?
I use PHPstorm 2017.2.4 for php programming.
I configured phpstorm to debug by xdebug for use stepover and stepintro in debugging by jetbrain guid documents but just debugging is enable yet and other options is disable. screen shot of this:
How can I and What should I check to resolve this problem?
I googled and search in stackoverflow but I couldn't find my answer.
Update:
I couldn't solve that yet.
I explain all steps I have done :
first o all say that I use wamp 2.4 for local host server.(php 5.4.12, apache 2.4.4 , MySQL 5.6.12)
1- install phpstorm for use debugger such as step over an step into debugging.
2- use jetbrain guide documents to install debugger:
first check to find xdebug in wamp directory.
then edit last lines of php.ini file in wamp as following:
[xdebug]
zend_extension = "c:/wamp/bin/php/php5.4.12/zend_ext/php_xdebug-2.2.3-5.4-vc9-x86_64.dll"
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
3-Set php interpreter as follow image:
4-Then validate debugger here that don't disply any warning:
5-Enable listening for PHP debugger connection
6- Install chrome toolbar JetBrains IDE Support for web debugging.
7- I wentback to PHPstorm to debugging but just debug option was enabled and others was disabled as first image in this post.
In addition, after debugging the codes, the warning : "PHP Warning: include_once(): Failed opening '.\dref.php' for inclusiondisplay this warning. (include_path='.;C:\php\pear') in C:\wamp\www\srn\mrt\req_v.php on line 260" is displayed, while the same code works well in the WAMP(localhost:80) by Firefox browser.
in all php documents that has code similar to below :
include_once ('.\jd.php');
require_once(".\dref.php");
require_once(".\scur.php");
Then when I changed path for example ".\dref.php" in require_once to "..\dref.php" debugging dont display above warning ,But this timewhen open web by Firefox(localhost:80-wamp) display Warning: require_once(..\dref.php): failed to open stream: No such file or directory in C:\wamp\www\srn\mrt\req_v.php on line 26
Where do I make mistakes and how should I solve these problems?
Please guide me
No one here knows how to solve the problem!?
=========================================================
Ignore this post. A much simpler statement of this issue can be found at PHP auto_prepend_file causes xdebug profiler to fail
=========================================================
Original Post (and updates)
When I try to open an xdebug profiler snapshot within PhpStorm using:
menu bar >> Tools >> Analyze xdebug profiler snapshot...
I select the file xDebug created but I'm faced with this error:
Error: Incorrect profiler snapshot format: Incorrect name format
I did not rename the snapshot. It is the default name: cachegrind.out.8008
php.ini
<!-- language:lang-none -->
[xdebug]
zend_extension="php_xdebug-2.5.5-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\websites\xdebug"
; xdebug.profiler_output_name= ; Commented out to allow default name
xdebug.idekey=PHPSTORM
Why won't PhpStorm open the snapshot? Should I set a custom xdebug.profiler_output_name option?
Update
I closed all my projects, upgraded from PhpStorm 2017.1.4 to 2017.2, restarted Apache, deleted the old snapshots and created a new one. The new one opens without trouble.
Update 2
Seems that if I run a file from the command line by calling >php script.php, the generated snapshot can be opened. If I run the same file from the browser (meaning I go through the Apache webserver: localhost/script.php) the snapshot cannot be opened.
Update 3
I also notice that when I execute from the browser, I can't delete the snapshot until I force-stop the Apache process. The PHP file I'm profiling has no instructions: just <?php. Below are the two snapshots created:
When executed from the command line (PhpStorm opens this file without problem):
version: 1
creator: xdebug 2.5.5 (PHP 5.6.1-dev)
cmd: C:\path\to\script.php
part: 1
positions: line
events: Time
fl=(1) C:\path\to\script.php
fn=(1) {main}
summary: 0
1 0
When executed from the browser (PhpStorm cannot open this snapshot):
version: 1
creator: xdebug 2.5.5 (PHP 5.6.1-dev)
cmd: C:\path\to\script.php
part: 1
positions: line
events: Time
fl=(2) C:\path\to\script.php
fn=(1)
summary: 0
1 0
Update 4
The culprit is the auto_prepend_file ini setting. I had the following set in Apache Vhosts:
php_value auto_prepend_file "C:\path\to\init.php"
This file is run before Apache executes the script that was called from the browser. When I run the script from the command line, this setting (which is in my Apache Vhosts config) never takes effect so init.php doesn't run. Conversely, if I move the setting to php.ini where it also affects command-line execution, then snapshots generated from the command-line also stop working.
If I remove the auto_prepend_file setting, the generated profiler snapshot can be open without problem in PhpStorm. Of course this isn't a fix since I need the auto_prepend_file to execute for my application to work properly.
I have been hacking away at this for hours, and at one point it was actually working on a test page, but I don't know what happened since then because its stopped working. I've been getting this error a lot:
Error: b'Failed loading c:\wamp\bin\php\php5.6.19\ext\php_xdebug-2.4.1-5.6-vc11.dll\n'
Its strange because it definitely is loading the file, when I add this to my php.ini file:
zend_extension = "c:\\wamp\\bin\\php\\php5.6.19\\zend_ext\\php_xdebug-2.4.1-5.6-vc11.dll"
it tells that it is indeed enabled. In the php.ini file I spotted this: In a tutorial I read, the xdebug.ini file appeared in one of those fields: Heres the full settings in my php.ini file:
then check phpinfo() and I now see a section for xdebug:
Also when I run
if (xdebug_is_enabled()) { echo 'its enabled'; }
[xdebug]zend_extension = "c:\\wamp\\bin\\php\\php5.6.19\\zend_ext\\php_xdebug-2.4.1-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_log= "C:\\wamp\\tmp\\xdebug.log"
xdebug.profiler_enable=0
xdebug.profiler_output_dir = "C:\\wamp\\tmp"
xdebug.collect_params = 4
xdebug.collect_return = on
xdebug.collect_vars = on
xdebug.show_local_vars = 3
I'll be honest, I have no idea what half of those parameters do. Heres the settings for my sublime project:
"settings":
{
"xdebug":
{
"url": "localhost/xdebug_test"
},
"sublime-view-in-browser": {
"baseUrl": "http://localhost/xdebug_test",
"basePath": "C:\\wamp\\www\\xdebug_test"
}
}
and inside XDebug.sublime.settings I added the URL in there:
"url": "http://localhost/xdebug_test"
Heres the index file in the xdebug_test folder:
but when I start the debugger and launch the browser, it instantly echoes test, and nothing appears in the xdebug console:
It worked on that exact file yesterday, I don't know what could have changed since then.
Is there a way to diagnose whats wrong with it? I don't think so because this isn't just happening in sublime text, heres what happens when I ran a PHP script in the terminal:
EDIT: I just spotted in phpinfo() that the IDE Key is set to PHPSTORM. Thats strange because in the xdebug settings file, its set as this:
"ide_key": "sublime.xdebug",
Could that be the issue? Is there anything I can do here to further diagnose the problem?
Did you try changing the xdebug url in project settings?
"xdebug":
{
"url": "http://localhost/xdebug_test"
}
What if you use this version of dll - https://xdebug.org/files/php_xdebug-2.4.1-5.6-vc11-nts.dll ? Postfix "nts" means "Non-thread-safe".
And of course you can use XDebug wizard to find out which dll version and which settings do you need - https://xdebug.org/wizard.php
I pasted my info into the wizard and heres what I got
I'll give the non threaded version a try.
I figured out the problem, xdebug was connecting to the wrong port. I found the log file in C:/wamp/tmp/xdebug.log and checked out the latest messages, and there were loads of lines saying the same thing:
Log opened at 2016-10-21 16:09:25
I: Connecting to configured address/port: localhost:9001.
E: Time-out connecting to client. :-(
Log closed at 2016-10-21 16:09:26
I suspected the issue was with the port, I checked the php.ini file and it was set to 9001, then I checked Xdebug.sublime-settings and noticed the port was set to 9000. I set the port in php.ini to 9000 and now xdebug is working.
I still don't know why its giving me those errors about not being able to load the extension. Strange because it definitely is loading them.
I'm trying to debug my PHP script using xdebug and xdebug_break() method. It start to working and my IDE (PHPDesigner) stop at the break normally, but instantly it stop. Reading the debug.remote_logs file I can check that the last line is:
<- context_get -i 429 -c 0
After that I don't receive a return with a XML data about GET data. So I guess that there live the problem, but how can I fix that?
My php.ini xdebug config is:
[xdebug]
xdebug.remote_mode=jit
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_log=C:\Wamp\logs\xdebug.log
xdebug.idekey=xdebug
I tried to use the XDBG too, and it throw an exception and stop to working. The remote_logs file show the same fail. Using php_xdebug-2.2.0-5.4-vc9.dll.
Before I do post it, I checked out the xDebug last version and it is php_xdebug-2.2.2-5.4-vc9.dll (diff: old 2.2.0, new 2.2.2). Updating that solve my problem and now all works fine. Yey!
I just installed wamp and the latest version comes with webgrind, but i cannot figure out how it works.It says
Select a cachegrind file above
And thats all.
Webgrind is a parser/viewer for a profiling file format called cachegrind. The PHP extension Xdebug can (among other very useful things) generate these. For webgrind to work, Xdebug needs to be installed and enabled.
Make sure Xdebug is installed and working (see the Xdebug docs for info on how to do that)
Have Xdebug generate a profiling report by requesting a local PHP file
Load webgrind in the browser and select a file in the popup-menu at the top
Press update, and hopefully everything should work
The wiki on Google Code has more on configuring webgrind.
1) Download XDebug from their download page.
2) Put all DLL files in your PHP extension directory: C:\wamp\bin\php\php5.x.x\ext
3) Add the following line in your php.ini file located in C:\wamp\bin\php\php5.x.x:
zend_extension = c:\wamp\bin\php\php5.3.0\ext\php_xdebug-2.1.0-5.3-vc6.dll
4) Add also the following section to your php.ini (search for the [xdebug] section first to make sure it does not exist yet):
[xdebug]
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "c:\wamp\www\webgrind\tmp"
xdebug.profiler_output_name = cachegrind.out.%t.%p
5) Restart Wamp and verify that the extension was loaded. To do so, add a file pi.php in C:\wamp\www\ and put the following code in it:
<?php
phpinfo();
?>
6) Check the output by opening your browser at http://localhost/pi.php and search for XDebug.
7) Download Webgrind from their download page and extract in in your www folder.
8) Edit the config.phpfile located in C:\wamp\www\webgrind\ to change the storage directories:
static $storageDir = 'c:\wamp\www\webgrind\tmp';
static $profilerDir = 'c:\wamp\www\webgrind\tmp';
9) In the Webgrind directory where you have extracted the code, add an .htaccess file and put this content in it to avoid webgrind from profiling itself:
php_flag xdebug.profiler_enable 0
10) Rerun the http://localhost/pi.php script to generate some profiling data.
11) Open your browser with http://localhost/webgrind to display the results. Do not forget to click the Update button!
This answer is based on an answer provided by Jacob Moen. You can view the original source here.
It is good to watch if the application becomes SLOW, had problems with
it because of the settings of Cachegrind.
Good luck!
My settings are Wamp 2.4, Apache 2.4, PHP 5.4 and MySQL 5.6
[Portugues pt_BR]
É bom prestar atenção se a aplicação se tornar LENTA, tive problemas com isso por causa das configurações do cachegrind.
Boa sorte!
Minhas configurações são Wamp 2.4, Apache 2.4, PHP 5.4 e MySQL 5.6
Update the PHP.INI with these parameters
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
RESTART ALL SERVICES
this should be work.
You don't have to do much....
I just edited the line to be
xdebug.profiler_enable = 1
Thats all buddy. Totally works!