php-windows Digest 16 Nov 2006 07:32:18 -0000 Issue 3072
Topics (messages 27275 through 27277):
Problem with removable media
27275 by: Styve Couture
27276 by: tg-php.gryffyndevelopment.com
PHP DLL's
27277 by: Dale Attree
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Hi folks,
I have a PHP apps who let people listen to audio files. Those files are
mainly store on the hard drive of the server. But the old ones are
backed up on DVD and purged from the hard drive. I need to offer the
possibility to listen to the files on the DVD. So, I have tried
different things:
I have added an alias in Apache configuration pointing to the DVD drive.
The problem is that as Apache validate is configuration on start, if
there is no disk in the drive, the service refuses to start. This
implied that we ALWAYS had to have a disk in the drive in case of a
server reboot. This solution was not retained after the test phase.
One of the other things that I have tried is to add an entry in the PHP
application configuration so we can configure the path to the DVD drive.
With that approach, Apache is always able to start correctly. I can also
listen to the files stores on the DVD. The problem comes when I try to
access to file on the DVD drive and there is no disk in the drive. All
the functions I have tried (file_exists(), is_dir(), etc.) make a
message box to appear on the server (There is no disk in the drive,
blabla... Abort, Retry, Ignore). This cause the session on the client to
hangs (waiting for the message box on the server). I have not been able
to suppress or prevent the message box to appear.
Writing a restoration application, is out of scope (not enough time left
on the project). Moving to PHP5 to have better error handling to.
Have any of you had to work on accessing removable media?
My server conf.:
Windows 2000 server SP4
Apache 2.0.50
PHP 4.3.3
The DVD drive is DVD-RAM
Best regards.
Styve
--- End Message ---
--- Begin Message ---
Styve,
Here's a block of code I borrowed (see comment block) and use to scan active
drives on a Windows PC. It uses the is_dir() which may still not work for you,
but maybe it does it differently than you did.
Also, I believe you can access Windows API functions that can return the status
of a drive without throwing an error box.
http://www.php.net/manual/en/ref.w32api.php (I think this is your best bet,
just means diving into the Windows API and figuring out how to get the two to
work together properly)
Another thing to look at is maybe head over to http://www.winbinder.com and see
if any of those guys have found a good way to do it, since not only is it PHP +
Windows specific, but non-web browser based coding that deals directly with
Windows API issues.
And lastly, may be able to get info via COM interface with some other Windows
apps, but I think this is a long shot and kind of sloppy:
http://us2.php.net/com
Let us know if you find a good solution. Good luck!
-TG
#########################################################################
#
# The following code as found at:
http://www.php.net/manual/en/ref.filesystem.php
# Simple enough code, but m2pc saved me some typing so I'm giving credit here.
Thanks for sharing your code!
#
# The only things I changed were some formatting and....
#
#########################################################################
# m2pc (at) hotmail.com
# 07-Oct-2004 12:18
# After searching all over the place to find a function to do what I wanted,
I wrote the following:
/*
** Returns an array of valid drives on the system (a:, b:, etc.)
*/
function getSystemDrives() {
// Initialize
$aResult = Array ();
// Loop from A-Z and try opening the root dir
for ($letter = 'A'; $letter <= 'Z'; $letter ++) {
if (is_dir ($letter . ":"))
$aResult [] = $letter . ":";
}
// Return results
return ($aResult);
}
# It simply returns an array of valid drives as seen from the server (A:, B:,
etc.). This obviously is targeted to Win32 installations only.
#########################################################################
= = = Original message = = =
Hi folks,
I have a PHP apps who let people listen to audio files. Those files are
mainly store on the hard drive of the server. But the old ones are
backed up on DVD and purged from the hard drive. I need to offer the
possibility to listen to the files on the DVD. So, I have tried
different things:
I have added an alias in Apache configuration pointing to the DVD drive.
The problem is that as Apache validate is configuration on start, if
there is no disk in the drive, the service refuses to start. This
implied that we ALWAYS had to have a disk in the drive in case of a
server reboot. This solution was not retained after the test phase.
One of the other things that I have tried is to add an entry in the PHP
application configuration so we can configure the path to the DVD drive.
With that approach, Apache is always able to start correctly. I can also
listen to the files stores on the DVD. The problem comes when I try to
access to file on the DVD drive and there is no disk in the drive. All
the functions I have tried (file_exists(), is_dir(), etc.) make a
message box to appear on the server (There is no disk in the drive,
blabla... Abort, Retry, Ignore). This cause the session on the client to
hangs (waiting for the message box on the server). I have not been able
to suppress or prevent the message box to appear.
Writing a restoration application, is out of scope (not enough time left
on the project). Moving to PHP5 to have better error handling to.
Have any of you had to work on accessing removable media?
My server conf.:
Windows 2000 server SP4
Apache 2.0.50
PHP 4.3.3
The DVD drive is DVD-RAM
Best regards.
Styve
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
Hi all,
I was running PHP 5.0.3RC with mysql. Then I upgraded to PHP 5.2.0 and
include PDO.
On 5.0.3, mysql works fine, but PDO doesn't.
On 5.2.0, mysql doesn't work and PDO does.
Apache keeps throwing out cannot find the specified module errors.
Any ideas?
Thanks,
Dale
/* Config */
$OS = 'Win XP';
$Webserver = 'Apache 1.3.27';
--- End Message ---