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 tries to access dir / root on server

 
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 -> General
View previous topic :: View next topic  
Author Message
eis_os
Smarty Rookie


Joined: 06 Aug 2003
Posts: 8

PostPosted: Wed Aug 06, 2003 1:25 pm    Post subject: Smarty tries to access dir / root on server Reply with quote

Hi

I have the problem that Smarty tries to access the root directory of my server. (running under php safemode)

Quote:

<b>Warning</b>: file_exists() [<a href='http://www.php.net/function.file-exists'>function.file-exists</a>]: SAFE MODE Restriction in effect. The script whose uid is 1136 is not allowed to access / owned by uid 0 in /home/www/web179/html/test/extlib/smarty/Smarty.class.php on line 1520


Sad

I have made a print_r dump of the object I am using, so I am really sure that I have no broken paths as you can see:

Code:

shoppagesmarty Object
(
    [template_dir] => /home/www/web179/html/test/templates
    [compile_dir] => /home/www/web179/html/test/templates/templates_c
    [config_dir] => /home/www/web179/html/test/templates/configs
    [plugins_dir] => /home/www/web179/html/test/extlib/smarty/plugins
    [debugging] =>
    [debug_tpl] =>
    [debugging_ctrl] => NONE
    [compile_check] => 1
    [force_compile] =>
    [caching] =>
    [cache_dir] => /home/www/web179/html/test/templates/cache
    [cache_lifetime] => 300
    [cache_modified_check] =>
    [php_handling] => 0
    [security] =>
    [secure_dir] => Array
        (
        )

    [security_settings] => Array
        (
            [PHP_HANDLING] =>
            [IF_FUNCS] => Array
                (
                    [0] => array
                    [1] => list
                    [2] => isset
                    [3] => empty
                    [4] => count
                    [5] => sizeof
                    [6] => in_array
                    [7] => is_array
                    [8] => true
                    [9] => false
                )

            [INCLUDE_ANY] =>
            [PHP_TAGS] =>
            [MODIFIER_FUNCS] => Array
                (
                    [0] => count
                )

            [ALLOW_CONSTANTS] =>
        )

    [trusted_dir] => Array
        (
        )

    [left_delimiter] => {
    [right_delimiter] => }
    [request_vars_order] => EGPCS
    [compile_id] =>
    [use_sub_dirs] =>
    [default_modifiers] => Array
        (
        )

    [cache_handler_func] =>
    [global_assign] => Array
        (
            [HTTP_SERVER_VARS] => Array
                (
                    [0] => SCRIPT_NAME
                )

        )

    [undefined] =>
    [autoload_filters] => Array
        (
        )

    [config_overwrite] => 1
    [config_booleanize] => 1
    [config_read_hidden] =>
    [config_fix_newlines] => 1
    [default_template_handler_func] =>
    [compiler_file] => Smarty_Compiler.class.php
    [compiler_class] => Smarty_Compiler
    [config_class] => Config_File
    [_error_msg] =>
    [_tpl_vars] => Array
        (
            [SCRIPT_NAME] => /test/index.php
        )

    [_smarty_vars] =>
    [_sections] => Array
        (
        )

    [_foreach] => Array
        (
        )

    [_tag_stack] => Array
        (
        )

    [_conf_obj] =>
    [_config] => Array
        (
            [0] => Array
                (
                    [vars] => Array
                        (
                        )

                    [files] => Array
                        (
                        )

                )

        )

    [_smarty_md5] => f8d698aea36fcbead2b9d5359ffca76f
    [_version] => 2.5.0
    [_inclusion_depth] => 0
    [_compile_id] =>
    [_smarty_debug_id] => SMARTY_DEBUG
    [_smarty_debug_info] => Array
        (
        )

    [_cache_info] => Array
        (
        )

    [_file_perms] => 420
    [_dir_perms] => 505
    [_reg_objects] => Array
        (
        )

    [_plugins] => Array
        (
            [modifier] => Array
                (
                )

            [function] => Array
                (
                )

            [block] => Array
                (
                )

            [compiler] => Array
                (
                )

            [prefilter] => Array
                (
                )

            [postfilter] => Array
                (
                )

            [outputfilter] => Array
                (
                )

            [resource] => Array
                (
                )

            [insert] => Array
                (
                )

        )

)



So whats wrong with Smarty Question
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Wed Aug 06, 2003 1:42 pm    Post subject: Reply with quote

Try settiing [php:1:7c2f997ad7]ini_set('include_path', '.');[/php:1:7c2f997ad7]so that smarty isnt looking elseware in safemode
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
eis_os
Smarty Rookie


Joined: 06 Aug 2003
Posts: 8

PostPosted: Wed Aug 06, 2003 1:51 pm    Post subject: Reply with quote

My included path is already set to this:
".:./extlib/PEAR:/home/www/web179/html/test/extlib/smarty"
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Wed Aug 06, 2003 2:06 pm    Post subject: Reply with quote

Try just . and maybe the pear dir if you use pear because it fixed that problem for me a while back
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
eis_os
Smarty Rookie


Joined: 06 Aug 2003
Posts: 8

PostPosted: Wed Aug 06, 2003 2:18 pm    Post subject: Reply with quote

Ok, I tried it with .:./extlib/PEAR, doesn't work.

Then I tried to set the include_path to '.' after including pear,
then I get a blank page.

On my windows 2000 box it works until I add a '.' after pear including,
then I get the same blank page... (without it's working fine)

(The problem happens on a Linux Box to make it clear)

-update-

I have removed the complete template folder from the server and reuploaded mine from the windows 2000 box. -> Not working, / error remains...

Ok, I have chmoded the templates_c folder to world (as I already did with the old folder) the / error is gone. I add only pear and . to the path and it seems working so far...

Now I have to find a way to have "normal" file permissons on the folder Confused
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Wed Aug 06, 2003 2:44 pm    Post subject: Reply with quote

eis_os wrote:

Now I have to find a way to have "normal" file permissons on the folder Confused


the templates_c folder needs to be writable by the webserver. you can give it to the gid your webserver runs with and chmod 770 it. if you want tighter permissions you have to run php as cgi and not as a server-module.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
eis_os
Smarty Rookie


Joined: 06 Aug 2003
Posts: 8

PostPosted: Wed Aug 06, 2003 3:00 pm    Post subject: Reply with quote

Thanks, but webserver and files by me have different uids and gids, it doesn't work so ...
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Wed Aug 06, 2003 3:05 pm    Post subject: Reply with quote

you can "chown uid_of_you.gid_of_apache templates_c" this should work but you need to be root to change the directory's gid if you are not in the group of apache. after that a chmod g+s is good to ensure all files created in that folder have apaches gid (even when created by you).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Wed Aug 06, 2003 8:02 pm    Post subject: Reply with quote

*cough* he is on win2k *cough*
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


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

PostPosted: Wed Aug 06, 2003 9:28 pm    Post subject: Reply with quote

@Aztek: I think he was saying his problem was on Linux and that his Win2K box wasn't giving him problems. *cough* Wink
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Wed Aug 06, 2003 11:12 pm    Post subject: Reply with quote

Heh thanks for clearing that up I had something in my throat
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
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 -> General 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