xdebug 2 with PhpStorm setup error - php

I have been dealing with an unexpected error when trying to setup xdebug 2 with PhpStorm (2016.2.2). It says:
Connection with 'xdebug 2.5.0rc1' was not established. Validate installation.
I decided to ask for help because I cannot solve this error for 3 days already and I have tried everything I could.
These are the setup steps that I did:
pasted my phpinfo here (https://xdebug.org/wizard.php) and downloaded the recommended php_xdebug.dll (php_xdebug-2.5.0rc1-5.5-vc11-nts-x86_64).
copied php.ini file into bin\php\php5.6.0 and added these lines of code:
[Xdebug]
zend_extension = C:\MAMP\bin\php\php5.6.0\ext\php_xdebug-2.5.0rc1-5.6-vc11.dll
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.remote_port = 80
xdebug.profiler_enable=1
Installed "JetBrains IDE Support" and "Xdebug helper" extensions for Chrome browser.
Sometimes I manage to debug (I guess) without an error but I get an error on browser which says "No direct script access allowed".
I am on Windows 10 x64 running MAMP 3.2.2 with php 5.6.0. Don't know what more details I can provide right now but it looks enough.

The problem that I had was on the other laptop that I use. Both of them use the same settings (win10, MAMP 3.2.2). On my second laptop (the one I am currently typing from) this is php.ini settings:
PHP version: 5.6.0 PHP CLI: C:\MAMP\bin\php\php5.6.0\php.exe PHP CGI:
C:\MAMP\bin\php\php5.6.0\php-cgi.exe Loaded Configuration File:
C:\MAMP\bin\php\php5.6.0\php.ini Debugger extension: xdebug 2.4.1
It uses xdebug 2.4.1 and I dont get the error on this laptop. I will try to get the same xdebug version to my first laptop and see if it works.
And this is the only command I added to php.ini on the second laptop (xdebug functioning) "zend_extension = C:\MAMP\bin\php\php5.6.0\ext\php_xdebug-2.4.1-5.6-vc11.dll" . Does it even make sense that without extra Xdebug settings it could even run?

Related

Apache NetBeans 12.3 and XAMPP 3.2.4 PHP Breakpoints Windows 10

I spent a few days configuring the Apache NetBeans 12.3 and XAMPP 3.2.4 and PHP and I am not able to make it functional in way, that I will be able to debug the code with a breakpoints working.
I installed first new xampp make sure that is completely new installation.
Restart of pc needed so I did so.
Installed ApacheNetbeans 12.3 IDE
Checked the PHP.ini - first strange point. No [Xdebug] Were stated here.
I created new project in netbeans put phpinfo() inside run the page , page showed , copied the content , put it to setup wizard downloaded the dll , put dll to the certain place where they stated opened the php.ini ...
5.1 In php.ini no Xdebug was stated so at the end of the file I added [XDebug] and stated part of code.
5.2 I set up the port to 9000 (also 9001 in another attempt) and saved the php.ini with new values in.
6. Stopped the Apache, Stopped the mysql , turned off the Xampp , run xampp under admin rights , started the apache ,and started the mysql
7. NetBeans - opened the project, removed the phpinfo();
7.1 Added the lines: echo("Test"); $x = 1; echo("after Test");
7.2 Added breakpoint on $x=1;
Run in debug mode.
No breakpoint were catched. In netbeans there was a still message that stated: "Waiting for connection ..."
I am not sure what is here wrong , but I checked many other topics ( they are older than this one) and no solution worked. Is it still Apache netbeans and Xampp on windows 10 compatible ?
I know I was able to run and use it few years ago when it was not Apache NetBeans but just netbeans and I did not face that issue. Just installed both Xampp and Netbeans and no other special configuration were needed.
I turned off the firewall ,
checked if there is no zend tags in php.ini ,
checked if it installed it shows it is , and it is OK (shows versions) ,
changed ports to 9001 or different as was suggested in another threads ,
tested few different commands like xdebug.enable_remote = on , instead 1 and vice versa ...
after I clicked netbeans help which appears after I stopped debugging the link goes to not found page ...
I googled the wiki page of netbeans and proceed these steps as well ...
Did anyone face the same issue on clean install ? What is the solution for that or what I am doing wrong ?
Thanks so much .
Edit 17.5.2021 .
There is no antivirus installed and also windows firewall and defender is off .
Localhost can be loaded with page but no break points available.
Edit: Adding my log:
Xdebug installed: 3.0.4
Server API: Apache 2.0 Handler
Windows: yes
Compiler: MS VC15
Architecture: x64
Zend Server: no
PHP Version: 7.4.10
Zend API nr: 320190902
PHP API nr: 20190902
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Configuration File Path: no value
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
NetBeans 12.3 and XAMPP 3.2.4 are compatible with win10.but if you pre installed antivirus software like avast or kaspaskey they will detect xampp as a malicious software.so before you run xampp turn off the antivirus software and try again.
First right click on your my computer icon & choose manage
then go to services and applications
select services
set windows defender startup type to manual instead of Automatic & restart the computer.and try again from installation xampp. you should try from xampp installation
If it does not work install a xampp old version and try again.
Sometimes windows defender detect it as a malicious software. So turn it off and try again.
There is no matter with netbeans ide.
If you getting problems with xampp every time install zend server or another WAMP software and continue work

PHPStorm 10, XAMMP, Xdebug/ZendDebugger

Over the past few days I have been trying to get debugging working with PHPStorm 10 on my local machine (Mac OS). I have tried both ZendDebugger and xdebug.
I seem to be hitting the same problem with both. I setup my interpreter and it says that the correct Debugger is installed on XAMPP but then when I run the "Validate Debugger Configuration on Web Server" tool in PHPStorm it gives the error: No debug extension is loaded.
The following is my php.ini file settings for Xdebug:
[Xdebug]
zend_extension=/Applications/XAMPP/etc/xdebug.so
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/Applications/XAMPP/xamppfiles/htdocs/sam-files/
xdebug.idekey=PHPStorm
I have also been using the following recourses online:
https://www.jetbrains.com/phpstorm/help/configuring-xdebug.html
https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
Any guidance on this would be great.
Thanks,
Sam
Check if the correct extension are loaded using the following command in the PHPStorm terminal
php -i | grep xdebug
You might want to check to make sure you're loading the correct php.ini file as well, by using
php -i | grep ini

Netbeans 8 and Xdebug

I just installed OSX Mavericks, and upgraded to Netbeans 8 PHP/HTML5.
In my previous install Netbeans 7.2 everything worked great and i had local debugging, through xdebug and MAMP.
After installing the new netbeans i no longer have access to xdebug. I try to debug the cli script it runs through...never connects to xdebug and i see the waiting bar.
The script will run all the way through and it will just continue with the (waiting-to-connect) until i manually end the xdebug session.
After ending it. I can no longer run The Run Project or Debug Project buttons. They just do nothing.
I am using MAMP and have edited all php.ini i can find with this:
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debu$
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
php --ini returns the .ini in /etc
php_ini_loaded_file() through netbeans returns false.
Anyone know what else i can do to track down which ini file is being loaded.
Or know the problem here.
Like i said everything was working until i upgraded to netbeans 8.
After installing the new MAMP it renamed the php.ini to php.ini.default.
Netbeans could not find it. i renamed php.ini.default to php.ini and now everything works
We were with this problem in a new DELL machine. McAfee was blocking. Uninstalled McAfee and functioned normally.

XDebug could not connect to client

I am trying to debug with NetBeans Mac locally.
This is my php.ini
[xdebug]
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_log="/Applications/MAMP/logs/xdebug.log"
xdebug.idekey="netbeans-xdebug"
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
This is what I had been getting in xdebug.log
I: Connecting to configured address/port: localhost:9000.
E: Could not connect to client. :-(
I try changing the port to 9001 and turn off firewall and it didn't help.
Xdebug's default port (9000) conflicts with FastCGI (Xdebug was first!) - the solution is to change it to another port. After having done that, you need to restart your IDE where you will also need to configure the new port. You will also need to restart PHP and your Web Server.
Step 1:
Change xdebug.remote_port=9000 to xdebug.remote_port=9001
Step 2:
Change the debugging port in Netbeans. Go to Tools >> Options >> Click PHP tab
Under PHP tab click debugging
Change the debugger port : 9001
Change Session ID : netbeans-xdebug
Step 3:
Restart server and netbeans
Step 4:
Set a breakpoint and try
I had exact the same problem.
The xdebug installion wizard (https://xdebug.org/wizard.php) showed that my xdebug was correctly installed. (The wizard told me to install the Xdebug 2.5.0rc1 dll)
In phpinfo I also got a xdebug section showing (in my opinion) the correct values. Even with this I got a "could not connect to client" message in the error log.
Eventually I solved it by trial and error doing the following:
Downloaded all the older versions of the xdebug dll's for my php version and tried them all. Eventually one of them worked. For me it was with php 5.6.8 the xdebug 2.4.1 dll (PHP 5.6 VC11 TS (32 bit) ) on a windows 7 32 bit machine. I am using xampp-win32-5.6.8-0-VC11.zip for my xampp installation.
What I learned was the following:
(a) The Xdebug wizard does not neccesarily give the correct dll to use
(b) Even though phpinfo shows a Xdebug section with correct variables this does not necessarily mean that it is correct.
(c) Try older versions of the dll's if you get this error.

XDebug / Apache / PHP / Eclipse skips breakpoints

I'm having problems with XDebug.
Configuration as follows:
Windows 7 64bit
PHP 5.4.6 Thread Safe 32 bit
Apache 2.4 Thread Safe
Eclipse PDT 3.0.2
The problem is that xdebug_break() calls are not working, and breakpoints entered through Eclipse also don't function. I can see that the extension is working, as it appears as a module in phpinfo(). When I call an uncallable method, XDebug outputs the relevant error messages.
I've modified Eclipse's web server path mapping, to no avail.
Here is my php.ini config:
zend_extension = c:/php/php_xdebug-2.2.1-5.4-vc9.dll
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 8080
xdebug.remote_mode = req
Any help would be kindly appreciated...
First check that what version you are using of PHP in eclipse....
Check it through:
Window->preference->PHP->PHP Interpreter....
Version there should match with the PHP version.....
Reply if problem is not solved....
For all those, that are still fighting with this problem, some handy tips.
Check which version (package) of Eclipse you have? It turns out, that Helios package has some bugs and doesn't stops on breakpoints, when you debug your application as Web Application. Debugging works only, if you run it as PHP Script. Which makes it pretty useless for debugging process.
You should consider either reverting to older Galileo Package Eclipse for PHP Developers or installing newest Eclipse Juno (or even newest developer version of Eclipse Kepler), which doesn't have PDT support build in, but you can easily add it to then, using Help > Install New Software.. (point it to http://download.eclipse.org/tools/pdt/updates/release).
These versions are reported to be able to debug as Web Application, respecting breakpoints.
Also, remember, that Xdebug must be run as Zend Extension in order to support breakpoints! In other words remove extension=xdebug.so (on Linux or xdebug.dll on Windows) line from your php.ini and replace it with zend_extension=/full/path/to/xdebug.so (on Linux or zend_extension=X:\full\path\to\xdebug.dll on Windows). Zend extensions requires full path, even if they're put into /php/ext folder, as regular PHP extensions. You'll find more info on this in Xdebug FAQ (look for an answer to "Xdebug is only loaded as PHP extension and not as a Zend Extension" question).

Categories