[UPHPU] virtual PHP hosts and database code generation

Ray Hunter bigdog at venticon.com
Tue Nov 23 07:47:29 MST 2004


On Tue, 2004-11-23 at 22:51 +1100, John Fletcher wrote:
> a) I am developing and testing a php app on my Windows laptop and will be
> deploying onto a linux server.  I want to use absolute paths, so I defined a
> virtual host with apache on my Windows machine and likewise on my linux
> machine, so with my HTML I can do eg <img src="/images/hi.png">.  However
> this is not respected by PHP... is there a way to do something similar in
> php so that I can include "/blah.php" instead of "C:/dev/app/blah.php"?

Try something like this:

if( strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ) 
{
  //Windows
  define(INCLUDE_HOME, "C:/dev/app/");
} else {
  //Linux
  define(INCLUDE_HOME, "/replace/me");
}

include(INCLUDE_HOME."blah.php");

> b) Is anyone using PHP database access code generators?  I saw something
> called phpcodegenie today... anyone have any opinions on this or other
> options?

Nope, never seen it before.


HTH,
Ray





More information about the UPHPU mailing list