How to run and debug PHP code

A similar question was asked with regard to the 9.x beta.  Apparently, you can simply open the php file and start debugging.  

But it's not clear whether to start as a Java module, or what.

20 comments

Hi,

Currently you can run/debug PHP file in module of any type in IDEA (including Java).

Did you try PhpStorm instead of IDEA?

0

>>Currently you can run/debug PHP file in module of any type in IDEA (including Java).<<

Ah, ok.  So it's just a matter of creating a standard project, and then opening up the .php file directly.  


>>Did you try PhpStorm instead of IDEA?<<

I thought about it, but figured that the Intellij IDEA 9.x features are probably a superset of the PhpStorm features, so it wouldn't be necessary.  Am I correct on that?


Anyway, thanks for the tip.



Regards,


0
I thought about it, but figured that the Intellij IDEA 9.x features are probably a superset of the PhpStorm features, so it wouldn't be necessary.  Am I correct on that?

Exactly.

0

I was mistaken.  I tried Intellj IDEA with some PHP code, and found it found it confusing to set up.  But when I attempted a similar project in phpStorm, it was really easy.

I'll continue using IDEA for Java projects, but will purchase phpStorm (when the official version comes out) for dealing with Php & JavaScript.





Regards,

0

I can't get PHP debugging with xdebug to hook up at all in phpstorm, first with build 335,  now with build 430. My host setup is xampp. I've gone thru the process carefully. When run debug, the localhost site starts up with http://localhost/?XDEBUG_SESSION_START=WebIDE1 , and the debug window says "Waiting for connection on port 9000 with ide key 'WebIDE1', but it never hits a breakpoint, nor will it stop on 1st line. Not sure what to try next. Suggestions?

0

In your page displayed in browser (as if you were just running)?

Please double-check XDebug setup, especially xdebug.remoteXXX settings in php.ini.
What if you check the 'Stop at first line' checkbox, does it break anywhere?

0

>In your page displayed in browser  (as if you were just running)?

Yes.

>Please double-check XDebug setup,  especially xdebug.remoteXXX settings in php.ini.

Yup, did that.

>What if you check the 'Stop at first  line' checkbox, does it break anywhere?

Nope.

Sorry to be so vague, I'm just stumped. Throwing out ideas: is it possible a certain version of xdebug is required?

0

Well, we've tested most with XDebug 2.0.x.

Please attach XDebug log (configured by xdebug.remote_log setting in php.ini).

0

Kirill tries to tell you that IDEA will receive exactly same features after development will be complete. They actually even already available through IDEA EAP, but by no means can be discovered in current IDEA release because they are still under development.

0

Ok, thanks Alexey, looking forward to the new features when they arrive.


Regards,

0

I haven't had a chance to get back to this till now. Here's a log from a debug run, with break on first line set:

Log opened at 2010-03-02 23:56:17
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/Program%20Files/xampp/htdocs/index.php" language="PHP" protocol_version="1.0" appid="4908" idekey="WebIDE1"><engine version="2.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2008 by Derick Rethans]]></copyright></init>

<- feature_get -i 37 -n supports_async
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="37" feature_name="supports_async" supported="1"><![CDATA[0]]></response>

<- feature_get -i 38 -n breakpoint_types
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="38" feature_name="breakpoint_types" supported="1"><![CDATA[line call return]]></response>

<- feature_set -i 39 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="39" feature="show_hidden" success="1"></response>

<- stdout -i 40 -c 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="40" success="0"></response>

<- stderr -i 41 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stderr" transaction_id="41" success="0"></response>

<- feature_get -i 42 -n encoding
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="42" feature_name="encoding" supported="1"><![CDATA[iso-8859-1]]></response>

<- feature_set -i 43 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="43" feature="max_children" success="1"></response>

<- feature_set -i 44 -n max_data -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="44" feature="max_data" success="1"></response>

<- feature_set -i 45 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="45" feature="max_depth" success="1"></response>

<- eval -i 46 -- cGhwX3VuYW1lKCJzIik=
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="46"><property address="108395272" type="string" size="10" encoding="base64"><![CDATA[V2luZG93cyBOVA==]]></property></response>

<- step_into -i 47
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="47" status="stopping" reason="ok"></response>

<- detach -i 48
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="detach" transaction_id="48" status="stopped" reason="ok"></response>

Log closed at 2010-03-02 23:56:24

Here's my debug config values:

debug.PNG

0

Hi Gary,

Logs show that Xdebug immediately stops execution on the first 'step into' command from the IDE. (I assume your index.php file is not an empty one). Let me try Xdebug 2.0.4 myself to figure out why. If possible, please try Xdebug 2.0.5 with the same setup (it has several bugs fixed since 2.0.4).

BTW when you use the locally installed web server, you don't need to specify debug mappings at all. If your server were on another machine, you'd have to map your project path to the local path on the server's machine filesystem, i.e. c:\MyProject <-> /opt/xampp/htdocs. PHP variables such as __DIR__ are not expected there. We'll provide more clear UI soon.

--
  Kirill

0

So as usual this opened a whole can of worms. My current version of apache threw an exception when I tried to use xdebug 2.0.5. So I upgraded my entire install of xampp to the current version, which took me to xdebug 2.0.6, and php 5.3.1 which broke joomla. So I had to upgrade that. Anyway, at the end of all this, phpstorm will now catch php breakpoints! Thanks for your help.

0
My current version of apache threw an exception when I tried to use xdebug 2.0.5

You may be affected by http://bugs.xdebug.org/view.php?id=410.

0

One feature that IDEA has that PhpStorm does not is the ability to run an ant target before launch.  This feature allows me to run compression tools to compress javascript and css files before launch.  I can't figure out how to get similar functionality in PhpStorm.  So although it's strange to have to create a java module for a php application, IDEA does have an advantage over PhpStorm.

0

IDEA is and always will be our most powerful, "all-in-one" product. We will not add explicit Ant support to PhpStorm but plan to add ability to run external tools on deployment.

0

neuro159 schrieb:

IDEA is and always will be our most powerful, "all-in-one" product. We will not add explicit Ant support to PhpStorm but plan to add ability to run external tools on deployment.


I am interested about the time frame for PHP and Python project support inside the full IDEA Ultimate. Is there already a roadmap available?
Will it come as a free update for the 9.x line or will it be an IDEA 10 feature?

0

9.0.x series share codebase with PhpStorm 1.0 and get same PHP and Deployment plugins.
I can't comment on Python plans but I fount this info on latest PyCharm EAP blogs.jetbrains.com/pycharm/2010/03/pycharm-build-96-18-is-available/#comment-51

0

Hello Piero,

The Python plugin is available as a free download for users of IDEA 9 Ultimate.
We do not currently have any plans to bundle it with IntelliJ IDEA.

I am interested about the time frame for PHP and Python project
support inside the full IDEA Ultimate. Is there already a roadmap
available?

Will it come as a free update for the 9.x line or will it be an IDEA
10 feature?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.