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

Smarty and ISS -> installation problem

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


Joined: 24 Aug 2004
Posts: 1

PostPosted: Tue Aug 24, 2004 3:45 pm    Post subject: Smarty and ISS -> installation problem Reply with quote

Hi.

At the moment i am using a very basic template system - my own Smile
But i want to switch to smarty, and this quite fast. I have a we site up and running via my template system. Now i got time to do the switch.
It is a windows system - i know linux rocks much more, but i am not allowed to change it - with an ISS and php 4.3.6. safe_mode is set to no and $use_sub_dirs is set to false.

Now i must install smarty in our wokring dir, so that the htdocs root looks like this:
* pictures
* ...
* scripts
* scripts/smarty/...

Now i started the demo and got this error:

Quote:
Warning: fetch(templates_c\%%45^45E^45E480CD%%index.tpl.php): failed to open stream: No such file or directory in H:\ftp-hs-xxxxxxx\scripte\smarty\libs\Smarty.class.php on line 1247

Warning: fetch(): Failed opening 'templates_c\%%45^45E^45E480CD%%index.tpl.php' for inclusion (include_path='.;c:\php4\pear') in H:\ftp-hs-xxxxxxx\scripte\smarty\libs\Smarty.class.php on line 1247

Warning: _include(templates_c\%%C8^C83^C83FF1B3%%debug.tpl.php): failed to open stream: No such file or directory in H:\ftp-hs-xxxxxxx\scripte\smarty\libs\Smarty.class.php on line 1922

Warning: _include(): Failed opening 'templates_c\%%C8^C83^C83FF1B3%%debug.tpl.php' for inclusion (include_path='.;c:\php4\pear') in H:\ftp-hs-xxxxxxx\scripte\smarty\libs\Smarty.class.php on line 1922


Can somebody help me?
Thanks, AustrianCoder
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Tue Aug 24, 2004 6:14 pm    Post subject: Reply with quote

You said "scripts" but the error message refers to "scripte" -- a typo?
Back to top
View user's profile Send private message
chill_gun
Smarty Rookie


Joined: 23 Aug 2004
Posts: 13

PostPosted: Thu Aug 26, 2004 3:04 pm    Post subject: Reply with quote

i had the same problem with my winXP+IIS

it is doesn't looks like a type error Sad
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu Aug 26, 2004 3:10 pm    Post subject: Reply with quote

@chill_gun: are we supposed to divine what it looks like? Please post details if you are looking for help.
Back to top
View user's profile Send private message
chill_gun
Smarty Rookie


Joined: 23 Aug 2004
Posts: 13

PostPosted: Fri Aug 27, 2004 1:50 am    Post subject: Reply with quote

"boots" thanks for your reply!

I have learned Smarty for some days, but it doesn't really go further then i start. i have try a simple example come with Smarty and my system keep send the error massage below :
Code:

Warning: fetch(c:\inetpub\wwwroot\templatestudy\guestbook\templates_c\%%45^45E^45E480CD%%index.tpl.php): failed to open stream: No such file or directory in C:\Inetpub\wwwroot\templatestudy\Smarty\libs\Smarty.class.php on line 1247


seen to me the smarty doesn't generate file and store in guestbook\templates_c. here is the structure of the dir

C:\Inetpub\wwwroot\templatestudy\guestbook\cache
C:\Inetpub\wwwroot\templatestudy\guestbook\configs
C:\Inetpub\wwwroot\templatestudy\guestbook\templates\index.tpl
C:\Inetpub\wwwroot\templatestudy\guestbook\templates
C:\Inetpub\wwwroot\templatestudy\guestbook\index.php

i have set all the permission to the folder 'templatestudy' under the IIS
just in case.and i install the Smarty lib under 'templatestudy'

the code is


[php:1:a1ff323ef5]
<?php
define('SMARTY_DIR', 'C:\\Inetpub\\wwwroot\\templatestudy\\Smarty\\libs\\');
define('BASEDIR', dirname(__FILE__) . '\\');
echo BASEDIR;
require_once(SMARTY_DIR.'Smarty.class.php');

$smarty = new Smarty;


$smarty->template_dir = BASEDIR .'templates';
$smarty->compile_dir = BASEDIR .'templates_c';
$smarty->config_dir = BASEDIR .'configs';
$smarty->cache_dir = BASEDIR .'cache';

$smarty->assign('name', 'Ned');

$smarty->display('index.tpl');



?>[/php:1:a1ff323ef5]

index.tpl

{* Smarty *}

Hello, {$name}!

since the scripe is easy so there must be some problem with my php congifs or iis congifs. what kinds of require do smarty want from php configs? please help me out
Back to top
View user's profile Send private message
sadcafe
Smarty Rookie


Joined: 22 Sep 2004
Posts: 17

PostPosted: Wed Sep 22, 2004 11:37 am    Post subject: Reply with quote

I'm encountering the exact same problem using the exact same test example from the installation docs. Anyone help?

I am using IIS 5.1 and PHP 4.3.8 on a Windows XP Pro machine.

sadcafe.
_________________
Very Happy
Back to top
View user's profile Send private message
sadcafe
Smarty Rookie


Joined: 22 Sep 2004
Posts: 17

PostPosted: Wed Sep 22, 2004 1:51 pm    Post subject: Reply with quote

I've just uploaded the exact same files (with paths changed only) to my webhosting (Linux), and "VOILA!" It suddenly works...

Definitely an environment issue, but can anyone put their finger on it? I'd really prefer to develop my site locally (strangely enough!).

Cheers,

sadcafe

P.S. No, installing Linux is not an option!
_________________
Very Happy
Back to top
View user's profile Send private message
sadcafe
Smarty Rookie


