Re: [SMARTY] Saving compiled template fails. file_exists() problem?
| From: | Monte Ohrt | Date: | Thu, 02 Jan 2003 17:50:56 +0000 |
| Subject: | Re: [SMARTY] Saving compiled template fails. file_exists() problem? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6992@lists.php.net to get a copy of this message | ||
Are you using apache 2.0? I think the file_exists() problem is an apache
2.0 specific issue. I'm not sure if Smarty should worry about that since
it is not yet supported, and should eventually be fixed.
Also, a cleaner work around would be to use realpath() :
if ($_make_new_dir && !@file_exists(realpath($_new_dir)) &&
!@mkdir($_new_dir, 0771)) {
...
}
On Sat, 2002-12-28 at 14:28, Craig H. Anderson wrote:
> Help please. This is my first attempt with Smarty.
> This is on a Linux system. I am using these versions:
> php 4.2.3
> Smarty Version: 2.3.1
>
> The Smarty url file is at:
> /var/www/apache2-default/craig/php/foodbank01/HouseholdQryPage.php
>
> The template file is at:
> /var/www/apache2-default/craig/php/foodbank01/templates
> -rw-r--r-- 1 craig craig 805 Dec 28 02:35 HouseholdQryPage.tpl
>
> There are 3 sub directories
> /var/www/apache2-default/craig/php/foodbank01/
> drwxr-xr-x 3 craig craig 4096 Dec 28 01:31 configs
> drwxr-xr-x 3 craig craig 4096 Dec 28 02:35 templates
> drwxr-xr-x 3 www-data www-data 4096 Dec 28 02:01 templates_c
>
> file_exists() fails on templates_c relative to the current directory.
> file_exists() succeeds when given the full path.
>
> Some output I added to /usr/local/lib/smarty/Smarty.class.php:
> function _create_dir_structure($dir)
> $fp = posix_getcwd();
> $fp .= '/';
> $fp .= $_new_dir;
> if (@file_exists($fp)) /* debug cha */
> $fpe = 'true';
> else
> $fpe = 'false';
> $cwd = posix_getcwd();
> if (@file_exists($_new_dir)) /* debug cha */
> $fe = 'true';
> else
> $fe = 'false';
> if (@file_exists('/tmp')) /* debug cha */
> $tmp_e = 'true';
> else
> $tmp_e = 'false';
> error_log("_create_dir_structure cwd $cwd _new_dir $_new_dir
> fe $fe tmp_e $tmp_e fpe $fpe",0); /* debug cha */
>
>
> output in log file.
> _create_dir_structure cwd /var/www/apache2-default/craig/php/foodbank01
> _new_dir templates_c fe false tmp_e true fpe true
--
Monte Ohrt <monte@ispi.net>