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

unable to read template

 
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
dave
Smarty n00b


Joined: 06 Oct 2004
Posts: 4

PostPosted: Wed Oct 06, 2004 4:34 pm    Post subject: unable to read template Reply with quote

Hi there,

I hope you can help me. It probably is just a simple mistake of mine but I don't have much experience and running out of ideas. Wink
I have installed and copied my locally functioning Smarty 2.6.2 website on my rented webspace and got the following error when I tried to access my index page.

Code:
Warning: Smarty error: unable to read resource: "index.tpl.html" in /www/htdocs/trailhun/smarty/Smarty.class.php on line 1102


The layout directories and the contained files have permission 770. My directories look like that:

- smarty

- content
--- index.php

- layout
--- cache
--- configs
--- templates
--- templates_c


The variables have absolute paths (DOCUMENT_ROOT = /www/htdocs/trailhun/) like it is recommended by mohrt in thread unable to read resource.

Code:

$this->template_dir = $_SERVER["DOCUMENT_ROOT"].'layout/templates/';
$this->compile_dir = $_SERVER["DOCUMENT_ROOT"].'layout/templates_c/';
$this->config_dir = $_SERVER["DOCUMENT_ROOT"].'layout/configs/';
$this->cache_dir = $_SERVER["DOCUMENT_ROOT"].'layout/cache/';


Some facts about the webserver:
Apache/1.3.29 (Unix) mod_fastcgi/2.4.2 FrontPage/5.0.2.2635 PHP/4.3.9

Does anyone have an idea ...?
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 4:43 pm    Post subject: Reply with quote

Does this file exist and readable by the web server user?

/www/htdocs/trailhun/layout/templates/index.tpl.html

You can probably test this directly since everything is installed under document root:

http://www.mydomain.com/layout/templates/index.tpl.html

See if anything shows up.
Back to top
View user's profile Send private message Visit poster's website
dave
Smarty n00b


Joined: 06 Oct 2004
Posts: 4

PostPosted: Wed Oct 06, 2004 5:14 pm    Post subject: Reply with quote

That was a fast reply, thanks!

After changing permissions from 770 to 775, the template showed up in the browser.
Afterwards I tried index.php again and got a different error message:

Code:
atal error: Smarty error: unable to write to $compile_dir '/www/htdocs/trailhun/layout/templates_c'. Be sure $compile_dir is writable by the web server user. in /www/htdocs/trailhun/smarty/Smarty.class.php on line 1102


I also set permissions for folder templates_c to 775. That had no effect. Then I set it to 777 and tried index.php one more time. Now it says:

Code:
Fatal error: Call to undefined function: smarty_core_write_file() in /www/htdocs/trailhun/smarty/core/core.write_compiled_resource.php on line 30


Hmm ... I hope that's a step forward! Laughing
Back to top
View user's profile Send private message
dave
Smarty n00b


Joined: 06 Oct 2004
Posts: 4

PostPosted: Wed Oct 06, 2004 5:31 pm    Post subject: Reply with quote

OK, I have just seen, that core.write_file.php hasn't been uploaded properly. I don't get error messages anymore but have other problems. (Header and footer are not included.)

But to get back to the original problem. I thought it would be sufficient to set everything to 770. It says so in the documentation. Wink
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Oct 06, 2004 5:58 pm    Post subject: Reply with quote

Quote:
Technical Note: chmod 770 will be fairly tight security, it only allows user "nobody" and group "nobody" read/write access to the directories. If you would like to open up read access to anyone (mostly for your own convenience of viewing these files), you can use 775 instead.


Sure, you can use 770 but your webserver will have to be configured to use the appropriate user. Here's a trick: create the subdirs from a PHP script with 770 that way the "correct" user ought have the appropriate privledges.
Back to top
View user's profile Send private message
dave
Smarty n00b


Joined: 06 Oct 2004
Posts: 4

PostPosted: Wed Oct 06, 2004 8:50 pm    Post subject: Reply with quote

Thanks, I will do that! Very Happy
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
Page 1 of 1

 
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