0

I have a server that has a production server a staging sever and a development server.

I maintain code by changing it on the development server testing it. Then staging it and testing it and then finally send it to production.

As part of the code base (php) there are certain URL's that require a FQDN I.e.

http://www.xyzserver.com/examplescript.php

when in development I can use

http://development.xyzserver.com/examplescript.php

in staging it would be

http://staging.xyzserver.com/examplescript.php

what is the best way to make the first part of the domain name a variable so as to avoid the problem of having to change the script as it moves through each test phase.

Also there are some include files that get used that use a different database name for MySQL access. how can I make them context sensitive in the same way.

not sure if this is a programming or sysadmin question but I have to start somewhere

I have the servers setup as separate Vhosts in Apache.

0

As php strings are mutable, you can use a variable say $url for your server urls. Add the string xyzserver.com/examplescript.php with the appropriate identifier to match your dev/staging/production needs.

like, if it is development

$dev="development"

$dev. = "xyzserver.com/examplescript.php"

  • can i take it from a server variable by any chance $Server_ I haven;t found one looking through the docs – MB. Dec 12 '14 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.