Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Smarty Error: the $compile_dir '..' does not exist...
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
boots
Administrator


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

PostPosted: Fri Dec 05, 2003 2:58 am    Post subject: Smarty Error: the $compile_dir '..' does not exist... Reply with quote

For people having this problem, try this (corrections/additions welcome):

Is safe_mode in effect? (can be set in php.ini, httpd.conf, .htaccess)

NO
- path to templates_c (and/or cache) must be read-writable by webserver process UID

YES
- ensure $smarty->use_sub_dirs = false;

- script owner UID and templates_c (and/or cache) owner UID must match -- this can be relaxed to GID matching by setting the php ini safe_mode_gid = On

- you can verify that this is setup properly: create a php script to write a file into the directory you specified for templates_c (and/or cache). This should always work if the directory is writable by the script owner. The trick is to then try to read that file from your php script -- safe mode restricts reads, not writes. If that throws an error, you have a permission settings issue.

- safe_mode is not necessary in a single user environment (IMO); however you may not have control of this in your environment

Note, if you are using open_basedir then template_c (and/or cache) must exist in a path reachable with that setting.

HTH
Back to top
View user's profile Send private message
gaurav_sting
Smarty Rookie


Joined: 11 Mar 2004
Posts: 7

PostPosted: Thu Apr 08, 2004 4:09 am    Post subject: problem solved Reply with quote

thanx alot, the problem is solved.

Gaurav Behl
Back to top
View user's profile Send private message
Josiah
Smarty n00b


Joined: 15 Jun 2004
Posts: 3
Location: Michigan

PostPosted: Tue Jun 15, 2004 1:27 pm    Post subject: Reply with quote

Quote:
NO
- path to templates_c (and/or cache) must be read-writable by webserver process UID


Does this mean that those sub-directories must be CHMODed to readable/writable? Because I did that, and it still doesn't work. Crying or Very sad
_________________
My Current Project
Back to top
View user's profile Send private message Visit poster's website AIM Address
Josiah
Smarty n00b


Joined: 15 Jun 2004
Posts: 3
Location: Michigan

PostPosted: Tue Jun 15, 2004 1:29 pm    Post subject: Reply with quote

Quote:
must be read-writable by webserver process UID

What is "webserver process UID"?
_________________
My Current Project
Back to top
View user's profile Send private message Visit poster's website AIM Address
Josiah
Smarty n00b


Joined: 15 Jun 2004
Posts: 3
Location: Michigan

PostPosted: Tue Jun 15, 2004 2:25 pm    Post subject: Reply with quote

Sorry, I was putting the sub-directories in the wrong place. They needed to go in the same directory that I was running the Smarty script in. Everything is working now.
_________________
My Current Project
Back to top
View user's profile Send private message Visit poster's website AIM Address
sea_project
Smarty Rookie


Joined: 22 Jan 2005
Posts: 6

PostPosted: Sat Jan 22, 2005 11:53 pm    Post subject: Reply with quote

My phpinfo() is:
Quote:

safe_mode Off Off
safe_mode_exec_dir / /
safe_mode_gid On On
safe_mode_include_dir /usr/local/lib/php /usr/local/lib/php


'templaces_c' and 'cache' dirs are ok, and I wrote a script that creates a file in those dirs to test permissions.

But I continue getting that error:

Quote:

WARNING [/home/chs/server/home/data/smarty/Smarty.class.php:1088] Smarty error: the $compile_dir 'templates_c' does not exist, or is not a directory.


Could you help me?
Back to top
View user's profile Send private message
miahawk
Smarty n00b


Joined: 09 Apr 2005
Posts: 1

PostPosted: Sat Apr 09, 2005 5:08 am    Post subject: Did you ever resolve the error on line 1088? Reply with quote

I'm getting the same error. So far I've managed to work through everything I've encountered, but chmodding didn't do anything for me at this point and I'm just trying to get the smarty_unit_test to run.

Thanks!
Back to top
View user's profile Send private message
cvb
Smarty n00b


Joined: 29 Jun 2005
Posts: 3

PostPosted: Wed Jun 29, 2005 7:45 pm    Post subject: Re: Smarty Error: the $compile_dir '..' does not exist... Reply with quote

boots wrote:

