Jump to content

[SOLVED] Development Server


keeps21

Recommended Posts

So I have an installation of WAMP running on my computer for development of applications.

 

Currently each application is in a subdirectory

 

www/app1

www/app2

www/app3 etc.

 

What this means is that my scripts refer to http://localhost/app1/, http://localhost/app2/, http://localhost/app3/ etc

 

Meaning that when I upload to a server my scripts need to be changed to use the www directory rather than a sub directory.

 

What's the best way to overcome this - use of code? or run a different test server for each application and use the www root?

 

Cheers for any advice.

 

Link to comment
Share on other sites

What's the best way to overcome this - use of code? or run a different test server for each application and use the www root?

While I'm not familiar with WAMP (I use XAMPP), my root folder is htdocs.. so if I place files in the root of htdocs, it doesn't matter if things are running on localhost or remote server.. the files will be accessible: '/somefile.php' <= somefile.php in the root.

So if in WAMP, www is supposed to be your root folder, I would guess that you don't include 'www' in your file paths (perhaps just /?), as this is probably already understood as your sites root?

Link to comment
Share on other sites

I've solved this by specifying the site url and the abs path to the site files as constants in my config file. Then just used those constants in my pages where needed.

 

That way I'll just need to change those two variables in the config when the site goes onto a live server.

Link to comment
Share on other sites

Something tells me you shouldn't have to do that (change variables to go from localhost to server). The idea should be that the localhost is set up in such a way that any paths you specify in your code (from the root on outwards) should work regardless whether you are testing on localhost or using a remote server. The code should be portable, and as a result, you shouldn't need to mess around with absolute path configurations.

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.