Why is my xdebug not styled? - php

So I have Xdebug enabled on my local version of PHP, and I'm wondering if anyone can give me an answer as to why the output isn't styled in the default way (with the orange background, table design). I can see the stack trace and everything, but it's all just text, no html wrapper around the message.
Thanks if you have any advice to give!
BTW, this is in my php.ini file:
zend_extension="C:\php\ext\php_xdebug.dll"
xdebug.show_local_vars=On
xdebug.dump.SERVER=*
xdebug.dump_globals=On

Make sure to have :
html_errors = On
set in php.ini

As I have answered in duplicate question:
For Xdebug 3 you need to enable develop mode in your php.ini:
xdebug.mode= develop

Related

Xdebug does not work with var_dump()

I'm not sure why, but xdebug does not highlight var_dump(). But config seems to be fine. Have no idea why... Any suggestions?
This is my phpinfo(); http://pastebin.com/A45dqnWN
plus even xdebug_var_dump() doesn't highlight anything. It works, but look like normal var_dump().
I found that option "xdebug.default_enable Off Off" in you php_info(). I also have noticed that in last versions of EasyPHP this option is turned off. So turn it on by setting this line in php.ini:
xdebug.default_enable=1
Next is just common operation which disables var_dump and other errors in HTML output completely (not your case, but maybe helpful for others):
html_errors = On
For Xdebug 3 you need to enable develop mode in your php.ini:
xdebug.mode= develop
You can also use multiple modes at once as explained here.
The following values are accepted (for xdebug.mode):
off
Nothing is enabled. Xdebug does no work besides checking whether functionality is enabled. Use this setting if you want close to 0 overhead.
develop
Enables Development Helpers including the overloaded var_dump().
coverage
Enables Code Coverage Analysis to generate code coverage reports, mainly in combination with PHPUnit.
debug
Enables Step Debugging. This can be used to step through your code while it is running, and analyse values of variables.
gcstats
Enables Garbage Collection Statistics to collect statistics about PHP's Garbage Collection Mechanism.
profile
Enables Profiling, with which you can analyse performance bottlenecks with tools like KCacheGrind.
trace
Enables the Function Trace feature, which allows you record every function call, including arguments, variable assignment, and return value that is made during a request to a file.
You can enable multiple modes at the same time by comma separating their identifiers as value to xdebug.mode: xdebug.mode=develop,trace.
As mentioned by #Shadoweb for Xdebug v3 you want debug to allow stopping at breakpoints, and develop to format the var_dump
The following you'll likely want in php.ini therefore:
xdebug.mode=develop,debug
As an aside, I also needed xdebug.start_with_request=yes to replace the renamed xdebug.xdebug.remote_enable=1 setting to get step debugging working in my IDE.
For php 7.0.2 and xdebug 2.4.0
xdebug.default_enable=1
+
html_errors = On
Still does not colorize xdebug_var_dump() output.
but this patch fixes my issue. It applies to the xdebug.c and xdebug_var_dump() only. I think they made a mistake that xdebug_var_dump works only if it need to be overload function.
## -2191,11 +2191,6 ##
int i, len;
char *val;
- if (!XG(overload_var_dump)) {
- XG(orig_var_dump_func)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- return;
- }
-
argc = ZEND_NUM_ARGS();
#if PHP_VERSION_ID >= 70000
Turn off xdebug.mode=debug in php.ini like
;xdebug.mode=debug
and restart Apache.

How to debug using WAMP?

I just installed WAMP on Windows XP. I have a simple PHP file that is crashing. I ran it from command line using php test.php.
What is the best way to debug php files? How do I display debugging info?
I looked at php.ini and it includes display_errors = On. Does this do anything?
I tried turning on XDebug from the PHP WAMP menu. This doesn't seem to do anything, besides restarting the server. Do I need to use this? How?
Thanks.
You can look at the log at c:/wamp/logs/php_error.log. If you are not sure whether your PHP log is being redirected here, check your php.ini file and search for a line like this:
;error_log = "c:/wamp/logs/php_error.log"
You may want to remove the comment on this line.
As much as i know about PHP and WAMP.I don't think there is any special debugging option available in this.for the debugging you need to print the answer using echo and exit function wherever in your code you feel the error may posible. The other option is, you need to use software which provide debugging facility such as eclipse with php.
I am using WAMPSERVER 2.4 on Windows 8 pro. I was using WAMP on localhost.
It appears that in my version of WAMP, the php.ini file had appeared as:
;error_log = "Z:/wamp/logs/php_error.log"
When in actuality,for me get the function error_log() to work properly, I wanted it to appear as :
error_log = "Z:/wamp/logs/php_error.log"

