Just a little guidance

I'm trialing PhpStorm at the moment but just little a little guidance with the following.

1) HTML and PHP editing is ignoring my request for 'smart indenting'. When I type, for example
    print "this";

the cursor jumps to the far left margin. What combination of settings will cause it to align
with the 'p' of print?

2) How can I configure the ide to display PHP help? I get a list of keywords and parameters
but Ctrl-Shift-I or Ctrl Q, Shift-F1, do nothing. I don't mind if it jumps to the internet for help
with the selected command/keyword.

Thanks, Andy.

For 1) I've set File/ Settings/ Code Style/ PHP/ "Indent code in PHP tags"; and
File/ Settings/ Editor/ Smart Keys/ Enter/ Smart indent.

0
25 comments
Avatar
Permanently deleted user

For #1 could you explain the key strokes you use to achive this.

#2. Within the function you want to lookup press Ctrl+Q

str_repace  <- Anywhere with the cursor inside that word.

0
Avatar
Permanently deleted user

Hello Jeff.

<?php
/** template comments */
     print "pressed tab to get here, new enter";

I just press Enter after the semi-colon and it jumps to the far left.
I just noticed that if I indent the <?php then it aligns with this, but this is not the required behaviour.

Similarly, typing
     <p>Within an HMTL file, follow this with enter</p>
<!-- it also aligns to the left -->

Ctrl-Q still does nothing for me.

0
Avatar
Permanently deleted user

Hello again.

Counter-intuitively, I turned OFF smart indent, and PHP indenting, and it now seems to be behaving.

Occasionally Ctrl-Shift-I and Ctrl-Q pops up with a box, but they are only looking for info within the current
file or project. How can I display PHP help for functions and methods? Do I need to add a 'resource' or
help library api somehow pl.?

Andy.

0
Avatar
Permanently deleted user

Do you have PHP installed on your machine and the path setup for it in phpStorm?
Settings -> PHP should have include paths for PHP and (Pear if installed)

Also you do have phpStorm and not WebStorm, right?

0
Avatar
Permanently deleted user

Hello Jeff.

Yes, PhpStorm ;)

My Php 'Home' setting is: C:\wamp\bin\php\php5.3.8

When I click Update include paths it lists a warning that
'Local item 'C:\php\pear' not found, but I don't have Pear installed anyway.

But I didn't think that include paths related to the help system?

I haven't installeld XDebug or Zend. Are these relevant for Help text?

Andy.

0

Hi Andrew,

Ctrl-Q still does nothing for me.

Occasionally Ctrl-Shift-I and Ctrl-Q pops up with a box


1) It's definitely works. Possibly your file (extension) is not associated with PHP in PhpStorm (File | Settings | File Types) -- it has to be in order to have a code completion/hints for PHP functions.

2) There is no help (internal or external) for php keywords / instructions (e.g. for, while, empty() etc) -- only for functions/methods/classes/constants. All such "help" is taken from stub files (bundled -- standard php function/classes/etc) or your source files.

3) If Ctrl+Q works -- then Ctrl+F1 (external help/link) should work also (if PHPDoc block has external link @link -- true for almost all php built in functions and quite a few extensions).


I recommend testing all this  in some test.php file -- this may help you find out why it does not work (BTW -- have you tried "File | Invalidate Caches..." ?). It may be a good idea to provide some simple example (whole file) where Ctrl+Q does not work for you (maybe you invoking it incorrectly somehow .. or maybe it's actually a bug -- dunno.

0
Avatar
Permanently deleted user

Hello and thank you Andriy.

I was looking at print and echo but I suppose these are considered keywords rather than functions, Doh!

Ctrl Q provides a brief syntax definition and Shift-F1 jumps me to the php.net/manual resource. That's great :)

I haven't got XDebug working yet:

'Debug connection with XDebug not established'

Maybe this only works with the Ultimate edition, rather than my trial version(?).

Anyway, thanks for the assistance. Andy.

0
Maybe this only works with the Ultimate edition, rather than my trial version(?).


1) PhpStorm has no Ultimate edition .. and all features are working exactly the same regardless of license (trial, EAP, full)

2) It's definitely configuration issue: xdebug and/or PhpStorm -- you have to properly configure both of them to have debugging working. If you have not read this yet then it's a good place to start: http://confluence.jetbrains.net/display/WI/Documentation

