Forums

renaming folders only works with chmodd 777 (5 posts)

  1. mindspins
    Member
    Posted 8 months ago #

    I'm using the following code in a plugin to rename a folder in the uploads folder according to the date, but this only works if the chmodd settings of both folders are 777. How can I change this code so I can use at least chmodd 755 to keep my website save.

    date_default_timezone_set('Europe/Amsterdam'); // set timezone
    $foldername = ''; $source = 'uploads';
    $allfolders = getDirectory($source); // get folders
    $folder = $source.'/'.$allfolders[0]; // get first folder
    $month = (int)date('n');
    $day = (int)date('j');
    $f = 50-$day; $s = 100-$month;
    $newfolder = $source.'/'.(string)$f.(string)$s; if($folder != '' && $folder != $newfolder){
    rename($folder, $newfolder);
    $foldername = $newfolder."/";
    }else if($folder == $newfolder){
    $foldername = $newfolder."/";
    }
    else{ $foldername = 'error';
    }
  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 8 months ago #

    It's an issue with PHP permissions on your server. Ask your webhost for help.

  3. mindspins
    Member
    Posted 8 months ago #

    Why is it an issue with php permissions? I am the webhost, what should I change?

  4. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 8 months ago #

    What PHP 'type' are you using? DSO? FastCGI?

    Who owns the files after they're created? Is it 'nobody'? Who is PHP running as? The user or apache?

  5. mindspins
    Member
    Posted 8 months ago #

    http://mindspins.com/info.php
    php is running as the user, folder and files are owned by the user

Reply

You must log in to post.

About this Topic