Jump to content


Newbie: is_dir() & opendir() failure

  • Please log in to reply
1 reply to this topic

#1 fopetesl

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 20 July 2006 - 03:48 PM

I have a script, (not originally written by me), which runs fine on a Mandrake10 machine but fails on a Ubuntu machine.  Both are running similar versions of apache, mysql amd PHP4.
$datadir = "var/lib/mysql/meter";
$olddir = "/var/lib/mysql/meter";
$dt = gmdate("dmY.His", time() );    // == ddmmyyyy.hhmmss
$newdir = "$datadir" .  '.' . $dt;       //  ../meter.ddmmyyyy.hhmmss
$ERR_LEV = error_reporting(0);  // NO warnings!
`sudo mv $olddir $newdir`;       // PHP4: no rename()!
$stat = is_dir($newdir);            // new directory created?
error_reporting($ERR_LEV);       // Warning level reset.

if( false ===  $stat)       // ... (new) directory not created?
  echo "**failure**&error=CANNOT RENAME CURRENT DATA DIRECTORY";
and it always fails even though the new directory is visibly there.
I have tried clearing the stat() cache,  reading an existing directory, hard coding the directory string.
None succeed even with opendir();

I suspect it may be a permissions problem but where?  I can find no indication of permission violation in any log file (where is the php log?). ???

#2 mojito

  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 01 February 2007 - 04:58 PM

I have a problem in that afolder i created inside a folder by dreamweaver is being seen as a file and not a directory, I dont know if that has anything to do with your problem, but have a look to see if it is seeing the tpye correctly.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users