Solved

# PHP error message

Posted on 2007-08-11
Medium Priority
1,200 Views
Last Modified: 2008-07-12
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>
<head>
<title>Smarty</title>
</head>
<body>
Hello, {\$name}!
</body>
</html>
0
Question by:erwingosepa
• 5
• 3
9 Comments

LVL 14

Expert Comment

ID: 19676106
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

ID: 19676260
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

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

Author Comment

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

Author Comment

ID: 19677488
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

ID: 19677974
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

ID: 19678595
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

ID: 19678643
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

m1tk4 earned 1000 total points
ID: 19679382
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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
###### Suggested Courses
Course of the Month17 days, 10 hours left to enroll

#### 830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.