Sublime Forum

View in browser PHP file xampp

#1

Hi,

Try to view a .php page in the browser with sublime-text 3 and xampp in Windows 7, but can’t seem to find the proper path.

This is my SideBarEnhancements.json:

{
“folders”:
[
{
“path”: “C:/xampp/htdocs/mywebsite-folder”
}
],
“settings”: {
“sublime-view-in-browser”: {
“baseUrl”: “http://localhost”,
“basePath”: “C:/xampp/htdocs/mywebsite-folder”
}
}
}
Some help would be much appreciated!

Thanks and regards,

David

0 Likes

#2


With absolute paths

  • Right click any file on sidebar and select: “Project -> Edit Projects Preview URLs”

  • Edit this file, and add your paths and URLs with the following structure:

    {
    “C:/xampp/htdocs”:{
    “url_testing”:“http://localhost”,
    “url_production”:“http://localhost
    }
    }

1 Like

#3

Thanks Tito,

Do you mean like this?
{
“C:/xampp/htdocs/mywebsite/”:{
“url_testing”:“http://localhost/mywebsite”,
“url_production”:"http://localhost/mywebsite
}
}

I tried this before, but it doesn’t work or did I made a mistake?

Regards,

David

0 Likes

#4

if your apache document root is
"C:/xampp/htdocs
then what I posted is okei and will load in
http://localhost/mywebsite

just use the document root as key and localhost in the url, it should work

with SideBarEnhancements right click any file and select “open in browser” - “default”, it should resolve the url automatically

0 Likes

#5

Thanks! Got it working!

0 Likes

#6

Thanks tito. I was struggling over this issue and it was not working though I had followed instructions as mentioned in the Package control “View in browser”. I guess this part needs to be mentioned in the README section of the package “View in browser”.

0 Likes

#7

Hi @ALLMEDIALAB i am a newbie in PHP and view in browser with XAMPP , I read your post asking @tito about the issue on view in browser and it worked for you. And I had a very similar issue as you encountered there. You said it worked for you. Do you mind sharing a “screenshot” on how it worked? Beacause I copied all the solutions suggested by @tito and you ( @ALLMEDIALAB ) but it does not work for me, And it still wants to open the browser to the directory location of the file, rather than the server URL (in other words it still opens the file via the file:// path, rather than http://). Please advice . thanks

0 Likes

#8

Sorry I can’t help you.
Unfortunately I stopped using XAMPP because I had constant issues with XAMPP it self and my firewall. I don’t have the setup anymore.
Now I’m using Mamp Pro and don’t open it from Sublime Text, but from the Mamp Application. Mamp proved to be very reliable and the Pro version has endless server spots. You just put your PHP stuff in a folder and connect the folder with Mamp, you can then choose on what browser you want to see your site or application.
https://www.mamp.info/en/downloads/
There is a free version to try.
Regards,
David

0 Likes

#9

Hi @sachinwalvekar i am a newbie in PHP and view in browser with XAMPP , I read your post asking @tito about the issue on view in browser and it worked for you. And I had a very similar issue as you encountered there. You said it worked for you. Do you mind sharing a “screenshot” on how it worked? Beacause I copied all the solutions suggested by @tito ; @ALLMEDIALAB ; and you (@sachinwalvekar ) but it does not work for me, And it still wants to open the browser to the directory location of the file, rather than the server URL (in other words it still opens the file via the file:// path, rather than http://). Please advice . thanks

0 Likes