Joined: 22 Sep 2004
Posts: 17

PostPosted: Thu Sep 23, 2004 8:46 am    Post subject: Reply with quote

Here's my app logic file c:\inetpub\wwwroot\gamers\index.php
[php:1:6ea025f153]<?php
// load Smarty library
require('c:/inetpub/wwwroot/smarty/Smarty.class.php');
$smarty = new Smarty;

$smarty->template_dir = 'c:/inetpub/wwwroot/gamers/templates/';
$smarty->compile_dir = 'c:/inetpub/wwwroot/gamers/templates_c/';
$smarty->config_dir = 'c:/inetpub/wwwroot/gamers/configs/';
$smarty->cache_dir = 'c:/inetpub/wwwroot/gamers/cache/';

$smarty->assign('name','Ned');

$smarty->display('index.tpl');
?>[/php:1:6ea025f153]

Here's the template it references, located at c:\inetpub\wwwroot\gamers\templates\index.tpl
Code:
{* Smarty *}

Hello, {$name}!


Here's the output from my local windows setup:
Local Output wrote:
Warning: fetch(c:/inetpub/wwwroot/gamers/templates_c/\%%45^45E^45E480CD%%index.tpl.php): failed to open stream: No such file or directory in c:\inetpub\wwwroot\smarty\Smarty.class.php on line 1248

Warning: fetch(): Failed opening 'c:/inetpub/wwwroot/gamers/templates_c/\%%45^45E^45E480CD%%index.tpl.php' for inclusion (include_path='.;c:\php4\pear') in c:\inetpub\wwwroot\smarty\Smarty.class.php on line 1248


Here's the output from my webhosting linux setup (with modified paths only):
Webhosting Output wrote:
Hello, Ned!


Although I don't know why it's not working on my windows setup, I suspect it might be one or more of the following:
1. Absolute paths need modifying to be "windows compatible"
2. The "templates_c" and "cache" directories need to be made writable by the PHP worker process
3. Something else completely

Can anyone clarify the steps required for 1 and 2 above for Windows?
Also, any other (number 3) suggestions would be greatly appreciated.

Thanks,

sadcafe.
_________________
Very Happy
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Thu Sep 23, 2004 9:18 am    Post subject: Reply with quote

sadcafe wrote:

1. Absolute paths need modifying to be "windows compatible"


use backslashes instead of forward slashes.
$smarty->template_dir = 'c:\\inetpub\\wwwroot\\gamers\\templates';
instead of
$smarty->template_dir = 'c:/inetpub/wwwroot/gamers/templates/';

also note: you don't need a trailing slash in template_dir, compile_dir etc.

Quote:
2. The "templates_c" and "cache" directories need to be made writable by the PHP worker process


sorry, i have no skills in that field.

Quote:
3. Something else completely


make sure tempnam() (http://php.net/tempnam) works correctly on your system. this is a pretty standard functions, but many posts on the forum here indicate that tempnam() is broken due to misconfiguration on a hell lot of IIS installations.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sadcafe
Smarty Rookie


Joined: 22 Sep 2004
Posts: 17

PostPosted: Thu Sep 23, 2004 10:00 am    Post subject: Reply with quote

Hi messju,

You are certainly on to something with the tempnam() function. Many thanks for your reply. I did a small test. Here is my test file:
[php:1:b4f77fee3d]<?php

$trypath = "c:\\inetpub\\wwwroot\\gamers\\templates_c";
printf("Attempting to use directory %s</br>", $trypath);

$tmpfname = tempnam($trypath, "FOO");
printf("Attempting to create file %s</br>", $tmpfname);

$handle = fopen($tmpfname, "w");
fwrite($handle, "writing to tempfile");
fclose($handle);
printf("File created was %s</br>", $tmpfname);

//unlink($tmpfname);
?>[/php:1:b4f77fee3d]

And here's the output:

My Output wrote:
Attempting to use directory c:\inetpub\wwwroot\gamers\templates_c
Attempting to create file C:\WINDOWS\TEMP\FOOB8.tmp
File created was C:\WINDOWS\TEMP\FOOB8.tmp


And so my question now is, what changes do I have to make to my source and/or the php configuration to allow tempnam() to create the file where I want? It sort of points back to the permissions thing again, but my IIS expertise is minimal if indeed that is the problem.

Any suggestions?

Thanks,

sadcafe
_________________
Very Happy
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Thu Sep 23, 2004 10:07 am    Post subject: Reply with quote

http://php.net/tempnam says:

"On Windows the TMP environment variable will override the dir parameter, on Linux the TMPDIR environment variable has precedence, while SVR4 will always use your dir parameter if the directory it points to exists. "

so unsetting TMP may help here.

but if your testscript successfully writes to the tempfile, then the problem is elsewhere.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sadcafe
Smarty Rookie


Joined: 22 Sep 2004
Posts: 17

PostPosted: Thu Sep 23, 2004 10:31 am    Post subject: Reply with quote

OK, I finally got it working!!!

The failure of tempnam() writing to the intended directory was indeed due to a permissions issue.

IIS runs as the IUSER_[machine name] local user so that user must have access to the "template_c" and "cache" folders. Once I allowed that user full permissions to those folders, everything worked! I feel such a dumbass now!

Many thanks for your help messju. You have helped more than you realise!

Marty (sadcafe)
_________________
Very Happy
Back to top
View user's profile Send private message
sadr1an1
Smarty n00b


Joined: 04 Nov 2004
Posts: 1
Location: Bucharest

PostPosted: Thu Nov 04, 2004 7:21 am    Post subject: Reply with quote

You are right AustrianCoder a had the same problem. I think it is a good thing to put it into the manual.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
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