2

I have no issue debugging php files independently but when I want to see the request that server side(php) get from client side locally, I can't. I try to do it by putting breaking point inside php file, hopefully debugger will stop on break point when I debugging my project using chrome.

My php looks like that:

<?php
    $response = "Super"  <--this line has a breaking point
    echo $response

Client side sending the request to server side looks like that:

    function ajaxRequest(url, data, requestMethod)
    {
        $.ajax({
            type: requestMethod,
            url: url,
            data: {
                json: data
            },
            success: responseHandler
        });
    }

When I run project in debug I get window in chrome with this url: http://localhost/Jason/index.html?XDEBUG_SESSION_START=19067

And in my PHPStorm debugger I see waiting for connection with ide key 19067 The chrome is displaying to code as if the request already been sent and response has been received without stopping in php break point.

1

1 Answer 1

1

After you start php debugging, try to right click in the browser window and select Inspect in PhpStorm. This should also activate the JS debugger in storm alongside php debug.

Of course you've installed Chrome extension for PhpStorm: https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji

Hope this helps.

[Later edit] Ah, and deactivate any JavaScript minifying you may have!

Sign up to request clarification or add additional context in comments.

2 Comments

How to do this for an AJAX API where no HTML comes from the server (just JSON data)? And where each API call has a different PHP FILE? e.g. AddUser.php, Deleteuser.php, etc
still nothing on the json call :(

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.