Author Topic: force_mkdir($destination_dir, 0777) - cPanel chmod -R  (Read 4195 times)

socendani

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
force_mkdir($destination_dir, 0777) - cPanel chmod -R
« on: October 08, 2008, 07:11:35 am »
Hi,
I have a cPanel hosting.
upload files breaks. It can't create subdirs in upload dir.
I can't do CHMOD -R 777 (recursively) and the owner of directoris is Apache user. 
the problem: create subdirs.
the temporal solution I found: not use the function force_mkdir()
Line 169 of \opengoo\library\filerepository\backend\FileRepository_Backend_FileSystem.class.php

I changed temporally:
if(!mkdir($destination_dir, 0777, true)) {
//if(!force_mkdir($destination_dir, 0777)) {

my code for testing mkdir for my cPanel hosting:
Code: [Select]
error_reporting (E_ALL);
$dir="upload";
$base="dir_".rand(1,40);


//(A) prova a troços
if (1==1) {
$nom1=$base."_A";
$nom2=$nom1."_sub";
chdir($dir);
echo "<br>(A) prova a troços";
echo '<br>directorio actual: '.getcwd();
mkdir($nom1);
chmod($nom1,0777);
chdir($nom1);
mkdir($nom2);
chmod($nom2,0777);
chdir($nom2);
echo '<br>directorio actual: '.getcwd();
echo "<br>creado a trozos?: $dir / ".$nom1."/".$nom2 ;
chdir('../../../');
echo '<br>directorio actual: '.getcwd();
echo "<hr>";
}

//(B) prova directe
if (1==1) {
$nom=$base."_B/".$base."_B_sub/";
chdir($dir);
echo "<br>(B) prova directe";
echo '<br>directorio actual: '.getcwd();
echo '<br>Intentamos crear:: '.$nom;
mkdir($nom,0777,true);
echo '<br>directorio actual: '.getcwd();
echo "<br>creado?:".$nom  ;
echo "<hr>";
}

//(C) prova force_mkdir
if (1==1) {
$nom=$base."_C/".$base."_C_sub/";
chdir($dir);
echo "<br>(C) prova directe";
echo '<br>directorio actual: '.getcwd();
echo '<br>Intentamos force_mkdir:: '.$dir.$nom;
force_mkdir($nom,0777);
echo '<br>directorio actual: '.getcwd();
echo "<br>creado?:".$nom  ;
echo "<hr>";
}

function force_mkdir($path, $chmod = null) {
(....)
}




cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: force_mkdir($destination_dir, 0777) - cPanel chmod -R
« Reply #1 on: October 08, 2008, 09:04:57 am »
Could you solve the problem?
I have sucecsfully tried OpenGoo in 2 different cpanel accounts (from different providers) ...}
Marcos

socendani

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: force_mkdir($destination_dir, 0777) - cPanel chmod -R
« Reply #2 on: October 08, 2008, 09:33:15 am »
Hola  Marcos!

with my changes... yes. I can

perhaps the problem is my provider.  for testing I'm using:
http://www.masbaratoimposible.com/

now, I'll try to test opengoo, thanks!!

Dani.