vscode-php-debug icon indicating copy to clipboard operation
vscode-php-debug copied to clipboard

Browser preview - Unable to find it

Open anonimo82 opened this issue 4 months ago • 3 comments

Hello everyone. As in subject, I can't find the relevant option to preview HTML/PHP file in Browser while debugging it. Please, can someone help me?

Thanks in advance for any kind of support. Regards, have a nice day.

Kindly, Giuseppe.

anonimo82 avatar Jul 30 '25 09:07 anonimo82

Nevermind, I found it. I feel very dumb, it was really easy to find.

Now I only miss a way to open the internal browser.

anonimo82 avatar Jul 30 '25 09:07 anonimo82

Ok, also found how to use internal browser. Unfortunately, the preview doesn't load. If I run the debug from the right-up corner, I get a random port and it never loads, if I use the debugger side panel, the debugger stops and tells me the address is already in use, regardless the IP and port I enter in the launch.json file.

Please, any help?

Thanks in advance for any support. Regards, have a nice day.

Kindly, Giuseppe.

P.S.: I'm using GitHub CodeSpaces.

anonimo82 avatar Jul 30 '25 10:07 anonimo82

Hi! The top right debugger icon will start the debugger on a random port and then execute the currently open PHP file as a terminal script. In a normal scenario you would have a web-server running on your system (or container) and you wild start the debugger in the side panel whenever you'd like to debug a request. You would open the page you are working on with a normal browser.

Remember, it's the PHP process that connects to the debugger (running inside VSCode) and your browser that connects to PHP.

Can you share how you have things setup in CodeSpaces? Do you have a web server running? Or are you using something like Laravel Sail? I never used the internal browser yet, so I'd love to get a better understanding.

zobo avatar Jul 30 '25 10:07 zobo