Disable HTML stack traces by Xdebug

The administrator has installed Xdebug 2.1.1 in our shared PHP 5.3.0 server in order to use its debugger. Now, I can hardly read the stack traces of uncatched exceptions because they are formatted by Xdebug with annoying colours that interact badly with the site's CSS:
Since PHP runs as Apache module, I've tried to disable this feature in an .htaccess file but I can't make it go:
php_flag xdebug.default_enable Off
php_flag xdebug.overload_var_dump Off
php_flag xdebug.show_exception_trace Off
php_value xdebug.trace_format 1
phpinfo() shows my changes in the Local Value column but I can still see those horrible orange tables. What's the directive I need to change?
Check for xdebug_disable()Docs:
Disables stack traces
Disable showing stack traces on error conditions.
See as well xdebug.default_enableDocs.
You need to make sure you have html_errors=0 in PHP as well.
Also, orange isn't horrible ;-)
Add following code in the initialization Script:
if (function_exists('xdebug_disable')) {
xdebug_disable();
}

Can't get Xdebug to work on Windows 7

I installed the latest XAMPP package which includes PHP 5.3.0. I am trying to enable Xdebug, but it just won't work.
Here's what I changed in the php.ini shipped with XAMPP:
; uncommented
zend_extension = "X:\xampp\php\ext\php_xdebug.dll"
; added the following lines:
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Apache starts fine, but when I open http://localhost/ in my browser, I get the following error:
If I click the Close the program button, the error message will reappear in a second as if it was in an infinite loop. I'd greatly appreciate any help in getting this to work.
I am running a fresh install of Windows 7 Ultimate 64-bit.
EDIT:
From the result of phpinfo():
Zend Extension Build API220090626,TS,VC6
PHP Extension Build API20090626,TS,VC6
Debug Build no
Thread Safety enabled
It's possible you have the wrong version of Xdebug. I would take a look at phpinfo() and compare the information there to the different versions of the Xdebug dll.
Specifically, you want to see if "Thread Safety" is enabled, and you need to know whether you're running a VC6-compiled PHP or a VC9 (if you're using Apache, it's almost guaranteed that you want the VC6).
Have you tried custom installation wizard of XDEBUG, it analyses your php installation and provides exact steps you need to follow
The Windows binaries generally work for every mini release for the mentioned PHP version, although the extension is built against the most current PHP version at that time. The VCx marker tells with which compiler the extension was built, and Non-thread-safe whether ZTS was disabled. Those qualifiers need to match the PHP version you're using. If you don't know which one you need, please refer to the custom installation instructions.
http://xdebug.org/wizard.php
Just paste your phpinfo out put in the text box and you will get exact xdebug dll you would need for your php
frank-ly, I also had 2 REALLY bad days, and I don't now what finally fixed it,
so here's my collection of Do's and pitfalls:
; this is the thread safe version,
; the absence of _nts_ in the dll name 'shows' this
; do not use _ts, your library won't get registered and won't show in phpInfo()
zend_extension = "D:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9-x86_64.dll"
check your php.ini, check phpinfo() if all values (arrive)
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
; if you have multiple virtual hosts ( like 'local.fooclient' )
; maybe using the IP is safer (for any same-machine-debugging)
xdebug.remote_host=127.0.0.1
; maybe a -much- lower port helped, 84 was free. use netstat to figure out.
xdebug.remote_port=84
; idekey! also see note below
xdebug.idekey=netbeans-xdebug
More Pitfalls:
I have seen a typo of xdebug.remote_handle (without r) several times on the web. beware.
A note on the idekey: The above idekey did show in phpinfo() as master value, BUT
was overridden with a 'local value' like MYMACHINENAME$. ==> Setting a global env var (in computer properties) named DBGP_IDEKEY and rebooting (or maybe just logging out) to (also) netbeans-xdebug helps! Again: re-check in phpInfo() it took effect.
Of course adjust netbeans-menu:options->php tab->debugging section to this port and session id.
Here is a script, to check (by php means) if that port you intend to talk to is open. (further below also in the comments, for those to lazy too type from the image)
For your browser to connect, don't start to forget (amidst frustration) to always attach the debug-starting get-argument:
http://localhost/myTest.php?XDEBUG_SESSION_START=netbeans-xdebug
On the port frontier, also this tool might help.
Quadruplecheck you are keeping VC6 and VC9 compiled versions of everything apart.
Running your whatever/path/php.exe myTest.php from the command line (once the above settings are done) might also reveal additional errors (it did, while I was tinkering with an incorrect dll).
I can recommend http://www.wampserver.com
(for personal reasons it fits me better than the popular xampp package...)
Yes, there is a known problem - is almost impossible to get Xdebug working with latest Xampp and 64-bit Vista/Win 7.
There is a bug reported with many users complaining about it.
The solution seems to be latest beta version on Xampp. It includes version 2.0.6 (dev) of xdebug and it is working just fine.
I tested it on 64-bit Vista for approx 10 days and not encountered any problem yet.
When xdebug is installed not with XAMPP, just with PHP (32bit, TS, VC6, in C:\Program Files (x86)\PHP) and Apache (32bit) on Windows 7 (64bit), in php.ini you need to specify the full path to x86 folder of Program Files like.
zend_extension="C:\Program Files (x86)\PHP\ext\php_xdebug-2.1.1-5.3-vc6.dll"
and NOT
zend_extension="C:\Program Files\PHP\ext\php_xdebug-2.1.1-5.3-vc6.dll"
This was my mistake, when changed to x86 folder, xdebug started to work perfectly. Hope this help you, too.
Like others have said, you need to match your xdebug version with your php version.
You've already matched up PHP version number, thread safety, and compiler.
If you haven't already figured it out (this is an old thread), what you're missing is the INI configuration. If you are loading a module that's thread safe, you need to use the following line:
zend_extension="C:\Path\To\The\Extension.dll"
If the module is not thread safe, then you use the INI directive you've been trying to use.
This only applies to zend_extension's and not regular extensions.