P.S.
Obviously do not run multiple PHP IDEs at the same time -- maybe you have another IDE that is already working with xdebug right now (connection established) and PhpStorm cannot connect to it (unlikely to be your case.. but I have seen threads here where closing Eclipse/Netbins/etc resolves the issue).

If you still having issue withsetting up debugging -- I strongly recommend starting new thread -- will be much easier to answer/get help.

0
Avatar
Permanently deleted user

Thanks for the link.

I have Komodo Edit and Aptana but I haven't configured them for any degugging.

I've added/amended settings in php.ini:

xdebug.remote_enable = 1
xdebug.remote_host="http://localhost:81/"
xdebug.remote_port=9000

There is also a file 'phpForApache.ini' so I created the same settings in this.

I've installed bookmarklets to start and stop XDebug within Firefox.

I'm obviously missing something somewhere.. Do I need to enter something for XDebug proxy?

0

1) XDebug proxy is something completely different and very likely that you will never need it

2) It's definitely your config -- have a look at those manuals/tutorials (don't forget restart Apache after making config changes to xdebug) and try exact steps on very simple brand new project (one index.php with just few lines of simple php code -- to start with). You definitely need to check what each xdebug. config field means ( http://xdebug.org/docs/all_settings ) -- I'm very positive that xdebug.remote_host="http://localhost:81/" is not valid value.

0
Avatar
Permanently deleted user

Thanks for another useful link.

I tried "localhost:81" still no joy.

Never mind, I won't use this feature for a while anyway.

BTW I'm liking this editor - definitely much more responsive than Aptana Studio (takes an age X-( )

Although I'm not yet convinced to drop my favourite - Komodo Edit B-). I don't believe KE has these
debugging features though.

Andy.

Added:Here's details from my php.ini if anyone can spot an obvious error or omission?

; XDEBUG Extension

zend_extension = "c:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9-x86_64.dll"

[xdebug]
xdebug.remote_enable = 1
xdebug.remote_host="localhost:81"
xdebug.remote_port=9000
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

0
Avatar
Permanently deleted user

WAMP indicates that it's using a different location for php.ini:

C:\wamp\bin\apache\Apache2.2.21\bin

So I amended these settings as well, but still no go..

0

Instead of

xdebug.remote_host="localhost:81"

try this:

xdebug.remote_host=127.0.0.1


Here is my current (2-year old now) config (obviously, you don't need all these settings -- some of the settings are repeating xdebug defaults -- I just like to be certain on settings):

[xdebug]
xdebug.collect_includes = 1
xdebug.collect_params = 3
xdebug.collect_return = 0
xdebug.collect_vars = 0
xdebug.default_enable = 1
xdebug.dump_globals = 1
xdebug.dump_once = 1
xdebug.dump_undefined = 0
xdebug.extended_info = 1
;xdebug.max_nesting_level = 100
xdebug.overload_var_dump = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = D:\php_temp\xdebug
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.remote_autostart = 0
xdebug.remote_enable = true
xdebug.remote_host = 127.0.0.1
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.show_exception_trace = 0
xdebug.show_local_vars = 1
xdebug.show_mem_delta = 1
xdebug.trace_format = 0
xdebug.trace_options = 0
;xdebug.trace_output_name = trace.%c
xdebug.trace_output_dir = "D:\php_temp\xdebug"
;xdebug.var_display_max_children = 128
;xdebug.var_display_max_data = 512
xdebug.var_display_max_depth = 4
0
<?php phpinfo();

Use that simple code and check which php.ini is actually in use (in case you are not sure). And .. as it always goes with Apache -- restart Apache after making configuration changes as PHP most likely will not re-read the php.ini

0
Avatar
Permanently deleted user

Thank you, Andriy.

It's dawned on me that 'localhost:81' must be wrong as, for debugging, I won't be using this port.
So, presumably, either localhost or 127.0.0.1.

I must let this go :^O it's been distracting me all day, and it's not significant for me any time soon.
(It's only that I'd like to get it working before my trial period runs out.)

Andy.

0
Avatar
Permanently deleted user

I've moved on to a different error now. Pressing Debug opens the Console, saying on the left:

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

and on the right:

Testing started at 18:08 ...
Executing tests
PHPUnit is missing from include paths.
Please adjust ''include_path'' variable in your ''php.ini'' configuration file.

1) Does this mean that the debugging process is, at least initiating?
2) What is PHPUnit and do I need it for debugging? I don't think it came with my WAMP install?

