Re: Test Server to Live server - best way of handling different file paths in scripts?
From: Belmin (anonymous_at_nospam.com)
Date: 02/13/05
- Next message: beezmnet_at_gmail.com: "Dilema, Blocks of HTML within PHP"
- Previous message: Tim Roberts: "Re: Date time stamp help"
- In reply to: Dave Smithz: "Test Server to Live server - best way of handling different file paths in scripts?"
- Next in thread: Dave Smithz: "Re: Test Server to Live server - best way of handling different file paths in scripts?"
- Reply: Dave Smithz: "Re: Test Server to Live server - best way of handling different file paths in scripts?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 13 Feb 2005 06:44:13 GMT
The other replied were expired, how did you accomplish this? Curious
Written by "Dave Smithz" on 2/7/05 8:41p:
> Hi There,
>
> I have taken over someone else's PHP code and am quite new to PHP. I made
> some changes and have implemented them to a live environment fine so far.
>
> However, I now want to setup a test environment. All the PHP scripts start
> with a few lines of:
>
> require_once "library file at specific location on server"
>
> and when I move them from the test location to live location I have to
> manually apply the changes to each script to reflect the different paths for
> each server.
>
> I was thinking of writing a small script that is contained within the same
> folder as any folder that contains scripts that actually calls another
> require for that server .
>
> E.g.
> Have script do_something.php which I am developing regularly.
> On live server it starts with
> require_once "/home/live/phplib/library.php";
> On test server
> require_once "/home/test/phplib/library.php";
>
> Currently I apply a manual change this (via global change or whatever) when
> moving from Test to Live
> However, I might just change all requires to:
> require_once "./require.php";
>
> And then have a server specific version of require.php that contains the
> necessary requires for the particular server on which it resides.
>
> This way I can just change all the scripts to just require the require.php
> file in the same folder as itself. The actual PHP scripts where I do most of
> my updates need no changes whether on live or test servers.
>
> I just wanted to know if there was a better way of doing it then this. I
> know nothing about directives in PHP or if there was a way of determining
> the current server name and then calling different require commands
> appropriately.
>
> Any more elegant suggestions for handling this are welcome.
>
> Dave
>
>
-- Belmin Fernandez Visit: http://www.belminfernandez.com/homepage Email: belminf at gmail period com
- Next message: beezmnet_at_gmail.com: "Dilema, Blocks of HTML within PHP"
- Previous message: Tim Roberts: "Re: Date time stamp help"
- In reply to: Dave Smithz: "Test Server to Live server - best way of handling different file paths in scripts?"
- Next in thread: Dave Smithz: "Re: Test Server to Live server - best way of handling different file paths in scripts?"
- Reply: Dave Smithz: "Re: Test Server to Live server - best way of handling different file paths in scripts?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|