|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-12-15 21:09 UTC] ejwaibel at gmail dot com
Description:
------------
The chdir() command works correctly when changing to a given dir in the SAME drive, however, I believe that it should be capable of changing to another drive letter and then directory in that drive letter. I know that Windows can do that using "cd /D <path>".
Reproduce code:
---------------
$currentDir = getcwd();
echo "currentDir: $currentDir<br/>";
chdir("Q:\\sdadmin") || die(sendMessage("Can't change to '$substDrive\\sdadmin'", true));
echo getcwd();
Expected result:
----------------
I would have expected to change from "D:\scmtools\oss\" to "Q:\sdadmin".
Actual result:
--------------
The chdir() function returns false and I show an error message.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
I updated my PHP version to the Windows .zip file that you included, but that still did not work. We are using a Windows NT 5.2 build 3790 machine (it's a Windows NT server). I actually just checked and it seems like I can change to the "C:" drive, but what I forgot to mention earlier, here is another piece of my code that is used to "subst" the Q: drive for a directory that exists on another drive. $subst = exec("subst $substDrive M:\\$sessionView", $substOutput); $currentDir = getcwd(); $changeTo = "$substDrive\\sdadmin"; chdir("$changeTo") || die("Can't change location to: $changeTo."); The reason I'm doing this is because of our Source Control program "ClearCase" that we use. Can you let me know if there is another way I should do this?I've also tested with networked drives and it works fine. can you please test with a simple script like: <?php // list the files in this directory print_r(glob('*.php')); var_dump(getcwd()); // change to another drive (replace with something existent) var_dump(chdir('Z:')); var_dump(getcwd()); print_r(glob('*')); ?> Please include all error messages printed by PHP.I'm using PHP Version 5.1.2 on MS Windows XP Pro SP2. Drive 'R:' is mounted by ClearCase. When I run script listed bellow I get warrning: Warning: chdir() [function.chdir]: No such file or directory (errno 2) in {scriptName} on line {lineNumber} <?php chdir('R:'); ?>