5

I am new at the software phpStorm.

When I edit a html file, I can put break point on the javscript part, by clicking on the left of the code editor.

However, when I edit a php file, it doesn't work. It works only to put a break point on the php part of the code.

How can I put javascript break point on my php files?

7
  • As always in IDE, when you click on the bar which is on the left of the code, you can add breakpoint. I've edited the question for more clarity. Commented Mar 14, 2012 at 0:28
  • If you have mixed php and js in a single file it is doubtfully you can do that Commented Mar 14, 2012 at 0:30
  • Not 'as always'. Some have interactive debugging, some don't. Some do it for some languages but not others. Your question is highly specific to the IDE you're using. Commented Mar 14, 2012 at 0:31
  • Yes, I've mixed php javascript and html... Commented Mar 14, 2012 at 0:32
  • @Hamish i disagree with the highly specific. Ive yet to see an IDE for PHP that doesnt have interactive debugging. Commented Mar 14, 2012 at 1:40

3 Answers 3

11

Add a debugger; line to your JavaScript code. For example:

alert("First.");
debugger; // Trigger a breakpoint.
alert("Second.");
Sign up to request clarification or add additional context in comments.

Comments

5

If you want to debug the Javascript in PHPStorm (and not the Browser), you can do so by using the remote javascript debugging option.

A blog explaining this is here: http://tiger-fish.com/blog/using-phpstorm-debug-javascript

Short version: in the Javascript Debug configuration you set the start URL to the php file. And you map the *.js you want to debug.

2 Comments

Wonderful finally I can debug everything in one place ! It is really annoying for me use the integrated debugger in chrome ( nice but too small ... and the shortkeys are different from phpstorm ... )
2

On the official documentation page (2015), in section 5, it is written that there is no such possibility:

enter image description here

Comments

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.