unreadable output with var_dump on xampp windows - php

I'm having some issue with var_dump.i'm using xampp 1.7.3 on windows.
I think in previous version i could output a variable with var_dump without print "<pre>" print "</pre>" firebug is not installed on my firefox and i'm not using xdebug.
Formally i have even red colored and nicely formatted output.Now it's completly unreadable.Can anyonw give me a tips n how to correct that.And html_errors is on from what i saw in php_info.thanks for reading this.

You were using Xdebug before; you're not using it now. Without it, there are no colors, and there are no HTML line breaks (use nl2br, change the Content-type header to text/plain or put the output in a <pre> block).
See the "Variable Display Features" on the manual of Xdebug.

Un-comment this line in you php.ini file.
zend_extension = "D:\xampp\php\ext\php_xdebug.dll"

This topic helped me at the time I was working in PHP5. With a fresh install of Xampp (PHP 7+), xdebug is no longer installed. It must be done manually. Below the explanations :
Goto https://xdebug.org/wizard.php
Make a phpinfo(); on your project and paste it in the textarea on the xdebug website
It returns some informations on your system like Xdebug installed: no
Follow the instructions in the bottom of the results page
After the manipulation, if you check again your phpinfo();
This time we get Xdebug installed: 2.6.0. xdebug works !

Related

Debug PHP 5.6 with PhpStorm and Zend Debugger