Thanks, Andy.

0

1) Maybe yes, maybe not -- not enough details to be certain

2) http://en.wikipedia.org/wiki/PHPUnit , http://www.phpunit.de/manual/current/en/

You are seeing PHPUnit because (most likely -- my conclusion is based on your description) you created Run/Debug Configuration for PHPUnit. You need different configuration instead.

0
Avatar
Permanently deleted user

Thanks again, I think I'm making progress.

I deleted the PHPUnit configurations;
I started the XDebug Session in Firefox (using a bookmarklet);
Clicked Listen to 9000;
Set a breakpoint within PHP code;
Chose Debug.

PhpStorm offered to add an extension to FireFox, which I accepted.

Debugging ran, as the Stop option was enabled in the Run menu and I no longer
received the error message about XDebug not being found.

However, it didn't pause at the breakpoint and Step Into, etc., are not available.

I believe this is because JavaScript debugging is running, rather than PHP - there
was a message about only one instance of the JS debugger being allowed.

What configuration settings do I need to disable JS, and enable PHP, debugging please?

Andy.

0
Avatar
Permanently deleted user

.. I'm now receiving a repeat of the message

Error in parsing value for 'filter'.  Declaration dropped.

Why is this process so difficult? There should be some straight-forward, clear instructions
for debugging PHP with a WAMP server! :_|

0

Why is this process so difficult? There should be some straight-forward, clear instructions
for debugging PHP with a WAMP server!

No idea -- I had no problems setting it up without any instructions at all (back then there were no instructions/tutorials yet).

I may only recommend the same again: create a very simple brand new project and follow the exact steps on the tutorial -- I've tried and it worked. Once you have it working on simple project try the same on real project. If still nothing -- either you have xdebug configuration issue .. or doing something else wrong.

0
Avatar
Permanently deleted user

I have only a simple php page with a few print statements; but you're quite right, I should start over.

The Debugger window shows Variables - Connected and the Scripts panel shows a few folders,
including google analytics, and there are no errors in the Console window.

So all looks good, but it still ignores my breakpoint.

Never mind ?:|. I should delete this project, create a new one and go through everything
from scratch.

Andy.

0

The Debugger window shows Variables - Connected and the Scripts panel shows a few folders,
including google analytics, and there are no errors in the Console window.

This sounds like JS debugging not PHP -- I do not remember any "Scripts panel" for PHP...

0
Avatar
Permanently deleted user

Well after hours of fiddling, and seemingly repeating the same steps, I seem to be "debugging" ;).
I'm not sure what the problem was - it may have just been a path setting '/'.

I can step through, see a list of _COOKIE, _ENV, etc., variables in the Debugger window, and output
in the Console window. But there is no connection between Firefox and PhpStorm(?).

In Firefox I have bookmarklets to Start a session and xDebug this page, but this second option
just runs the whole page. If I try View/ Reload in Firefox I receive an error, URL http:/// is invalid.

Any idea what option I am still missing to connect Firefox and PhpStorm? Thanks, Andy.

Added my php.ini settings for xDebug:
;zend_extension = "c:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9-x86_64.dll"
zend_extension = "c:\wamp\bin\php\php5.3.8\ext\php_xdebug-2.1.2-5.3-vc9-x86_64.dll"
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = localhost
xdebug.remote_mode = req
xdebug.remote_handler = dbgp
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

0
Avatar
Permanently deleted user

Hello Andrew,

Actually you don't need to connect Firefox to PhpStorm - it is only related to JavaScript debugging. When you click on 'xdebug Start Session' bookmaklet, the special cookie is triggered (see http://xdebug.org/docs/remote#browser_session). When the cookie is set, php interpreter running on server will attempt to connect to IDE.

Have you managed to debug your PHP application using Xdebug?

Thank you for feeback!
0
Avatar
Permanently deleted user

Andriy,

Thanks for assistance! :)

0

Please sign in to leave a comment.