First things first:
Server is an Apache running on Debian in a VMPlayer
Host is Windows 7
Debugging-Server is XDebug
Files are directly accessible via a shared folder
Important: XDebug is properly configured on Apache and my Win7 firewall as well. I know that b/c I can debug using Eclipse.
So what I am failing at seems to be the basic configuration of PHPStorm.
Let me give you some more details:
IP of Server: 192.168.56.128
IP of my host: 192.168.56.1
the file that I want to debug is index.php:
location on my Win7 host: C:\dev\sf\Symfony\
location on Debian: \mnt\hgfs\sf\Symfony\
URL: 192.168.56.128/Symfony/index.php
No matter what I fiddle together ... I get weired error messages like "Waiting for connection from JetBrains PhpStorm..." or PHPStorm asks me for Mozillas profile.ini, even though I configured Chrome as Default in Web Browsers.
So I will just set up a new project and hopefully someone tells me what is wrong with my configuration.
Run / Edit configurations / Defaults / PHP Remote Debugging:
Server: "Debian"
IDE key: -
Break at first line: yes
Servers:
Name: "Debian"
Host: 192.168.56.128
Port: 80
Debugger: Xdebug
use path mappings: yes
one path mapping configured:
C:\dev\sf\Symfony => /mnt/hgfs/sf/Symfony (also tried /Symfony - b/c PHPStorm shouldn't care about anything above /Symfony !?)
Run / Edit configurations / Defaults / PHP Web Application:
Server: "Debian"
Start URL: /Symfony
Browser: Chrome
Break on first line: yes
Now I choose: Run / Debug ... / 1.index.php
And I get asked for: Mozilla's profile.ini ... but I can't find it
Where is it ... ?
I already got so far that PHPStorm started Chrome. But maybe I first sort this out. So how can I get Firefox up and running? I also use Firefox with Eclipse ... no questions asked for a profile.ini.
Okay, there are three things I'd like to share with you. It's not the full recipe but the key ingredients that were first confusing me are:
The important sections to configure are "Servers" and "PHP Remote Debugging".
To configure "PHP Remote Debugging" you have to first add a new dataset using the [+] in the top left corner. The panel you get from just clicking on the "PHP R D"-button just keeps the default settings!
Absolute path regarding the VM actually means the absolute path starting from root (\mnt\hgfs\sf\Symfony). This was confusing to me cause I am still not sure why PhpStorm cares about directory levels above the shared folder. but it does.
If you are still having problems, there are two blog posts by the makers on how to set things up correctly.
First should work in most cases and requires zero-configuration other than a working xdebug install
Second details all of the configuration settings in detail
To 'see' the profile.ini in the PHP Storm 'Select File' Dialog simply rightclick inside of it and choose 'Show hidden files' then (in WIn7) move to C:\Users\YOURUSERNAME\AppData\Roaming\Mozilla\Firefox or the equivalent in your OS
Ensure that remote debugging is enabled in php.ini
xdebug.remote_enable = 1
Your server "192.168.56.128" should be in PHP-> Servers
Add PHP Web Application Debug Configuration, and use added server
Set a breakpoint and start debugging using this configuration
Related
Trying to set up XDebug with PhpStorm. I installed and configured it following this guide:
https://jtreminio.com/2012/07/xdebug-and-you-why-you-should-be-using-a-real-debugger/
At the moment it looks like that. I start a session, PhpStorm ask or asked me what connection to listen. There was just one file to select. app_dev.php (It's the index from Symfony) so I selected it. Wondering why there is just one file. Now I can only debug this only file. Everythign else doesn't work. Later, the pop up came again and I selected the project folder, but still. I can just debug the app_dev.php file. What is wrong with my settings?
I also heard, I can make the debugging without having to set the session, is this true? VIa xdebug.remote_autosrat = 1?
Xdebug php info: http://pastebin.com/LQGY7t0E
Xdebug php.ini settings: http://pastebin.com/8WjKWDZk
The settings in phpstorm are like this https://jtreminio.com/assets/posts/2012-07-05_xdebug-and-you-why-you-should-be-using-a-real-debugger/phpstorm.php_.debug_.png but I do have a external connection settings because i have anewer version. (I guess). Leave it as default.
I'm using ubuntu instaleld on a VM. I'm on Win7. I created a network map to Z: and connected with phpstorm to Z:
So, any hints on how a I can get it working?
I've searched a lot for this problem when debugging php using PhpStorm with xdebug, I found 3 or 4 links discussing this problem, but none of them are useful.My Xdebug's version is 2.2.3, and PhpStorm'version is 6.03. I could debug every line step by step except this one
$this->link = mysql_connect($this->dbserver, $this->dbuser, $this->dbpass);
PhpStorm shows this error:Waiting for incoming connection with ide key "14841".
Here are my xdebug configuration:
zend_extension="/usr/lib/xdebug.so"
xdebug.remote_autostart=1
xdebug.show_local_vars=1
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.dump.SERVER=*
xdebug.auto_trace=On
; default trace output directory /tmp
xdebug.collect_vars = On
xdebug.trace_output_dir=/tmp
xdebug.collect_params=4
xdebug.collect_return=On
xdebug.profiler_enable=Off
; default trace output directory /tmp
;xdebug.profiler_output_dir=/tmp
;xdebug.profiler_enable_trigger=On
;test.php?XDEBUG_PROFILE
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
xdebug.remote_log = "/tmp"
xdebug.remote_connect_back=1
xdebug.idekey=PHPStorm
I add these lines " xdebug.remote_connect_back=1
xdebug.idekey=PHPStorm ", also resisted ide ,it is still the same
i assure that the three parameters are correct.
For me, the debugger never connected and I saw the Waiting for incoming connection with ide key message because I set set my Server configuration to port 9000. This should be set to port 80 (or whatever other port the webserver is listening to! This was confusing to me because it's right next to the Debugger dropdown and I figured it was to set the Xdebug port.
The Debug port is configured in Settings->Languagues & Frameworks->PHP->Debug. Set this to 9000 or whatever you configured php.ini to be.
Just a note, I was using IntelliJ IDEA, but it's all the jetbrains platform.
You wrote:
PhpStorm shows this error:Waiting for incoming connection with ide key "14841".
But you use:
xdebug.idekey=PHPStorm
Those ide keys need to match. PHP Storm is a bit funny about it.
But then you also said:
I could debug every line step by step except this one
$this->link = mysql_connect($this->dbserver, $this->dbuser, $this->dbpass);
How are they different? Is there different behaviour, or just doesn't it stop?
I had a similar issue. In my case it was caused by misunderstanding PHPStorm/IntelliJ PHP debugging modes. There are two modes:
"Local" PHP debugging
"Remote" PHP debugging
When you use the "local" debugging, IDE key is autogenerated
This means, that primitive bookmarklets, created at http://www.jetbrains.com/phpstorm/marklets/ will not work in local mode: the bookmarklet contains a hardcoded IDE key, but PHPStorm will generate a random one!
The solution is to enable "Remote" PHP debugging mode (it is currently called "PHP Remote Debug") in "Run/Debug Configurations" and set the IDE key in the right pane of the create launch configuration.
"DBGp proxy" in global settings is probably not what you want; create a "Remote" debug config and set the IDE key there.
I was having a similar issue in a local installation.
I fixed it by unselecting the setting: Use Path Mappings
Found under the Settings > Languages & Frameworks > PHP > Servers
I have been trying to set up remote (virtual box server) debugging with phpstorm. When I press the debug button phpstorm just waits indefinitely for a connection. I've been looking for a solution for a couple days, and cannot get any varying results.
These are my phpstorm settings:
Host: mywebsite.dev
Port: 9000
Debugger: Xdebug
pathmapping: /public <--> /index.php
These are my xdebug params in php.ini
xdebug.remote_enable=on
xdebug.remote_autostart=off
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=on
xdebug.remote_port=9000
xdebug.default_enable=on
xdebug.remote_mode=req
xdebug.remote_log=/var/log/xdebug/xdebug.log
Please let me know if you need anymore information. Thanks in advance!
This tutorial worked for me in Ubuntu
http://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide
I notice your php.ini looks a bit different. Here is mine :
[Xdebug]
zend_extension=<full_path_to_xdebug_extension>
xdebug.remote_enable=1
xdebug.remote_host=<the host where PhpStorm is running (relative to your site!)>
xdebug.remote_port=9000
And that was it.
Answering an old post for the heck of it...
You also need to edit you 20-xdebug.ini file
sudo nano /etc/php5/conf.d/20-xdebug.ini
The line zend_extension=xdebug.so should already be there. Add the following lines :
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.scream=0
xdebug.cli_color=1
xdebug.show_local_vars=1
There might be path mapping issues as well.
If you go in run|web server debug validation … do you get error messages ? If so, that’s a clue to what you still need to solve.
You also have to set the key to your xdebug extension in your browser.
I'm working through a test GAE Java project which was working fine but I decided to look at adding GWT to the same project. I then decided to stick with the GAE stuff I was learning and decided to remove GWT. The problem is I can't now deploy to the development server as it gives the following in the Eclipse console pane. Anyone know please how I can reset appropriate settings to how my project had them originally?
terminated test [Web Application] C:\Program
Files\Java\jdk1.6.0_37\bin\javaw.exe Usage:
[options]
Options: --help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest -s SERVER SDK version. --address=ADDRESS The address of the interface on the local machine -a ADDRESS
to bind to (or 0.0.0.0 for all interfaces). --port=PORT
The port number to bind to on the local machine. -p PORT
--sdk_root=DIR Overrides where the SDK is located. --disable_update_check Disable the check for newer SDK versions. --generated_dir=DIR Set the directory where generated files are created. --jvm_flag=FLAG Pass FLAG as a JVM argument. May
be repeated to
supply multiple flags.
I seem to have found my own answer through setting up a new dummy gae project and having a poke around, found that the 'Run As' > 'Run Configurations...' > '(x)= Arguments' > 'Program arguments' had an additional port defined prior to the rest of the argument beginning '--port=8888'. I removed the mention of '-codeServerPort 9997 ' and it now deploys to dev server and appears to be working as before.
eg
new dummy project: --port=8888 "C:\Users\tech1\SSD Storage\Eclipse Projects\workspace\dummy\war"
project that wouldn't deploy to dev server: -codeServerPort 9997 --port=8888 "C:\Users\tech1\SSD Storage\Eclipse Projects\workspace\test\war"
I faced the same issue and you know what, Workaround is just pretty simple.
I created one new appengine project with only one jsp in WAR and 'Run As' > 'Run Configurations...' >Server Tab -> Unchecked then checked Run Built-In server and then checked Automatically select any port.
Server started ..on some fishy 25334 port..i stopped that using red button on Console Terminal.
then i changed it back to 8888 and WHOA project Ran.... :)
Then i did the same with old project. deleted this new one and all is working as expected.
Up until recently, I've been writing code in PHP (via Notepad++) and debugging by checking the logs in IIS (gotta love that web-platform installer); I've since decided to update to a more efficient code-writing / testing environment, and after playing around for several moments with PHPStorm, decided to purchase it and give it a try. Since then, I have realized that in so far as tutorials and walk-throughs are concerned, PHPStorm is coming up a little short. Having given the manual a glance (RTFM, I know), and come up wanting, I'd like to ask if anyone out there would like to hand hold me through setting up PHPStorm with XDebug so I can stop hating myself for not studying the underlying systems well enough, and get back to coding.
TLDR; Could someone post a detailed walk-through for setting up PHPStorm + XDebug? Assume maximum level of stupidity on my part (I"m usually more than capable in the ASP.NET world, but I am approaching the intelligence level usually associated with some forms of sea-faring sponge in the PHP world).
The environment is Windows 7 Ultimate (64-bit) with IIS & PHP installed.
I've found a more modern and easier solution partially based on CrasyCoder's post.
The steps you need to do are the following:
If your brand new php installation doesn't contain php.ini, rename the php.ini-development to php.ini
Install xdebug with help of the wizard: http://xdebug.org/wizard.php Follow its recommendations literally.
Put in your php.ini the string: xdebug.remote_enable=1
Go to PhpStorm's settings: settings->php. Select or reselect directory containing php. Make sure you see 'Debugger: Xdebug x.x.x' string (where x.x.x stands for installed version)
Install an extension for your favorite browser from here: http://xdebug.org/docs/remote
From the main menu (not the settings window) go to 'Run->Edit configurations' and add new 'PHP Built-in Web Server' configuration. Point the 'Document root' to your project's directory. Note the port number.
Chrome browser: enable the extension pressing on the little bug in the rightmost side of the omnibox and selecting the Debug option. Other browsers' extensions should work similarly.
In PhpStorm's menu enable the 'Run -> Start Listen for PHP Debug connections' option.
Set a breakpoint in your code in PhpStorm.
Run (not debug) the configuration you created in step 6.
In your browser go to localhost:port where 'port' is the port from step 6. Your PhpStorm should stop on the breakpoint and you can start squashing bugs in your code.
Considering that:
Steps 1-5 are made once per php installation.
Step 6 is made once per PhpStorm project.
Steps 7-8 are made once per debuggin session.
Steps 9-11 are made each program run.
It's really simple to get Xdebug working with PhpStorm, just follow this guide carefully. (NOTE: Updated version of the guide is here)
For more advanced topics read this.
1. install xdebug module (MAC installation steps)
1.1.1. check what PHP version u r using php --ini (see the loaded file)
1.1.2. brew search xdebug
1.1.3. brew install phpXX-xdebug
1.1.4. see details: php -i | grep xdebug
1.2. restart server
1.3. configuration
1.3.1. sudo find /usr -name 'xdebug.so'
1.3.2. copy the path of the exact one you need
example: /usr/local/Cellar/php56-xdebug/2.3.2/xdebug.so
1.3.3. edit the extension related configuration file which should be injected to the main php.ini automatically:
subl /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini
1.3.4. add the zend_extension to be = the path copied above
[xdebug]
zend_extension="/usr/local/Cellar/php56-xdebug/2.3.2/xdebug.so"
Normal file should have something like this:
[xdebug]
zend_extension="/usr/local/Cellar/php56/5.6.4/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp"
xdebug.idekey=PHPSTORM
2. check your PHP version
php --ini
3. setup the IDE settings
preference > languages and framework > PHP >
3.1. set the language level to the correct PHP version of this project
3.2. set an interpreter (set the parent directory of where the bin directory of PHP executable is loaded)
3.2.1. click the … button > click the + button > other local > set PHP Excitable path,
to find the path type in the terminal: $ which php
example: /usr/local/Cellar/php56/5.6.5/bin/php
4. restart phpstorm
5. now let’s make it work
5.1. run > edit configuration > click the green + button on the left > select b. php web application
5.2. name: anything example ur {application name - debugger}
5.3. server: localhost (browse > + > name: whatever | host: localhost or 127.0.0.1)
5.4. click ok
5.5. start url: the link of ur project homepage: http://127.0.0.1:80/SomethingNew/
5.6. click ok
6. now set the break point and click debug
I had quite some troubles when I touched XDebug remote debugging the first time yesterday.
A few general hints, you are overflown with various tutorials and guides anyway.
Your XDebug configuration on PHP/Aache side:
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back=1
You need to either use remote_connect_back as given above (be careful, this means other people can debug your server too while it is enabled) or you specify your IP address (remote_host).
On Client Side you need to have your router forward the Port 9000 !
You need to allow PHPStorm for incoming connections in your Firewall (was not enabled by default on Windows 8 for me). Either open Port 9000 or the app itself.
On PHPStorm make sure to go into Debug configuration and not use the default debug (PHPUnit!) Use "PHP remote debug" (Run/Debug Configurations -> The PLUS sign on upper left)
You will need to tell PHPStorm the absolute path of your project on the webserver, if you make an error here (and forget that) you will get a prompt anyway.
Now Debug your project in PHPStorm while having "Listen for connections" enabled and put a breakpoint into your code.
With your webbrowser open your website/php file while having a cookie enabled that starts the debugger. (cookie is the best approach in most cases). You can use a bookmark (google for phpstorm debugging bookmark) or an extension.
Even following the guides, I missed several of the above points. I hope I could save some hours of struggling :)
If you don't need remote debug, you can easily debug your project.
First check your php.ini settings.
Be sure that your xdebug dll exists and the settings are on.
xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.show_local_vars=0
Then go to Run menu in top navbar. Then select edit configurations and add new configuration ( do not change your default settings for another project )
Click add new item button.
After adding new php web application
If you do not have any server ( generally points the localhost with 80 port on windows or linux ) click the button shown as below.
Add a new server with xdebug.
Then click ok and check your configuration
Finally, you will see the configuration at the right side of ide.
Click RUN or DEBUG button.
install xdebug on your local PHP - actually update your php v with xdebug included:
https://floyk.com/en/post/how-to-update-php-version-on-your-macbook-macos-sierra
setup your xdebug.ini
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=off
xdebug.remote_port=9000
xdebug.remote_host=localhost
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_name=xdebug-profile-cachegrind.out-%H-%R
xdebug.var_display_max_children = 128
xdebug.var_display_max_data = 512
xdebug.var_display_max_depth = 3
xdebug.remote_enable = 1
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
xdebug.file_link_format = phpstorm://open?%f:%l
Install Xdebug helper to your Chrome browser:
Install Xdebug helper
in your PhpStorm go to Settings/Preferences->Languages & Frameworks->PHP->Debug
Update your Automatically detect IDE IP if needed, and press OK
You are done.
More detailed "step by step" guide you can find here:
https://floyk.com/en/post/how-install-php-with-xdebug-on-mac-os