How to configure PHPStorm to work with WAMPServer?

Hey guys!

I'm a complete newbie to IntelliJ PHPStorm (big fan of IDEA though during my time with Java dev) and I'm rather new to PHP. So I've installed WAMPServer 2.2 and managed to get it configured to work properly. That's to say if I go to localhost:8080 on my browser it loads up WAMPServer.

Next I installed PHPStorm 3.0.1, created a new project, added a php file (index.php) and added the following code:

     echo "Hello World!";

Next I went to Settings > PHP and created a new Interpreter (clicked on "..." button and then the "+" button. I set the PHP Home path to the one in wamp (C:\wamp\bin\php\php5.3.9). After that I went to Settings > PHP > Servers and set the host to "localhost", port to "8080" and debugger to "Xdebug".

Next I right-clicked on hello.php and selected Run "hello.php". I was hoping it would open in the browser but it just showed the following in the Run pane of PHPStorm:

    Hello World!</body>

So this brings me to question 1, how can I make it run on a browser?

When I right-clicked on the root folder of the project in the Project pane and hovered over the Run item in the menu, i noticed an item called Hello World on WAMPServer. After selecting this I made the following changes in Deployment under Run Configuration:

     Type: Local or mounted folder
     Folder: C:\wamp\www\HelloWorld
     Web server root URL: http://localhost:8080

     Local path: F:\PHP Projects\Hello World
     Deployment path on server: /
     Web path on server: Hello

And this time when I ran it I got the folllowing error:

Unable to attach test reporter to test framework or test framework quit unexpectedly

So question 2, why does that appear?

Also I made the following changes to php.ini:

zend_extension = c:\wamp\bin\php\php5.3.9\zend_ext\php_xdebug-2.1.2-5.3-vc9.dll

xdebug.remote_enable = 1
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = c:\wamp\tmp

Guys i'll appreciate all help I could get for this. I've been struggling with this for almost 2 days.

Thanks in advance!

Comment actions Permalink

Hi Ruzaik,

By clicking "Run" button (wherever you clicked it) you have created "PHP Script" type of Run/Debug configuration, which executes local PHP script in a console -- and the result you see is absolutely correct -- it's working!

Instead of "PHP Script" configuration type you need to create "PHP Web Application" -- check "Run | Edit Configurations" or via dropdown box on main toolbar (next to Run & Debug buttons). You can also utilize "View | Web Preview..." or "View | Open in Browser ..." -- depends on configuration/situation (in this case no Run Configuration is created at all).

Comment actions Permalink

Thanks a lot Andriy! That helped me out loads :)

I removed the PHP Script and PHPUnit configurations, created a PHP Web Application configuration, selected the upload files before launch option and it worked fine.

Now I'm dancing around with the debugging bit.

I created a PHP Remote Debug configuration, set the server to WAMP, Ide key = jphp and selected the upload files before launch option.
Next i went to Settings > PHP > Debug > Xdebug Proxy and set the following:

IDE key: jphp

Host: localhost

Port: 9000

I also set the Xdebug Debug port in Settings > PHP > Debug to 9000.

I added the following line to php.ini:

xdebug.idekey = jphp

So I selected the PHP Remote Debug configuration I created from the toolbar (next to the run button) and then clicked on the Debug button on the toolbar. The file transfers properly but nothing happens after that. When I checked the Debugger tab in the Debug pane I saw the following message under Variables:

Waiting for incoming connection with ide key 'jphp'

Have I missed a setting or configuration?

Comment actions Permalink

check your xdebug settings with phpinfo()

did you configure your paths for xdebug?

Edit config -> PHP Remote Debug -> <your config> -> Servers -> ... -> [x] Use path mappings

Comment actions Permalink

I very doubt that you need xdebug proxy -- it's a different thing and requires you to run the actual proxy (special script/program) which you are not running (based on your description). Plus -- you have configured it incorrectly. Don't use it unless you know for sure what that is for.

I would suggest reading and following these articles (in case you have not done it already) -- they have enough step-by-step instructions (text and illustrations) to have it working:

"PHP Remote Debug" configuration requires you to initiate the debugging session by using bookmarklet, some browser extension or by adding that xdebug cookie (or query string parameter) manually to the URL. You better use "PHP Web Application" if you want to initiate full debug session (not just start xdebug listener) from within IDE.

Comment actions Permalink

In phpinfo i noticed that sdebug.remote_enable is set to off and the local value for xdebug.uidekey is the name of my machine with a $ sign at the end (i.e LAPTOP$) while there is no master value

I didn't use path mapping at first but after i did set the path mappings i got the following message under variables

Waiting for incoming connection with ide key 'jphp'

I have attached images of my debug configuration and path mappings so that anyone could point out any mistakes in it.

Comment actions Permalink

i had already read Intalling Xdebug extension and Zero-Configuration debugging with PhpStorm 2.0. Thats how I learned of the xdebug settings in php.ini but I did have a few problems following the latter. For example,

      1. When i click the xdebug Start session bookmarklet, do I know the debugger has started?
      2. How do I get the Incomming Debugger Connection window?
Comment actions Permalink

I think mappings are wrong.

That supposed to be physical file path and not the URL. Try without mappings first or (most likely) use that path that you have for deployment. Setting path mapping for F:\PHP Projects\Hello World should be enough -- no need to specify path for index.php as well, as long as it is not located on completely different place.

Comment actions Permalink

1. Bookmarklet just sets the xdebug cookie -- it does not start debugger itself. When you request that page again (or any other page on that domain) in browse, cookie will be sent, xdebug will see it and will attempt to connect to PhpStorm. If connection succeeds, you will see debug interface.

