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

failed to open stream: No such file or directory error

 
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
jyurkiw
Smarty Rookie


Joined: 03 Dec 2004
Posts: 5

PostPosted: Fri Dec 03, 2004 6:39 pm    Post subject: failed to open stream: No such file or directory error Reply with quote

I'm trying to get Smarty to work on a Windows NT server for a mini-site to test it out and convince my boss to use it when we re-program the rest of the site but I'm getting these errors...

Warning: fetch(D:\ItronixDev\forum\Smarty\compile\%%D8^D8F^D8FEC4EC%%forumTemplate.html.php): failed to open stream: No such file or directory in D:\ItronixDev\forum\Smarty\libs\Smarty.class.php on line 1252

Warning: fetch(): Failed opening 'D:\ItronixDev\forum\Smarty\compile\%%D8^D8F^D8FEC4EC%%forumTemplate.html.php' for inclusion (include_path='.;c:\php4\pear') in D:\ItronixDev\forum\Smarty\libs\Smarty.class.php on line 1252

From the looks of the messages, and the ammout of time I spent yesterday banging on my keyboard (I think I've seen almost every setup error smarty has to offer...), the pathing in the inc.php file is correct. Would this be a write permission problem? Looking at the directories in Filezilla none of the compiled files are being made when the script tries to execute because the directory is empty.

The specific line throwing this error looks like this:
Code:
$smarty->assign("body", $smarty->fetch("StandardRegForm.html"));


Has anyone come up against this error before?
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Fri Dec 03, 2004 8:53 pm    Post subject: Reply with quote

Apache or IIS? If under IIS, your cache/compile directories need both read/write/delete permissions for the associated IUSR.
Back to top
View user's profile Send private message
jyurkiw
Smarty Rookie


Joined: 03 Dec 2004
Posts: 5

PostPosted: Fri Dec 03, 2004 9:29 pm    Post subject: Reply with quote

boots wrote:
Apache or IIS? If under IIS, your cache/compile directories need both read/write/delete permissions for the associated IUSR.


IIS.

In this case, Smarty is being used in a mini-site off of the main directory as a bit of a test run. As a result, the directory looks something like this...

directoryPath/forum/Smarty/... ... libs and stuff

with the main pages and the libs.inc.php file located in directoryPath/forum/...

Few more Questions:
I know Smarty is suposed to go under the root directory, but it isn't in this case. Where exactly is my cache/compile directories suposed to go in relation to the smarty folder? My first guess is "wherever you tell smarty they're suposed to go." Am I right?

Also, Smarty is a snap to get to work with an apache server, but there seem to be some major pathing differences between Apache and Windows (namely a difference between how a windows server returns a path name with the PHP function dirname().) Do the smarty variables $smarty->compile_dir and $smarty->template_dir require foreward slashes? (windows seems to be hell bent on using backslashes for any kind of dynamic pathing. It loves to show you where on the drive things are but the backslashes seem to mess with smarty quite a bit... Sad )

The only folders I've got on my testing machine (different machine) is a template directory and a compile directory, and smarty is working fine. Do I need a cache directory too? The compile/template directories are one level down from my Smarty directory.

I've been digging through the smarty files to try and figure this stuff out myself, but there's a LOT of code to dig through. It was hard enough to get smarty working with PHP5. Getting it to work with backslashes instead of foreward slashes seems to be a bit harder Smile

Jeff
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Fri Dec 03, 2004 11:57 pm    Post subject: Reply with quote

jyurkiw wrote:
In this case, Smarty is being used in a mini-site off of the main directory as a bit of a test run. As a result, the directory looks something like this...

directoryPath/forum/Smarty/... ... libs and stuff

with the main pages and the libs.inc.php file located in directoryPath/forum/...


I think it is better to keep Smarty out of the webroot and put it in some reachable lib dir (either in the include dir or via an absolute path). Of course, your IUSR should belong to a group that has read privledges on the directory in which Smarty sits.

jyurkiw wrote:

Few more Questions:
I know Smarty is suposed to go under the root directory, but it isn't in this case. Where exactly is my cache/compile directories suposed to go in relation to the smarty folder? My first guess is "wherever you tell smarty they're suposed to go." Am I right?


Like Smarty, your compiled/cache dirs (and all of the base resources such as the templates and config files) should be kept out of your webroot if at all possible. Yes, you do need to tell Smarty where those locations are and it seems to result in the fewest hassles if you do so using absolute paths.

jyurkiw wrote:

Also, Smarty is a snap to get to work with an apache server, but there seem to be some major pathing differences between Apache and Windows (namely a difference between how a windows server returns a path name with the PHP function dirname().) Do the smarty variables $smarty->compile_dir and $smarty->template_dir require foreward slashes? (windows seems to be hell bent on using backslashes for any kind of dynamic pathing. It loves to show you where on the drive things are but the backslashes seem to mess with smarty quite a bit... Sad )


No, as far as the directory location specification goes it shouldn't matter and you can probably even inter-mix them since PHP will ultimately do the right thing. That said, it is "safer" to use the proper the separator for your environment. Don't forget about the DIRECTORY_SEPARATOR constant. Try searching the forums--there are several threads that relate to this. I am not familiar with the difference you describe regarding the basename function--it's been quite awhile since I had to use IIS. BTW, are you using FastCGI, SAPI or what?

jyurkiw wrote:

The only folders I've got on my testing machine (different machine) is a template directory and a compile directory, and smarty is working fine. Do I need a cache directory too? The compile/template directories are one level down from my Smarty directory.


You only need a cache directory if you turn on caching at which time it must be setup in the same way (permission-wise) you setup your compile directory.

jyurkiw wrote:

I've been digging through the smarty files to try and figure this stuff out myself, but there's a LOT of code to dig through. It was hard enough to get smarty working with PHP5. Getting it to work with backslashes instead of foreward slashes seems to be a bit harder Smile


Actually, Smarty should work just fine with PHP5 and the slash-issue should be transparent as well. Are you certain you have permissions set the way they ought to be? Here's a tip: take Smarty out of the equation for a bit so you don't get bogged down trying to trace it. Instead, create the directories you need, assign permissions and then write a simple PHP script that writes to and reads from the compile dir location you created. If that works, setting up Smarty should be a piece of cake.

Let us know how it goes!
Back to top
View user's profile Send private message
jyurkiw
Smarty Rookie


Joined: 03 Dec 2004
Posts: 5

PostPosted: Tue Dec 07, 2004 10:38 pm    Post subject: Reply with quote

We finally got write permisions to the compile directory and everything works now Smile (firewall problems were keeping us from accessing the server remotely...grrr...)

Let it be noted...that mean looking error up there...

^^^^
| | | |

means that you don't have write permissions to the compile directory.

Well, onto the next leg of the project! Very Happy

Jeff
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