Jump to content

VS Code - Open PHP in Browser Extension


Recommended Posts

Version: 1.71.2 (user setup)
Commit: 74b1f979648cc44d385a2286793c226e611f59e7
Date: 2022-09-14T21:03:37.738Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.22622
Sandboxed: No

Visual Studio Code on Windows 11.

Greetings. I tend to have the most success with debugging, and remote connections using VS Code. I have a LAMP stack setup on a Linux box on my LAN, so most of my php dev work is done via SSH / SFTP connection to that server.


It takes some tweaking, but you can get the extension Open PHP/HTML/JS In Browser to work with that setup and preview files without a hitch if the setup is \\canonicalname\htdocs , but it doesn't want to recognize /usr/bin/php as a valid executable for PHP features of VS Code. If configured with IP address as an SSH connection/ workspace, it will recognize /usr/bin/php , but it won't open PHP in browser, because it's sending commands as linux bash commands in that setup.

Unable to launch selected browser (Chrome). Error: Command failed: google-chrome "http://10.0.0.01/wp_somesite/wp-content/plugins/wp-list-table/inc/admin/views/smsusergroup.php" /bin/sh: 1: google-chrome: not found /bin/sh: 1: google-chrome: not found

Does anyone use that extension and have a recommendation for a functional configuration that will still open the files in a browser with a windows-friendly command?

Link to comment
Share on other sites

I don't follow: you're talking about /usr/bin/php but the error message is talking about google-chrome.

If you're running things in the browser then the path to PHP doesn't matter. Unless you want to use its development server, but I don't think that's the case.

So what's the problem here?

Link to comment
Share on other sites

  • 2 weeks later...
Unable to launch selected browser (Chrome). 
Error: Command failed: google-chrome "http://[...snip...]usergroup.php" /bin/sh: 
1: google-chrome: not found /bin/sh: 1: google-chrome: not found

There is no problem.

Windows does not interpret the path as a valid path to an executable at /bin/sh . Additionally, there is no windows executable binaries there for it to run.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.