wamp cannot load mysqli extension

WAMP installed fine, no problems, BUT...
When going to phpMyAdmin, I get the error from phpMyAdmin as follows:
Cannot load mysqli extension. Please check your PHP configuration
Also, phpMyAdmin documentation explains this error message as follows:
To connect to a MySQL server, PHP needs a set of MySQL functions
called "MySQL extension". This extension may be part of the PHP
distribution (compiled-in), otherwise it needs to be loaded
dynamically. Its name is probably mysql.so or php_mysql.dll.
phpMyAdmin tried to load the extension but failed. Usually, the
problem is solved by installing a software package called "PHP-MySQL"
or something similar.
Finally, the apache_error.log file has the following PHP warnings (see the mySQL warning):
PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PHP Warning: Zend Platform does not support this version of PHP - please upgrade to the latest version of Zend Platform in Unknown on line 0
PHP Warning: Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0
PHP Warning: gd wrapper does not support this version of PHP - please upgrade to the latest version of gd wrapper in Unknown on line 0
PHP Warning: java wrapper does not support this version of PHP - please upgrade to the latest version of java wrapper in Unknown on line 0
PHP Warning: mysql wrapper does not support this version of PHP - please upgrade to the latest version of mysql wrapper in Unknown on line 0
So, for some reason PHP is not recognizing the mysql extension.
Anyone know why? Any solution or workaround?
I deleted the PHP in program files ad everything started working , the problem that there two installations of pHp
I tried many solutions, and none worked for me. I tried the following solutions:
Restart wampserver
Reinstall wampserver
restart machine
and all other solutions mentioned in this question.
However, none of these worked. Then I found that my PHPMyAdmin was not working in chrome and was working in firefox. So I tried clearing cache, restarting browser etc, but still it would not work.
Then I deleted all the files from C:\wamp\tmp and then tried again, and it works. I am not sure why it works, but here is what I think. The session was cached and not getting cleared. So as soon as I deleted all files in this directory all the sessions were deleted and hence it worked fine.
First, make sure that the php.ini file is loading the mysqli extension.
If you are using WAMPServer, click on the icon in the system tray, go to PHP -> PHP Extensions and make sure it is checked. If not, go into the php.ini file and make sure that the line: extension=php_mysqli.dll is uncommented (eg, remove the ; if it exists). If that line does not exist, add it.
If this still does not work, double check that the right php.ini file is being loaded.
To do so, view your phpinfo() (Here for WAMPServer). Scroll down to the Loaded Configuration File row and see which php.ini is being loaded.Make sure it is the right file. If you're using WAMPServer, it should be(WAMP INSTALL FOLDER)\bin\apache\Apache2.2.11\bin\php.ini. By default, it isC:\wamp\bin\apache\Apache2.2.11\bin\php.ini`.
If a different php.ini file is being loaded, just rename it to something else so that PHP will try and find the file somewhere else. There should be a way to specify which on eyou want to use, but I forget exactly how to do that...
If this still doesn't work... Try messing around with phpMyAdmin's settings, or using another answer, but I'm afraid I can't help beyond this.
I was running WAMP with two PHP versions 1) 5.2.9 and 2) 5.2.13.
As per site requirement i needed to change PHP version to 5.2.9 from 5.2.13. after swapping PHP version, error was "mysqli extension is missing". after debugging long time i get to know it was due to wrong "extension_dir" path in php.ini file.
So i changed its value:
Old: "extension_dir" c:/wamp/bin/php/php5.2.13/ext/
New: "extension_dir" c:/wamp/bin/php/php5.2.9/ext/
Restarted All services in wamp server, then it's fixed.
I had the same problem. I had WAMP server installed. All was working fine. Then one day I restarted my computer and it just stopped working! I tried desperately going through all help posts and doing them but nothing worked.
What they usually suggest you do is, first go to your php.ini file and make sure your 'extension_dir' is properly set. Then to make sure these two lines are not commented (remove the ; infront):
extension=php_mysql.dll
extension=php_mysqli.dll
Then some suggested that I download fresh copies of these two files but none worked. I also tried uninstalling everything (php/mysql/apache) and reinstalled fresh copies of WAMP server several times but with no luck.
Finally I managed to find an alternative solution. I switched to 'easyphp' (http://www.easyphp.org/). This is something very similar to WAMP. First I made backups of my sql databases so I can reload them on the new installation.
Then I installed 'easyphp' and everything seems to work fine. I reloaded my sql databases from my backup and now things are back to normal.
I hope someone suffering from a similar prob. will find this useful. If someone has really found a fix to make WAMP server work. Pls do be kind enough to post it here so many will benefit.
in wampserver go to php.ini. open the file and uncomment extension=msql.dll by removing semicolon(;) for respective operating sytem.
Just add in your php.ini:
[PHP_MCRYPT]
extension=php_mcrypt.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
Also setup the mysql password:
SET PASSWORD FOR root#localhost=PASSWORD('your_password');
And the phpmyadmin mysql password in config.inc.php:
$cfg['Servers'][$i]['password'] = 'your_password';
Had the same problem, with wamp. Try to exchange your current version of php.ini with a backup. There is one in: wamp\bin\php\php5.3.0phpForApache.txt. Worked for me.
Just wanted to chime in on this one. Using Wamp Server 2.0, and using Zend Studio with Zend debugger for development.
I wasn't able as of yet (will get back to it at some point) to get the zend debugger working with php 5.3. So in wamp I loaded an earlier php version, 5.2.11. I was getting the same error when acessing php my admin.
What I had to do was change the php.ini file value for "extension_dir" to c:/wamp/bin/php/php5.2.11/ext/ to match the version of php I was using. After that it was all good.
I had this problem and spent 2 hours trying all the solutions online, none worked.
Tried this, and it woked:
Change
mysql.default_host =
to
mysql.default_host = localhost
and restart WAMP. pay attention if you are using mysqli or not.
I had the same error. When I increased the script memory size and enabled E_ALL then restarted the server, I got that error in phpmyadmin. All I had to do to fix it was restart my computer!
I got this problem for a long time. Tried all I've read on forums and this finally worked for me:
Open your php.ini (I assume you've got the good one that is loaded...) and find this line
mysqli.default_port = 3306
change for
mysqli.default_port = 80
Restart all services
Go to localhost/phpmyadmin -> won't work
Reopen the php.ini file and retype this
mysqli.default_port = 3306
Restart all services
Worked for me.
For me worked this, after searching all logs/internet/every non-normal things.
You have to register dl by:
Through application:
WAMP -> PHP settings -> enable dl
or
# php.ini #
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl = On
I have just installed WampServer, and faced same problem. I have found solution, that works for me, it is ridiculously simple.
Disable PHP extension php_mysqli.
Restart WampServer, visit local phpmyadmin.
Enable php_mysqli back.
Repeat step 2.
After few page refreshes, remaining errors plates (about MySQL and sqli) had gone.
i tried hard by
installing the wamp again and again,
by checking the php.ini file,
by restarting the machine,
by replacing the index.php file,
but none works.
then i go to the wamp/temp and deleted all files and it works fine now.
I had path variable in windows set to some random version of php.
The fix was to update it and set it to the folder within my wampserver installation:
C:\wamp64\bin\php\php5.6.38
Then I realized this is wrong also for my specific case, and I should actually be running the script from within vagrant. Live and learn.
I had this issue because of a different reason:
Check the PHP Error Log(Get from the Wamp Tray -> PHP -> PHP Error Log.
I had a syntax error in the php.ini file while I was editing the file.
Check the log and clear the error. This will open your PhpMyAdmin properly.
Check your phpForApache.ini file's extensions. This file should be same as your php.ini file.

Categories