Re: RE : [SMARTY] Again : Smarty error: problem creating directory. did I found something ?
| From: | messju mohr | Date: | Thu, 08 Jan 2004 14:16:43 +0000 |
| Subject: | Re: RE : [SMARTY] Again : Smarty error: problem creating directory. did I found something ? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10787@lists.php.net to get a copy of this message | ||
On Thu, Jan 08, 2004 at 03:05:07PM +0100, Christopher Rousseau wrote:
> I have add this line before the test :
> echo $_new_dir . ' ';
> echo (is_dir($_new_dir) ? 'true ' : 'false ');
> echo (file_exists($_new_dir) ? 'true ' : 'false ');
>
> the result was : /home false false
>
> I have write a small script to read the / directory of the server
> My script failed opening it with this message:
>
> Warning: opendir(): SAFE MODE Restriction in effect. The script whose
> uid/gid is 10431/10431 is not allowed to access / owned by uid/gid in
> /home/seafarii1/www/t.php on line 9
okay. that's the key. you cannot use use_sub_dirs=true with
safe mode enabled. there's no way to do this reasonably.
my suggestion: set use_sub_dirs=false.
- for "templates_c" it shouldn't be a performance issue (unless you
have thousends of templates).
- for "cache" write a custom cache-handler. use a database perhaps.
> Warning: opendir(/): failed to open dir: No such file or directory in
> /home/seafarii1/www/t.php on line 9
>
> Php maybe answer false to the file_exists('/home') if it have not the
> permission to read/execute the '/' directory at all ?
>
> -----Message d'origine-----
> De : messju mohr [mailto:messju@lammfellpuschen.de]
> Envoyé : jeudi 8 janvier 2004 14:44
> À : Christopher Rousseau
> Cc : smarty-general@lists.php.net
> Objet : Re: [SMARTY] Again : Smarty error: problem creating directory.
> did I found something ?
>
> On Thu, Jan 08, 2004 at 02:25:59PM +0100, Christopher Rousseau wrote:
> > I did use today a sharing hosting company to host a small web site.
> >
> > As usual I'm using smarty for it.
> >
> >
> >
> > I encounter the now well know "Smarty error: problem creating
> directory
> > '/home' in /home/seafarii1/Smarty-2.6.0/libs/Smarty.class.php"
> >
> > After some test and look on the previous mail in this liste I did try
> > the $smarty->use_sub_dirs=false; option and it did work.
> >
> >
> >
> > But I was not happy, my site use cache with cache_id and I prefer to
> use
> > sub dir than put many files in the same directory
> >
> >
> >
> > I did look inside the "smarty_core_create_dir_structure" function and
> > found a possible problem:
> >
> >
> >
> > On line 19 we found this line:
> >
> > $_open_basedir_ini = ini_get('open_basedir');
> >
> >
> >
> > It seams that the create_dir function remove all directory found in
> > open_basedir before trying to create the new structure.
>
> nope. below is a test : "$_use_open_basedir =
> !empty($_open_basedir_ini)"
> basedirs are only honored if the value is set at all.
>
> > On my hosting php server, this parameter is not set at all. So smarty
> > try to create the full directory where my compile file are stored
> >
> > And failed creating the first one: "/home" because I have not the
> right
> > to write inside the root directory (even if this /home directory
> already
> > exist???).
>
> the test for the trigger_error is:
> if ($_make_new_dir && !file_exists($_new_dir) &&
> !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) {
>
> that means the error should only occur if 'file_exists("/home")'
> returns false and is_dir("/home") returns false.
>
> can you test if this is the case?
>
> greetings
> messju
>
>
> > I have modified the smarty_core_create_dir_structure to force the
> > $_open_basedir_ini variable to be my root directory (in my exemple :
> > /home/seafarii1/) and it work now, but it's ugly :-).
> >
> >
> >
> > I don't know if somebody did work on it already and how to solve
> > definitively this problem in the proper way.
> >
> > I'm at the disposition of Messju or anybody else who want to look upon
> > it to provide more information if needed :-)
> >
> >
> >
> >
> > Christopher Rousseau
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php