Jump to content

Newbie: is_dir() & opendir() failure


fopetesl

Recommended Posts

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.[code]$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";
}[/code] 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 [u]is[/u] the php log?). ???
Link to comment
Share on other sites

  • 6 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.