Chrome preview does not render the response properly, since yesterday when I upgraded the work machine from Win 8 to Win 10. Please see the screenshots:
As you can see, only one line of the object is rendered, when I tried it with a simple array, same thing happened, it only rendered the word "array" and "0";
I'm using Chrome 72.0.3626.96, WampServer64 with PHP 7.2.14 and those are my Xdebug settings in php.ini:
zend_extension="c:/wamp64/bin/php/php7.2.14/zend_ext/php_xdebug-2.6.1-7.2-vc15-x86_64.dll"
xdebug.default_enable=1
html_errors = On
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9123
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.var_display_max_depth = 10
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024
It worked literally a day ago before I got Windows 10. Chrome bug or am I doing something wrong?
I found the issue and it is quite bizarre. It looks like the latest version of Chrome (72.0.3626.119 for me) has problems rendering the preview when the response text has a hash character (#) in the output. It will happily render everything until it encounters the hash character. This is most definitely a bug in Chrome.
I discovered this by first noticing that the preview stops at <font color='#888a85'>=></font>. I hardcoded this in the document and removed characters until I concluded that the hash character was causing the problem.
Here is a demo of the bug. When you run this snippet in the latest version of Chrome and with Inspector open, you should see the request pop up in the network tab. When you click on the request and go to the preview tab, the third paragraph is cut off since there is a # right before it.
<p>Para1</p>
<p>Para2</p>
#
<p>Para3</p>
I was unable to find an open bug report regarding this so I took the liberty of reporting it here: https://bugs.chromium.org/p/chromium/issues/detail?id=936284
It looks like this issue has already been reported (link) and fixed in the dev version of Chrome but hasn't been updated in the stable version yet.
In the meantime, if you really need to have var_dump work in Chrome, you can do this as a workaround (buffer the output and replace instances of #):
ob_start();
var_dump($var);
echo str_replace('#','',$ob_get_clean());
... or you can just turn off HTML errors:
ini_set('html_errors', false);
Related
I have a new IIS 10 / Server 2019 server, which uses a SMB file share for app data. My problem is, for PHP sites there is a delay of about 2 minutes and 15 seconds for a simple "hello world" website to start. Even stranger, it does it on all sites with PHP 7.x, but not on 5.x unless it's a more complicated site like Mediawiki. It also only does it when loaded over the fileshare, which is otherwise quick to access. Once loaded the first time it runs quickly for about 3 min until whatever loaded process has to reload from scratch again. Using the error log, I can see that PHP loads the ini instantly and will complain about formatting errors and such right away, but the first line of a php page does not load until the last second. PHP xdebug also doesn't seem to note anything until the last second of loading.
It certainly seems like something is trying to resolve and timing out, but using //192.168.1.x doesn't work any better than //fileshare. I've poured through the php.ini looking for a culprit but can't find it. Any help is greatly appreciated!
The main settings I've messed with are the ones below with different combinations and ways of writing the path.
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
fastcgi.logging = 0
track_errors = Off
soap.wsdl_cache_dir = C:\inetpub\php_temp
error_log = "C:\inetpub\php_errors\php_error73.txt"
upload_tmp_dir = C:\inetpub\php_temp
sys_temp_dir = C:\inetpub\php_temp
session.save_path = C:\inetpub\php_temp
Managed to trace it down to two odd culprits.
The main time out issue was:
user_ini.filename =
By default it's commented out in php.ini, so removing the semi colon disabled that feature which must have had trouble searching for ini files on the file share.
Second issue on 5.x seemed to be related to having the old mysql plugin enabled. Leaving it enabled didn't seem to matter on local disk, but having it enabled caused issues on the file share. I'm using mysqli in code, so no problem disabling it for me.
I've installed PHPStorm (8) and trying to debug WordPress theme using xDebug. I tried chrome browser extension and some other settings in the PHP Storm settings.
I've searched a lot but still unable to attach the page to the debugger. What I want is to run the code line by line and check variables etc.
Can someone tell me what exactly is required so the debugging works?
I've following structure:
WAMP is at: c:\wamp
Project is: d:\projects\test
alias is: http://localhost/test/
When I opened the project in PHP Storm. It identified it as WordPress project. But it never attaches the browser to debugger.
Edit
Here is the related xDebug code in php.ini
zend_extension = "c:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"
[xdebug]
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.remote_port = 9000
I also tried true instead of 1. Also tried without providing any port.
There seem to be a lot of ways to set up debugging. There are browser plugins, and bookmark commands, and all sorts of elaborate setups.
For the most part, I always want debugging enabled while I'm developing. If that's true for you, you might consider adding this to your php.ini file:
xdebug.remote_autostart = 1
In addition, a key part to my setup is that I have to click the button in the toolbar for "Start Listening for PHP Debug Connections", and keep this enabled while I work. This is also in the menus under "Run".
Have you tried zero-configuration guide for PhpStorm debugger?
https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
I'm using this solution and it works fine.
Don't forget to add breakpoints and I recommend to create the bookmarklets to activate/deactivate debugger cookies in browser (https://www.jetbrains.com/phpstorm/marklets/).
I'm trying to get xdebug working on my Mac. I'm using OS 10.6 with the built-in versions of Apache (2.2.1) and PHP (5.3.8). I followed the "tailored installation instructions" on the xdebug website, which basically consisted of these steps:
Build xdebug (version 2.1.3) from source
Move xdebug.so to /usr/lib/php/extensions/no-debug-non-zts-20090626
Add to php.ini:
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
Restart the webserver.
From what I understand, that should be it. I know most people use xdebug with an IDE like PHPEclipse, but it doesn't sound like that's necessary just to get debugging output on the page. And a lot of old instructions involve installing MAMP, but it looks like that's no longer necessary.
Signs xdebug is working: When I run php -m and phpinfo() I get the expected information on xdebug. In scripts I'm able to call functions like xdebug_is_enabled() (returns 1) and xdebug_get_function_stack() (returns the stack).
Ways xdebug is not working: The main reason I installed xdebug was to get a stack trace when there's an error, and that's not happening. According to this documentation page, I should get a stack trace as long as display_errors is set to On in php.ini, (which it is). I've tried code that should evoke a warning (e.g., echo(hello)) as well as code that produces a fatal error (e.g., $x->awesomefunction() when $x isn't an object). Neither one produces any xdebug output, and the fatal error just causes the page to die silently. The test code given in the documentation I linked to also produces nothing.
UPDATE: It turns out that if I run a script with a fatal error from the terminal, I do get a stack trace from xdebug. However, it's still not showing up when I run the script from a browser
Also, regular error reporting is now broken: Previously, I'd get error output by including the commands:
ini_set("display_errors","1");
ERROR_REPORTING(E_ALL);
Now, putting those lines in my script doesn't produce any error reporting either. (in the browser. It does cause errors to be shown when I run the script from the terminal.)
So, what's wrong here? Did I leave something out of the xcode installation? Do I have a setting hanging around somewhere else on my system, suppressing errors? I've tried everything I can think of, but I'd be happy to test any ideas you have.
If it is working on console and not on browser, it's probably a xdebug configuration issue.
I'm not a Mac user, but on Ubuntu there are 2 different php.ini files, one for console and one for apache. If that's the case for Mac also, you can check if xdebug is enabled and properly set up in both php.ini files.
Also you can check the xdebug settings mentioned in the guide.
After several more hours of thrashing, I discovered that one of my test files actually was including another file that set display_errors to 0. The other test file was straight off of the xdebug site, but I think that at the time I was using it I'd introduced some other config error that prevented it from working properly. I'm truly embarrassed! Let this be today's object lesson in the importance of systematic, repeatable tests during debugging. On the bright side, xdebug is now working like a peach.
To summarize, the series of steps that worked was:
Build xdebug (version 2.1.3) from source
Move xdebug.so to /usr/lib/php/extensions/no-debug-non-zts-20090626
Add to php.ini: zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
Add to php.ini: display_errors = On
Restart the webserver.
I'm getting the following error when debugging:
php.ini settings:
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Assuming no syntax errors, make sure that you do not have any watches that cause the script to crash as the debugger attempts to evaluate them.
From my experience, this is the most common cause for such early death.
Regardless of that, you may also wish to change your internal web browser, as IE tends to provide cryptic error messages, or use an external browser session (and use remote debugging).
removing watch expressions solved this issue for me
If you are using mod_fcgid in your apache
the default value which is set for FcgidIOTimeout is 40 seconds so you get this xdebug to terminate in 40 seconds
to changed this value you need add the following line in you apache httpd.conf file
FcgidIOTimeout 600
this is for 10 minutes you can set this value to any other time limit according your requirement
even i had the same problem i found this solution for further details follow the links below
http://jonathonhill.net/2011-05-05/uploading-large-files/ (related link which gives info about the value)
http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html ( and search for FcgidIOTimeout)
I ran into the same issue on a different platform.
Running x64 linux with Eclipse 3.7.2, PHP 5.4.3 and Xdebug 2.2.0, this error message may appear when viewing variables.
See Xorg issue #797 and issue #824.
I can confirm that this issue is not resolved in release 2.2.0. The resolution is committed after 2.2.0, so you'll have to download a git copy (check the download page).
After compiling the git version, the issue at hand is resolved.
I also got this problem, after Googling for awhile I decided to revert back to 2.2rc because it's the latest version that this issue does not occur (actually not "always" but "sometimes", just need to relaunch).
Before that I've tried 2.3dev too with no luck.
I'm using XDebug to generate profile repport. The profile are generated, but I'm unable to create a complete call graph using kcachegraph.
The XDebug config is:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /var/www/xdebug/
xdebug.profiler_output_name = cachegrind.out.%t-%s
xdebug.profiler_enable_trigger=1
When I open the repport in kcachegrind, it seems to works, except that somt call seem in double, with one of the two having a location: (unknown).
Note that index.php only have 1 line of actual code, that is a require to the front controller. No autoloading at this stage of the execution, so I really can't figure out why I have 2 require::frontcontroller.php.
Here's a screenshot of 3 windows that might help you:
http://img46.imageshack.us/img46/2226/kcachegrind123.png
Any clue on what could be the problem ?
Thanks
Finally that's an XDebug problem with the profile.
It looks like Kcachegrind have changed their format, but XDebug have not been updated yet as per bug #639.
This is now fixed for 2.1.1 and HEAD.