Login or Register

RSS IconRecent posts in this topic

avatar
spida on Jun 18. 2007. 2:52 am
@senixon
Does your solution probably work on a *nix server?

@mvdbrand
Did you try it? Result?
avatar
Anathema on Jun 29. 2007. 3:48 pm
@ senixon,

Thanks for your solution. Now file system is running on my server well!!! :)
avatar
adamluz2 on Jul 27. 2007. 1:06 pm
Above fix did not work for me. I have openbase_dir in effect. On Apache 2 with PHP 5 running Fedora Core 4, (Linux) and applied above fix. Still getting same error. All permission are correct.
avatar
takdavid on Oct 15. 2007. 2:26 pm
Senixon, this function doesn`t work on PHP5.1.6, Linux 2.6.18-1.2798.fc6, Apache/2.2.3 (Fedora). Nothing interesting happens, the same error occurs.
avatar
alexkingorg on May 30. 2008. 1:53 am
The function above didn't work for me (CentOS), but this did. It's PHP5 only due to the strrpos usage - that could likely be replaced with strpos with no ill effects for PHP4 users.
  function force_mkdir($path, $chmod = null) {
    if (is_dir($path)) {
      return true;
    } // if
    $real_path = str_replace('\\', '/', $path);
    $parts = explode('/', $real_path);
    
    $forced_path = '';
    $path_start = strrpos($path, 'upload');
    foreach ($parts as $part) {
      if (empty($part)) {
        continue;
      }
      
      // Skip first on windows
      if ($forced_path == '') {
        $start = substr(__FILE__, 0, 1) == '/' ? '/' : '';
        $forced_path = $start . $part;
      } else {
        $forced_path .= '/' . $part;
      } // if
      
      if (strlen($forced_path) > $path_start && !is_dir($forced_path)) {
        if (!is_null($chmod)) {
          if (!mkdir($forced_path)) {
      	die('test'.$forced_path);
            return false;
          } // if
        } else {
          if (!mkdir($forced_path, $chmod)) {
            return false;
          } // if
        } // if
      } // if
    } // foreach
    
    return true;
  } // force_mkdir

RSS IconRecent posts in this topic