2. (I hope I understood this correctly) It will appear automatically if :

  • You use Debug button for "PHP Web Application" or "PHP Remote Debug" configuration type
  • You have used "Run | Start Listen PHP Debug Connections" and requested the page in a browser after using bookmarklet, that tool window will popup in PhpStorm after IDE will receive xdebug connection.
Comment actions Permalink

I tried setting the mapping to C:\wamp\www\HelloWorld (i hope this is what you meant) but I'm still getting the same message. It's the same if i remove the mappings too

Comment actions Permalink

I thought it should appear automatically too but nothing popped up. I also tried debugging with both PHP Web Application and PHP Remote Debugger but in both cases it says it's waiting for the incoming connection with the ide key. I did notice something though; when i used the PHP Web Application configurations the ide key is always different where as with the PHP Remote Debugger configuration it's the one i specified in the configurations. I'm not sure whethr that's relevant though...

Comment actions Permalink
when i used the PHP Web Application configurations the ide key is always different where as with the PHP Remote Debugger configuration it's the one i specified in the configurations. I'm not sure whethr that's relevant though...

That's exactly what I have described previously:

  • When using Debug on "PHP Web Application" configuration, the debug session will be established straight away (xdebug parameter set + url opened in browser)
  • When using Debug on "PHP Remote Debugger" configuration, it's YOU who need innitiate xdebug session (PhpStorm only starts listening for xdebug connection) -- that's why you need to provide IDE key yourself.
Comment actions Permalink
I tried setting the mapping to C:\wamp\www\HelloWorld (i hope this is what you meant)

What's exactly what I meant.

Please try with firewall disabled -- it's possible that PhpStorm is blocked from accepting incoming xdebug connections. Please also check that xdebug ports are the same in PhpStorm & xdebug config in php.ini.

To check if xdebug is configured properly -- you can try using "PHP Script" configuration -- this will execute this script in console. If xdebug & PhpStorm are configured properly, then you should see debug connection established straight away (make sure that you setup breakpoints). If still nothing -- the you have misconfiguration -- most likely on xdebug side (php.ini).

I highly recommend showing your xdebug config settings (from php.ini as well as from <?php phpinfo(); ?>)

Except the above I can only suggest create brand new project in the same folder where website is located (e.g. C:\wamp\www\HelloWorld -- use File | Open Directory). This will reset all project settings to defaults (in case if you have done some wrong configuring in IDE, it will start from fresh) as well as remove possible path mapping issue (at least, it should). Then -- follow manual -- this much easier that trying to fix current situation (at least from my point of view where I see no).

Comment actions Permalink

an example:

Server: localhost
Browser: Chrome with XDebug_Helper Extension
PhpStorm: 3.0.2
Xampp from
Path to content: D:\xampp\htdocs\ext4

i enabled xdebug php module in php.ini:

zend_extension = "D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"

i reloaded apache and verified these settings with phpinfo()

configured xdebug_helper:in chrome (extension -> xdebug_helper -> Options)
IDE key: phpstorm
Domains: add -> localhost

phpstorm config:
Run -> Edit Configuration -> [+] -> PHP Remote Debug
Name: xdebug
Servers -> ... -> [+]
  Name: xdebug test
  Host: localhost
  Port: 80
  Debugger Xdebug
  No Path mappings needed because the files from webserver directory and the one i use in phpstorm are the same
  (same path for serverfiles and work files D:\xampp\htdocs\ext4. i think you need to map your files to F:\PHP Projects\Hello World)
Ok -> Ide Key (session id): phpstorm -> Ok

i prepared a small index.php with the following content:

print "hello";

and set a breakpoint on the phpinfo(); line (red dot)

now i load the page in Chrome and enable the xdebug_helper icon in the browser URL bar (right hand side). click it until its green. If its missing, you did forgot to add your domain to xdebug_helper

now i can start the debug session in phpstorm and it starts to listen for incomming connections.
after a reload of the page in chrome (green icon) the debugger should connect and stop on the breakpoint on phpinfo() line

tried this with PHP Web Application also.
i choosed the same Server config i created before.
set my start URL to /ext4/index.php because my index.php is available on http://localhost/ext4/index.php
i tried Internet Explorer and Chrome as Browsers.
Both work and break on Breakpoint after starting Debug from within phpstorm

Comment actions Permalink

I still get the message in PHPStorm saying its waiting for the ide key 'jphp'. I've set this is the xdebug enable extention for chrome too

Comment actions Permalink

do you see the small bug icon in your browser input bar?
if not: add your domain to the plugin

if yes:
is it green?
if not: click it until its green

if its green:
reload page

if its still not connecting to your phpstorm
hm . can you post xdebug settings from phpinfo()?

Comment actions Permalink

Most likely you are missing some simple detail somewhere in configuiration (php.ini .. or somewhere else).

I really recommend to provide a lot of screenshots with your settings .. or maybe record some screencast (where you show all of that) using or similar tool.

Comment actions Permalink

Thanks Ruzaik R, for being so verbose in recounting your steps. Thanks to you, I was able to set up everything, until I ran in exactly the same problem that you did.
Turns out that, for me, there's more than one php.ini on WAMP. After I changed the xdebug settings in php.ini in the Apache directory, everything worked like a charm :)

Thanks for the help everyone!

Comment actions Permalink

Thanks Dennis! That indeed did fix up the problem :^O

Thanks to Andriy and Benjamin too for all their help!


Please sign in to leave a comment.