- you can verify that this is setup properly: create a php script to write a file into the directory you specified for templates_c (and/or cache). This should always work if the directory is writable by the script owner. The trick is to then try to read that file from your php script -- safe mode restricts reads, not writes. If that throws an error, you have a permission settings issue.


This is what seems to be happening to me. I'm using windows with apache/php/mysql. I've had no real issues getting smarty going on linux and mac os x, however, we're pulling our hair out. It should be noted that we aren't windows people, but have opened up permissions on the directories.

The copiled file is being written to templates_c, however we recieve this error when trying to read it.

Warning: Smarty::fetch(templates_c\%%6D^6D7^6D7C5625%%test.tpl.php) [function.fetch]: failed to open stream: No such file or directory in C:\php\PEAR\smarty\Smarty.class.php on line 1251

Warning: Smarty::fetch() [function.include]: Failed opening 'templates_c\%%6D^6D7^6D7C5625%%test.tpl.php' for inclusion (include_path='c:\php\PEAR\') in C:\php\PEAR\smarty\Smarty.class.php on line 1251

Are there any people who have faced this? I know it has to be a permissions issue. We have exhausted ourselfs in security panes, and opened up everything. Why can't we make it work?

What really fries my noodle is that it can read the file in templates dir, and write the file to templates_c dir, but then can't read the file in templates_c. WTH!


Last edited by cvb on Wed Jun 29, 2005 8:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Jun 29, 2005 8:01 pm    Post subject: Reply with quote

Maybe this will help:

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=5575
Back to top
View user's profile Send private message Visit poster's website
cvb
Smarty n00b


Joined: 29 Jun 2005
Posts: 3

PostPosted: Wed Jun 29, 2005 8:24 pm    Post subject: Reply with quote

mohrt wrote:
Maybe this will help:

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=5575


I must be the only person using Apache/Windows. Anyone else get this combo running?
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Jun 29, 2005 8:28 pm    Post subject: Reply with quote

Search the forum for "windows permissions" or "IIS permissions" (be sure to choose the search for all terms), see if you find what you're after. Also check the wiki.
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


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

PostPosted: Wed Jun 29, 2005 8:51 pm    Post subject: Reply with quote

I run Apache/Windows on some setups.

Your problem is permissions, notably the apache user must have read and write permissions on the templates_c directory as well as the files in it.

i - clear out all the files in templates_c
ii - ensure proper permissions for the user that the apache server is running as such that it has r/w on templates_c
iii - restart your apache server (or clear the filestatcache)

Another thing (this may be important if you are running across multiple drives/devices): use absolute paths instead of relative paths to define the templates, templates_c, cache and other Smarty related directories.
Back to top
View user's profile Send private message
speedieB
Smarty n00b


Joined: 03 Jul 2005
Posts: 2

PostPosted: Sun Jul 03, 2005 3:36 pm    Post subject: Reply with quote

seen this post .......
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=5627 stating that smarty can be installed locally on a shared webhosting server

been following the Codewalkers - Smarty for beginners tutorial..........
http://codewalkers.com/tutorials/56/1.html,

uploaded all the relevant files[content of smarty/libs] to my hosting company's server(apache1.3.33) got all directory structures correct in my libs.ini file but am getting a

Fatal error: Smarty error: unable to write to $compile_dir '/home/username/public_html/smartyrules/compile'. Be sure $compile_dir is writable by the web server user.

error message returned.

hosting co's apache has safe_mode =off
so I have put $smarty->use_sub_dirs=false; into my libs.ini file but still not getting any joy.

Please shed some light wise ones..........
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Sun Jul 03, 2005 11:24 pm    Post subject: Reply with quote

@speedieB: after you uploaded all the relevant files, did you create the appropriate work directories for Smarty? Did you grant them appropriate permissions so that the webserver can read/write them? One method of doing so is to cause them to be created from a PHP script instead of your FTP client, though both should work as long as you get the permissioning correct.
Back to top
View user's profile Send private message
cvb
Smarty n00b


Joined: 29 Jun 2005
Posts: 3

PostPosted: Mon Jul 04, 2005 3:03 am    Post subject: Reply with quote

boots wrote:

ii - ensure proper permissions for the user that the apache server is running


Ok, what user is apache using by default? Was won created during apache install?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Installation and Setup All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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