I'm using PhpStorm 2017.2.4, and programming with PHP 5.6 (for technical purposes).
Because I'm using PHP 5.6, since Xdebug only supports PHP 7 and upwards, I cannot use it to debug my code - hence I have to use Zend Debugger.
I've been trying to attach Zend Debugger to PhpStorm by following this video, though it doesn't seem to work.
I'd like to be able to debug PHP similarly to how I'd debug JavaScript with Chrome Developer Tools (breakpoints, check variable values, etc.)
What I've been trying, so far:
Download the Zend Debugger ZIP, extract ZendDbugger.dll to C:\xampp\php\ext and add to php.ini:
[Zend Debugger]
zend_exxtension_ts="C:\xampp\php\ext\ZendDebugger.dll"
zend_debugger_allow_hosts=localhost
zend_debugger.expose_remotely=allowed_hosts
I tried clicking this > + > PHP Web Application > Server ... > + > Name: localhost, Host: localhost, Debugger: Zend Debugger > OK > OK
Set a break point, so I know that the debugger works > Shift+F10 > Enter an input into the text field and submit > PhpStorm's The break point isn't triggered
I thought that I may have missed a step due to PhpStorm's bookmarklet instructions, so I put the Start Debugger one, restarted the webpage, entered the input, pressed Start Debugger and submitted - but no, no breakpoint was triggered.
What have I missed?
Thanks!
you need to install a chrome extension to link your page to phpstorm debug functionality. something like this one : https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
I came across a similar scenario and I could debug PHP 5.6 in PHP Storm with the following steps.
Installed XAMPP 5.6 via this link
It's bundled with php_xdebug.dll and therefore no need to download it from xdebug.org. In case you don't have it can be download from here.
Update php.ini by appending the following lines at the end of the file.
[xdebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=C:\Temp
xdebug.idekey=PHPSTORM
xdebug.remote_autostart = 1
Restart Apache Server
Install 'Xdebug helper' extension to chrome.
Now in PHP Storm click on "Start Listening for PHP Debug Connections" button and you should be able to hit your breakpoints.

How to stop xdebug from stopping on first line with PhpStorm?

I'm having this weird problem. All my settings used to work OK, until I updated my version of PHP. I use macports and have the php5 and php5-xdebug ports installed.
xdebug is working, but it is stopping on the first line of my script even though I have the option disabled in PhpStorm. There is no breakpoint there, and breakpoints in other parts of the code are working OK.
If it helps, here is the xdebug portion of phpinfo (in two parts);
https://dzwonsemrish7.cloudfront.net/items/3K3R2N1f1A190K372n0S/Screen%20shot%202011-08-18%20at%203.06.29%20PM.png?v=54c8964d, https://dzwonsemrish7.cloudfront.net/items/0i133s0U430k3u3w3B1E/Screen%20shot%202011-08-17%20at%205.14.25%20PM.png?v=1278da84 and the proof it is disabled in phpStorm: https://dzwonsemrish7.cloudfront.net/items/3W2S060I1b0W1q0z0c45/Screen%20shot%202011-08-18%20at%203.07.00%20PM.png?v=85471026
Is there an xdebug setting I need to change? When I did the upgrade, I lost my php.ini that had some other xdebug configuration.
The above didn't work for me because as far as I can tell if you're using Xdebug the only debug bookmarklets you get is start/stop and debug this page. I don't see any bookmarklet specific to stopping on first line, and neither the start/stop bookmarklets nor stopping PHPStorm from listening within PHPStorm fixed the problem for me.
To get it to stop I did this (on OS X):
Go to Preferences > Languages & Frameworks > PHP > Debug
Uncheck both of the 'force break at the first line...' options
Apply and close
In the Run menu, uncheck 'Break at the first line in PHP scripts'
For example, even if you have Path-Mappings, the public/index.php path may not be considered as part of the project.
Check the "Force break at the first line..." in the PHP->Debug section of preferences.
BESIDES THAT, also check this setting:
My problem with PHPStorm was that I was doing Drupal and the index.php was outside the project (since the project is a module). I needed to uncheck the settings "Force break at the first line..." in the PHP->Debug section of preferences.
Do you use debug bookmarklets? 'Break at the first line' option could be also controlled via 'xdebug Break On' and 'xdebug Break Off' bookmarklets.

Xdebug And Netbeans Problem

Im trying to configure xdebug to work with Netbeans 6.9 and php 5.3
As far as i concern i have setup xdebug properly.
I can see xdebug extension from phpinfo page.
I have read other post and tried their suggestion but up to no avail
When i hit the debug button, it straight open the page in the browser and i can see message 'Waiting for connection' in the bottom pane of netbeans
Here my setting in php.ini
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
Any help would be appreciated
First, check that it isn't actually working for you, and you don't notice. I've done this...convinced it's not working I wasted a chunk of time trying to get it to work, only to find that everything was OK.
Look at your NetBeans status bar. If you see "netbeans-xdebug" and "running" then it is actually working just fine. You probably have the "Stop at first line" option turned off and you didn't hit any breakpoints you set (if any) yet. That would be a reason you are seeing the page with little or no indication that the debugger is actually connected.
If you instead see "Waiting for Connection (netbeans-xdebug)" and the progress bar is cycling, then you are indeed not connected. Open Tools|Options, and go to the PHP page. On the general tab, make sure that the "Debugger port" is 9000 and the "Session ID" is "netbeans-xdebug". You may want to have "Stop at First Line" checked. I don't, as I find it a bit annoying. I would definitely ensure that "Watches and Balloon Evaluation" is not checked. This option causes NetBeans and the debugger to destabilize. If you need a watch, hack a local variable into the PHP code where you need it, and you'll see it on the "Variables" tab when the debugger is running. Also, confirm that file (index.php) is specified in the project's Run Configuration > Index File.
Since you see xdebug in phpinfo(), that end of it is fine. Just make sure that all of the values look reasonable, and that there is some reference to a cookie "XDEBUG_SESSION=netbeans-xdebug" somewhere on that page. (Make sure that you don't have cookies turned off on the browser!)
The only other thing to check is to see if some firewall/security program is running that would be blocking TCP/UDP locally (which would be super-odd, but not out of the realm of possibility), or that port 9000 isn't already used by another application. I am using a different port number in my local setup for some reason. I don't remember changing it, but I am sure that the only reason I would have is if I had hit a port conflict with something else.
One last thing... We've been assuming that you are running NetBeans and the web server on the same computer. That's a common configuration, but not the only one. If your web server is on a different computer, then change the localhost in xdebug.remote_host=localhost to the IP address of the computer on which NetBeans is running.
Another last thing: When cycling through frustrating iterations, until you see xdebug info in phpinfo(), restart apache/php. Once there, still restart NetBeans between iterations. And believe it or not, restart your browser.
For me it was changing
;xdebug.remote_enable = 0 (default value in clean XAMPP installation)
to
xdebug.remote_enable = 1
did the trick
Adding an index.php did the trick for me.
I couldn't figure out why some of my projects would connect to the debugger and others wouldn't. Then I realized that the ones that wouldn't connect started with index.html. Once I renamed these files to index.php, the debugger connected with no problem.
I solved this using a windows -> remote LAMP server config after reading the following post, leaving the link in case anyone finds it handy:
http://stuporglue.org/setting-up-xdebug-with-netbeans-on-windows-with-a-remote-apache-server/comment-page-1/#comment-6227
Having just upgraded to the new Ubuntu 14.4 my NetBeans Xdebug stopped working. I've followed all the answers above to date to no avail.
I found a NetBeans Ubuntu statement that the /etc/php5/cli/conf.d/xdebug.ini file should have xdebug.remote_enable=on. When I checked the /etc/php5/cli/conf.d directory, I found no xdebug.ini file. However there was a link to /etc/php5/mods-available/xdebug.ini there.
Subsequent adding the xdebug.remote_enable=on to that file fixed the problem.
PS - This works on NetBeans 8.0.1
When I tried to debug the Yeoman WebApps powered by PHP backend in Netbeans, the status keep showing 'Waiting for connection'. There's probably because the index.html has nothing to do with php at all. It's only when I've triggered the ajax which needed PHP processing, the connection with xdebug immediately connected and debug as usual. Hope this give another perspective to someone as I have stumbled to 'think' there is a problem and trying to fix the ini.
An alternative is the Dephpugger project. Is like ipdb in python or byebug in Ruby.
https://github.com/tacnoman/dephpugger
Is very easy to use.

Zend farme work Doubt2

I put this in to php.ini
include_path = ".;c:\php\includes;C:\wamp\zend\library"
C:\wamp\: here I put the zend frame work
when I run the WAMP sever , I seen a page as usual
How I check whether it's install or not,
How I start my work in the frame work
check the output of php_info() to see if you settings were applied as expected ...
also a screencast to let you get kick off.

How to debug PHP with netbeans and Xdebug

I have recently tried to get going with Netbeans 6.5 after it rated so highly in the IDE review by Smashing magazine. http://www.smashingmagazine.com/2009/02/11/the-big-php-ides-test-why-use-oneand-which-to-choose/
My main reason for switching from Notepad++ is that I'd like to be able to debug my code and set through it.
I have followed the instructions about how to install xdebug from both the vendor http://xdebug.org/ and the netbeans web site. http://www.netbeans.org/kb/docs/php/debugging.html#gettingReady but to no avail.
How is it done, has anyone else got debugging working in netbeans?
(My setup is: Windows XP, Wamp server 2.0, PHP 5, Netbeans 6.5.1)
It's important to add this line in the php.ini:
xdebug.idekey="netbeans-xdebug"
Note: In NetBeans go to Settings and look where the xdebug stuff is set up. Look for that Session ID. In my case it was netbeans-xdebug.
hm, for me, the netbeans was the first ide that php debugging was working out of the box.
Does the xdebug show in phpinfo? if it does it should work with default settings. the only one that is needed is:
xdebug.remote_enable=on
So if this isn't enabled put it in your php.ini file, restart apache, and debugging should work.
If not, you will have to supply more info for me to help you.
sy
I have since found that WAMP, when installed with Mod_rewrite and cURL cannot cope with Xdebug.
It is a known error and crashes everytime.
http://phphints.wordpress.com/2008/10/24/wampserver-phpini-settings-for-use-with-xdebugdll-pear-and-silverstripe-cms-framework/
Unfortunately, I am using these 2 libraries too.
It's not a know problem that xdebug gives issues with curl or mod_rewrite. The only issues I am aware of is with Xdebug on Vista.
You can see here:
http://ruilima.com/2010/11/ambiente_de_desenvolvimento_php_netbeans_xdebug/
is in Portuguese, but there is a pre configured virtual machine with Ubuntu 10.10, netbeans, php, mysql, xdebug, ready to use. take a look
I found out that in Netbeans you need to set the webroot path in the projects to app/webroot. If you do this debugging works flawlessly.
If you are using xampp under Windows:
You only need to open your php.ini file and change these two lines
;xdebug.profiler_enable = 0
;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
into
xdebug.profiler_enable = 1
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
(Caution: If your xampp version is old, you must download it from http://xdebug.org/download.php, download the 32 bit even your OS is 64 bit. E.g. the xdebug's name you downloaded is php_xdebug-2.2.1-5.4-vc9.dll. First copy php_xdebug-2.2.1-5.4-vc9.dll to the directory C:\xampp\php\ext\, then your the second line will be zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.1-5.4-vc9.dll)
After that stop apache and start again, that's it.
If you're having the problem in which Apache decides to crash whenever you run the debugger (which is what I had and is extremely annoying). I'm fairly sure I re-installed xampp and re-set up xdebug. I think the problem was to do with the zend-debugger being set up weirdly in php.ini and me not modifying the correct php.ini.
Eventually after re-installing and resetting it up I got it working fine.
I now run a dev release of Netbeans which has networked debugging with xdebug so we run it all off of our development server and it works a treat.
Good Luck, There isn't particularly any decent documentation on how to set up xdebug with net beans.
I have had occasional issues with NetBeans and XDebug which have been down to a Watch statement being in place which does not relate to the code being debugged.
In this case the debugger just fails with a Socket Exception.
Remove any watches if you find this is causing your issue. Generally though I have found XDebug to be extremely handy!
I do realise however that this may not relate to the issue you have here but it's worth being aware of.
found the solution of the same problem on the same site PHP Netbeans: xdebug stops on every include() or require()
Well wrongdoing was, forgetting
[xdebug]
as a section header in php-ini. And of course, "park" your stuff right before another section start (e.g. [Date] or [iconv]) otherwise you will accidetenly place those in the wrong section. (In the comment djungle of php.ini this happens easily.)
In my case it was a process running on my machine (Windows 7) that was using port 9000 already called aeagent.exe
I changed my php.ini setting to "xdebug.remote_port=9001", made the corresponding change in netbeans, then restarted Apache. Now it works.
Thanks to SysInternals TCPView tool.
Go to http://wiki.netbeans.org/HowToConfigureXDebug . There is a big list of steps you should follow, that might help you out.
But most likely you just need a new version of xdebug-binary. Go to http://xdebug.org/wizard.php to find out what binary you need und your problem might be solved.
When running netbeans under Ubuntu, I was facing this issue too, it seems that I have tried all solutions found in internet but all in vain.
The only thing that finally helped was running netbeans with SUDO command! Looks like regular user didn't have permission to listen on port 9000 (or any other).
sudo netbeans &
...and voila, I can debug again! Maybe it'll save you a day or two
Now its working after Wasting the 3 hours for making xdebug work on Windows8 with wamp 2.2
replacing original lines below [xdebug] with following
zend_extension = "c:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"
;make sure path of your own php_xdebug, dll version may vary.
[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
;recheck your port number in netbeans [Tools=>options=>php=>debugging there it is: debugging port]
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
Now click on wamp icon in taskbar and "restart all services"
Well..Now final step>>START NETBEANS AS ADMINISTRATOR
Holly soul of windows8 i hate you :<
Go through the below document for remote debugging using NetBeans.
http://stuporglue.org/setting-up-xdebug-with-netbeans-on-windows-with-a-remote-apache-server/

Categories