7

I try to configure my phpStorm for debugging according to this tutorial .

My entire project is located in C:\work\Projects\xampp\htdocs\myCode

In the phpStorm I did to follow -

Under File > PHP > Servers:

Name: myCodeDebug
Host:http://localhost/myCode
Port:80
Debugger:Xdebug

Absolute path on server: http://localhost/myCode (same as the project location).

I use Apache server in ports 80,443.

My PhpStrom version is 7.1.3

Now I mark some breakpoints, go to Chrome and navigate to http://localhost/myCode/ but no any phpStrom debugger is promted although the entire website is got loaded .

What is missed here and how to make it works with xDebug?

Update:

Following the suggested in the comments , I followed this tutorial and now I have the chrome extension - Xdebug .

In this manual I paste all the content of php -i and did all what it required .

As described in Xdebug generator , I added two bookmarks - start debug and stop debug for IDE key = PHPSTORM .

In my php.ini I have -

[XDebug]
xdebug.idekey = "PHPSTORM"
xdebug.remote_port = 80

I work with xampp port 80 .

Now I hit the start deebug bookmark , in the phpStrom press on start to listen to php debug and set any breakpoint in php scope, set the Xdebug extension on Debug mode , browse to localhost/myCode/index.php but no any debugging is occur in the phpStrom .

How to config it correctly ?

Update 2:

Under cmd php --version I have -

PHP 5.5.11 (cli) (built: Apr  8 2014 15:07:14)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

Also all in File | Setting | php | servers was deleted .

Update 3:

[Here is my phpinfo();] (personal details had changed to XXXXXXXX) .

7
  • Can you post the [Xdebug] part of your php.ini or your xdebug.ini? Commented Jun 19, 2014 at 15:26
  • 1) Delete your Settings | PHP | Servers -- you have configured it wrong way. 2) Use this manual -- once debug connection is established IDE will help set it up for you -- confluence.jetbrains.com/display/PhpStorm/… . Another useful link: blog.jetbrains.com/phpstorm/2013/07/… Commented Jun 19, 2014 at 15:34
  • 1) The Settings | PHP | Servers screen has "Validate remote environment" button -- have you tried it before? If you did not -- then ignore for now. For that to work you had to have this set up + configured Deployment entry. The problem with your original "PHP | Servers" entry was "Host" field -- it should be actual host and not URL (in other words it should be just "localhost"). 2) The information you have provided still does not prove that xdebug is enabled (yes, I see that it is installed .. but is it enabled?) Please show the xdebug section of phpinfo(); output Commented Jun 25, 2014 at 19:46
  • 1
    3) Have you seen this? confluence.jetbrains.com/display/PhpStorm/… 4) xdebug.remote_port = 80 -- WTF is this? Why on Earth it is 80? Docs anyone? confluence.jetbrains.com/display/PhpStorm/… Commented Jun 25, 2014 at 19:48
  • @LazyOne : my phpinfo() is in the post under "Update 3" . Commented Jun 26, 2014 at 7:05

4 Answers 4

12
+50

The first thing is that in your php.ini it seems you don't have xdebug installed. So first thing is you should go to Xdebug installation guide and paste here your php.ini file so you will get detailed instructions how to install it.

If you install it correctly you should have something like below in your php.ini file:

xdebug in php.ini

The second thing I think is changing your xdebug port. Although your Apache is working at 80 port, for your xdebug you should have set another port.

In your php.ini you should set for example:

xdebug.remote_port=10000

and of course restart server (I have 9000 port be default be I was getting notification in PhpStorm that this port is busy so I simple changed id to 10000 port).

Now you should go to your PhpStorm settings and choose PHP -> Servers. You should have here your server and port 80 and you should have here "validate remote environment". Click it and in new Window you should have "Validate" button. You should click it to make sure it's fine. You should have here for example your Xdebug information displayed.

Now you should in your PhpStorm go to setting (again) and choose PHP -> Debug. Here you need to have the same port as you set in your php.ini file (10000).

I have the following setting in my PhpStorm in this Debug settings:

phpstorm xdebug

Now I assume you have your project already open and created some breakpoints. You should click icon "Start listen for PHP Debug connections) in your toolbar - 2nd from debug icon in toolbar.

Now you can go to your browser and if you have your plugin installed correctly and you choose debug and refresh your page in browser, you should get info in your PhpStorm to accept connection to debug and you will be able to debug your site.

If you still have problem you should also look at http://www.jetbrains.com/phpstorm/marklets/ - you may use those instead of using browser addon (simple add generated links to your toolbar/favorites in your browser).

What I could also advise you is to look at this PhpStorm xdebug tutorial - it's almost 1 hour but you should be able to learn a lot from it.

Sign up to request clarification or add additional context in comments.

2 Comments

it also a good tutorial for beginners hubpages.com/technology/…
The setting has since been renamed to xdebug.client_port
3

According to your phpinfo() output, you don't have the XDebug plugin loaded (for Apache). So while it may show up when you run PHP from the command line, it doesn't show up for when you access it through Apache.

There is a difference between the mod_php for Apache and the PHP command line. There are different php.ini files for the CLI and Apache versions, so you'll need to find the Apache version and add something like the following at the end:

zend_extension=C:\path\to\xdebug.dll

[xdebug]
xdebug.idekey = "PHPSTORM"
xdebug.remote_enable = 1
xdebug.connect_back = 1

If you need some more information, PhpStorm itself provides a useful getting started guide, and that's available here.

Comments

2

While not specific to PHPStorm, have you looked through [http://xdebug.org/docs/install#debugclient]? It walks you through step-by-step from installation to debugging code. Plus, it's from the xdebug website so it's a credible source.

Starting The Debugger

In order to enable Xdebug's debugger you need to make some configuration settings in php.ini. These settings are xdebug.remote_enable to enable the debugger, xdebug.remote_host and xdebug.remote_port to configure the IP address and port where the debugger should connect to. If you want the debugger to initiate a session when an error situation occurs (php error or exception) then you also need to change the xdebug.remote_mode setting. Allowed values for this setting are "req" (the default) which makes the debugger initiate a session as soon as a script is started, or "jit" when a session should only be initiated on an error.

It's got lots of configuration settings, tips, and general help to get you up and running. It also provides links to several browser interfaces for Xdebug, including (what claims to be) the easiest to use (Firefox), The easiest Xdebug. There's also plugins for Chrome, Safari, and Opera.

Let me know if you need any further help.

Again, may not be specific to your IDE, but it may point you in the right direction,

Comments

0

XDebug should be sending data over port 9000--the default--unless you have something else running on port 9000, and PhpStorm should be set to listen on the same port. This is how they are by default, so just don't change them. Port 80 is for your web server, not for XDebug to communicate w/ PhpStorm. If you have it on port 80, your web server is already there and XDebug won't be able to communicate with PhpStorm.

You need to change this in your PhpStorm settings and maybe in XDebug configuration if you modified that.

2 Comments

I don't think it's true. You don't need to change it in bookmarks, because they just simple set cookie: javascript:(/**%20@version%200.5.2%20*/function()%20{document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';})()
@MarcinNabiałek, ah, yep, you're right about the cookie. I just tested XDebug generation. You only need to specify the port for Zend Debugger cookies. I guess you would need to configure it in XDebug itself then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.