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
https://forums.phpfreaks.com/topic/146138-solved-development-server/
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?

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.