Log in

View Full Version : CD / DVD Rom Drive Detection



dcstow
10-11-2007, 03:48 AM
I have a PHP website that I would like to put on CD.

I have got the basics of this working, using Server2Go (http://www.server2go-web.de/).

Due to the setup of the website (it has some nifty image search function) the absolute path to image folder has to be defined (ie: c:/wamp/www/products/images/)

So, does anyone know of a way to detect what drive the CD was inserted into so I can replace the 'c:/' portion of the path to the correct letter when it is viewed from the CD...

Any help / suggestions are much appreciated.

djr33
10-11-2007, 04:55 AM
$_SERVER['script_filename'] will give a path, though relative in some cases.
Play with the various server vars here:
http://www.php.net/manual/en/reserved.variables.php

Twey
10-11-2007, 05:22 AM
In DOS/Windows, you can say \wamp\www\products\images, which will start from the root of the current drive.

djr33
10-11-2007, 06:20 AM
WAMP? Is that when it is compiled as well?

Twey
10-11-2007, 08:26 AM
As far as I'm aware, WAMP is a binary package for Windows compromising Apache, MySQL, and PHP. The user doesn't compile it...

djr33
10-11-2007, 08:37 AM
Sorry. I misread the information. I was under the impression it was running from the CD as some type of standalone, not just installed as a "server".

dcstow
10-11-2007, 11:16 PM
Thanks for the help guys.

I've had some success using $_SERVER['DOCUMENT_ROOT'] to discover the drive letter.