Solved

# PHP error message

Posted on 2007-08-11
1,194 Views
I.m getting the following error php error:
PHP Warning: Smarty::include(include/smarty/templates_c\%%45^45E^45E480CD%%index.tpl.php) [function.Smarty-include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258 PHP Warning: Smarty::include() [function.include]: Failed opening 'include/smarty/templates_c\%%45^45E^45E480CD%%index.tpl.php' for inclusion (include_path='.;c:\php\includes;C:\Inetpub\wwwroot\WEBPORTAL\include\smarty') in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258

// the index.php file is:
<?php
require_once('c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/Smarty.class.php');
$smarty = new Smarty();$smarty->template_dir = 'include/smarty/templates';
$smarty->compile_dir = 'include/smarty/templates_c';$smarty->cache_dir = 'include/smarty/cache';
$smarty->config_dir = 'include/smarty/configs';$smarty->assign('name','Ned');
//** un-comment the following line to show the debug console
$smarty->debugging = true;$smarty->display('index.tpl');
?>

// the index.tpl

<html>
<title>Smarty</title>
<body>
Hello, {\$name}!
</body>
</html>
0
Question by:erwingosepa

LVL 14

Expert Comment

The warning is informing you that the file "index.tpl.php" cannont be found in that directory.

Your page is named index.tpl, but somewhere in your code (perhaps on another page) instead of including index.tpl, you are trying to include "index.tpl.php".

Check the file named Smarty.class.php and look in line 1258.  That is where the error is pointing you to.
0

Author Comment

Now I'm getting the following:
PHP Warning: Smary error: unable to read resource: "index.tpl" in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1095

the index.tpl is in the templates directory.

0

LVL 15

Expert Comment

Redefine compile_dir as global (i.e. based of C:/).
0

Author Comment

Redefine compile_dir as global (i.e. based of C:/). does not work.
0

Author Comment

Tchuki:The warning is informing you that the file "index.tpl.php" cannont be found in that directory.

The file in the directory is "index.tpl" not index.tpl.php.
Where is taking the "index.tpl.php" then?
0

LVL 15

Expert Comment

index.tpl is your original Smarty template. The warning shows that it can't find the COMPILED template that is created by Smarty in your .../templates_c directory. Compiled templates are actually PHP files, and Smarty creates a random name and appends .php to it.

It could be as easy as the compile directory not being set as writeable by your webserver - hence Smarty can't compile your tpl and then include the compiled .php.
0

Author Comment

if the statement mention above is true then I have problems with compiling. I checked the the directory in IIS and it has read and write permissions.
0

Author Comment

This is the eror that I get now. the debugging is set to true.

PHP Warning: Smarty::include(c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%6D^6D7^6D7C5625%%test.tpl.php) [function.Smarty-include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258 PHP Warning: Smarty::include() [function.include]: Failed opening 'c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%6D^6D7^6D7C5625%%test.tpl.php' for inclusion (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1258 PHP Warning: Smarty::include(c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%5F^5FE^5FE30B84%%debug.tpl.php) [function.Smarty-include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1925 PHP Warning: Smarty::include() [function.include]: Failed opening 'c:/Inetpub/wwwroot/WEBPORTAL/include/smarty/templates_c/\%%5F^5FE^5FE30B84%%debug.tpl.php' for inclusion (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\WEBPORTAL\include\smarty\Smarty.class.php on line 1925
0

LVL 15

Accepted Solution

You need to check the directory in Windows Explorer for the permissions to [SERVERNAME]_IUSR user, not only in IIS. Second - are the files Smarty is trying to include actually there (i.e. in /smarty/templates_c...)?
0

## Featured Post

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.