Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

The same templates_c problem :(
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Tue Aug 17, 2004 7:38 pm    Post subject: The same templates_c problem :( Reply with quote

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 Sad

It worked before, don't know why it suddenly crashes Sad

Please please please ... I'm starting to get worried Embarassed
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Aug 17, 2004 7:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Tue Aug 17, 2004 7:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Aug 17, 2004 7:54 pm    Post subject: Reply with quote

look at the output of phpinfo(), see what the value for open_basedir is.
Back to top
View user's profile Send private message Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Tue Aug 17, 2004 8:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Aug 17, 2004 8:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Tue Aug 17, 2004 9:06 pm    Post subject: Reply with quote

Checked everything, moved to another dir and set the new directory in the files ... but no good result Sad
Back to top
View user's profile Send private message
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Wed Aug 18, 2004 9:18 am    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 18, 2004 9:59 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Wed Aug 18, 2004 1:09 pm    Post subject: Reply with quote

/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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 18, 2004 1:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Wed Aug 18, 2004 2:36 pm    Post subject: Reply with quote

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 Sad
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 18, 2004 2:41 pm    Post subject: Reply with quote

sorry, i meant
realpath(dirname(__FILE__)) . '/'
Back to top
View user's profile Send private message Send e-mail Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Wed Aug 18, 2004 2:48 pm    Post subject: Reply with quote

Ok, lets not celebrate too fast ... but no errors ... and my tpl file showed up nicely Wink

You are my god, let's hope I do not bump into these errors again.

THANKS !!
Back to top
View user's profile Send private message
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Sun Sep 05, 2004 10:30 am    Post subject: Reply with quote

I thought all problems were behind me Sad

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 ??? Confused
It's killing me and I'm wasting valueble time Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP