View previous topic :: View next topic |
Author |
Message |
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Tue Aug 17, 2004 7:38 pm Post subject: The same templates_c problem :( |
|
|
Hello,
Suddenly today, I get the well known error
Code: |
Warning: fetch(): open_basedir restriction in effect. File(/full_and_correct_path_to_templates_removed_for_security_reasons/templates_c//%%04^04D^04D6ED00%%article_form.tpl.php) is not within the allowed path(s): (/removed_for_security_reasons) in (/full_and_correct_path_to_smarty_removed_for_security_reasons/smarty/libs/Smarty.class.php on line 1254
Warning: fetch(/full_and_correct_path_to_templates_removed_for_security_reasons/templates_c//%%04^04D^04D6ED00%%article_form.tpl.php): failed to open stream: Operation not permitted in /full_and_correct_path_to_smarty_removed_for_security_reasons/smarty/libs/Smarty.class.php on line 1254
Warning: fetch(): Failed opening '/full_and_correct_path_to_templates_removed_for_security_reasons/templates_c//%%04^04D^04D6ED00%%article_form.tpl.php' for inclusion (include_path='.:/usr/local/lib/php') in /full_and_correct_path_to_smarty_removed_for_security_reasons/smarty/libs/Smarty.class.php on line 1254
|
Also, the file it has to load is article_form.tpl and NOT .php !
I have read the posts here in the forum, added an absolute path for compile_dir and set $smarty->use_sub_dirs = false; but without any luck
It worked before, don't know why it suddenly crashes
Please please please ... I'm starting to get worried |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Aug 17, 2004 7:46 pm Post subject: |
|
|
according to the error, this file:
/home/maltre/knicks4life/new/layout/templates_c//%%04^04D^04D6ED00%%article_form.tpl.php
Is not in your allowed path. Thi s is the compiled .php file that Smarty creates from the .tpl file.
If this was working before, my guess is that the allowed paths setting on your server has been altered. |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Tue Aug 17, 2004 7:50 pm Post subject: |
|
|
I have created a new template (like described in the manual) and inserted these lines:
$this->compile_dir = '/home/maltre/knicks4life/new/layout/templates_c/';
$this->template_dir = '/home/maltre/knicks4life/new/layout/templates/';
$this->config_dir = '/home/maltre/knicks4life/new/layout/configs/';
$this->cache_dir = '/home/maltre/knicks4life/new/layout/cache/';
I don't understand why it would NOT be in the allowed path ??
Current setup:
new
- layout
---cache (chmod 777)
---templates
---templates_c (chmod 777)
- smarty
--- libs (with the new class and the other smarty files)
Thanks in advance |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Aug 17, 2004 7:54 pm Post subject: |
|
|
look at the output of phpinfo(), see what the value for open_basedir is. |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Tue Aug 17, 2004 8:00 pm Post subject: |
|
|
mohrt wrote: | look at the output of phpinfo(), see what the value for open_basedir is. |
/dh/web/phpmyadmin:/tmp:/dh/solidclient:/usr/local/lib/php:/home/maltre:/home/.macaroniwasherkiln/maltre |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Aug 17, 2004 8:25 pm Post subject: |
|
|
Double check the paths, make sure the permissions are set correctly all the way up the path so PHP can access it. Otherwise, someone else have an idea what's wrong? |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Tue Aug 17, 2004 9:06 pm Post subject: |
|
|
Checked everything, moved to another dir and set the new directory in the files ... but no good result |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Wed Aug 18, 2004 9:18 am Post subject: |
|
|
Nobody knows a solution ?
Please give me some feedback.
If I know nobody can provide a solution, I'll get rid of smarty immediatly without waisting more time on it. So talk to me.
mohrt, thanks for the replies ! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Aug 18, 2004 9:59 am Post subject: |
|
|
is "/full_and_correct_path_to_templates_removed_for_security_reasons/templates_c/"
from you first post == '/home/maltre/knicks4life/new/layout/templates_c/'
or something different?
does echo realpath('/home/maltre/knicks4life/new/layout/templates_c/') give '/home/maltre/knicks4life/new/layout/templates_c/' or something different? |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Wed Aug 18, 2004 1:09 pm Post subject: |
|
|
/full_and_correct_path_to_templates_removed_for_security_reasons/templates_c/
is
/home/maltre/knicks4life/new/layout/templates_c/
echo realpath('/home/maltre/knicks4life/new/layout/templates_c/');
is
/home/.macaroniwasherkiln/maltre/knicks4life/new/layout/templates_c
My webhost stressed that I should NOT use the /.macaroniwasherkiln/ since it changes from time to time.
Thx for the reply messju, hope you can lead me to the right path.
Smarty would save me a lot of time (and it IS a great tool, I have been able to use it) and I hope I get it to work again any time soon. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Aug 18, 2004 1:52 pm Post subject: |
|
|
maltre wrote: | /full_and_correct_path_to_templates_removed_for_security_reasons/templates_c/
is
/home/maltre/knicks4life/new/layout/templates_c/
echo realpath('/home/maltre/knicks4life/new/layout/templates_c/');
is
/home/.macaroniwasherkiln/maltre/knicks4life/new/layout/templates_c
|
that's strange because according to open_basedir above, you should be allowed to access /home/.macaroniwasherkiln/ .
i'd try the following:
use a config.php that you use from each page that uses smarty.
maybe /home/maltre/knicks4life/new/config.php
[php:1:501ee8bb8f]define('BASEDIR', realpath(__FILE__) . '/');
[/php:1:501ee8bb8f]
then you can configure $smarty:
[php:1:501ee8bb8f]$this->template_dir = BASEDIR . 'layout/templates'; /* (BTW: no trailing slashes are neeed for these) */
$this->compile_dir = BASEDIR . 'layout/templates_c';
[/php:1:501ee8bb8f]
this allows you to configure your dirs with correct absolute paths, but without the need to code the full path literally into the php-code.
your paths should stay correct when your pages move. |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Wed Aug 18, 2004 2:36 pm Post subject: |
|
|
I already tried with a vars.php file, but I gave your solution a shot.
define('BASEDIR', realpath(__FILE__) . '/');
This returned: /home/.macaroniwasherkiln/maltre/knicks4life/new/config.php/ so that was not exactly working.
I tried
define('BASEDIR', $DOCUMENT_ROOT . 'new/');
but that gave the same old errors |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Aug 18, 2004 2:41 pm Post subject: |
|
|
sorry, i meant
realpath(dirname(__FILE__)) . '/' |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Wed Aug 18, 2004 2:48 pm Post subject: |
|
|
Ok, lets not celebrate too fast ... but no errors ... and my tpl file showed up nicely
You are my god, let's hope I do not bump into these errors again.
THANKS !! |
|
Back to top |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Sun Sep 05, 2004 10:30 am Post subject: |
|
|
I thought all problems were behind me
I reorganised my files and everything is f'ed up again.
define('BASEDIR', realpath(dirname(__FILE__)) . '/');
define('SITE_ROOT', BASEDIR);
define("SMARTY_DIR", SITE_ROOT."smarty/libs/");
define("LAYOUT_DIR", SITE_ROOT."layout/");
define("CLASS_DIR", SITE_ROOT."classes/");
define("IMAGES_DIR", SITE_ROOT."pieces/");
SITE_ROOT is an exact copy of BASEDIR, because I added BASEDIR later.
Anyway, strange this is: I do not get an error that he can't find the smarty template-class, but all my images are messed up, so is my css stylesheet. They simply cannot be found.
An example of a img src: http://www.knicks4life.com/home/maltre/knicks4life/pieces/tableheaders/latestgame.gif
Any1 know what I'm doing wrong ???
It's killing me and I'm wasting valueble time |
|
Back to top |
|
|