[PHP] Smarty Template Enige schrijfrechten probleem

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Ik ben bezig met een website waar ik Smarty als template parser heb gekozen. Lokaal werkt het verder prima maar zodra ik het upload naar de server van mijn klant krijg ik schrijfrechten problemen.

Dit is het enige wat ik in de FAQ/Manuals van Smarty heb kunnen vinden: http://smarty.php.net/faq.php#11
Q: I get the following error when running Smarty: Warning: Smarty error: problem creating directory "templates_c/239/239105369" in /path/to/Smarty.class.php on line 542

Your web server user does not have permission to write to the templates_c
directory, or is unable to create the templates_c directory. Be sure the
templates_c directory exists in the location defined in Smarty.class.php,
and the web server user can write to it. If you do not know the web server
user, chmod 777 the templates_c directory, reload the page, then check the
file ownership of the files created in templates_c. Or, you can check the
httpd.conf (usually in /usr/local/apache/conf) file for this setting:
User nobody
Group nobody
Dit probleem heb ik dus niet, ik krijg een andere error dit in totaal:
Warning: Smarty error: problem creating directory "/pad/naar/server/smarty/templates_c//%%192/%%1926952680" in /pad/naar/server//smarty/Smarty.class.php on line 589

Warning: Smarty error: problem writing '/pad/naar/server/smarty/templates_c//%%192/%%1926952680/main.tpl.php.' in /pad/naar/server//smarty/Smarty.class.php on line 589

Warning: unable to create file /pad/naar/server/smarty/templates_c//%%192/%%1926952680/main.tpl.php because No such file or directory in /pad/naar/server//smarty/Smarty.class.php on line 968

Warning: Unable to access /pad/naar/server/smarty/templates_c//%%192/%%1926952680/main.tpl.php in /pad/naar/server//smarty/Smarty.class.php on line 686

Warning: Failed opening '/pad/naar/server/smarty/templates_c//%%192/%%1926952680/main.tpl.php' for inclusion (include_path='.:/usr/local/lib/php') in /pad/naar/server//smarty/Smarty.class.php on line 686
Edit: stukjes code uit line 968 en 686. 589 is de trigger_error functie.

Regel 686 is include($_smarty_compile_path);
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// if we just need to display the results, don't perform output
        // buffering - for speed
        if ($_smarty_display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
            if ($this->_process_template($_smarty_tpl_file, $_smarty_compile_path))
            {
                include($_smarty_compile_path);
            }
        } else {
            ob_start();
            if ($this->_process_template($_smarty_tpl_file, $_smarty_compile_path))
            {
                include($_smarty_compile_path);
            }
            $_smarty_results = ob_get_contents();
            ob_end_clean();

            foreach ((array)$this->_plugins['outputfilter'] as $output_filter) {
                $_smarty_results = $output_filter[0]($_smarty_results, $this);
            }
        }


Regel 968 is touch($compile_path, $template_timestamp);
PHP:
1
2
3
4
5
6
7
8
9
10
11
/*======================================================================*\
    Function:   _write_compiled_template
    Purpose:
\*======================================================================*/
    function _write_compiled_template($compile_path, $template_compiled, $template_timestamp)
    {
        // we save everything into $compile_dir
        $this->_write_file($compile_path, $template_compiled, true);
        touch($compile_path, $template_timestamp);
        return true;
    }


Ik waarbij /pad/naar/server/ uiteraard goed is. Als ik de gecompileerde templates van lokaal gewoon upload naar de webserver dat werkt alles gewoon. Dus de paden zijn wel goed ingesteld. Maar dit is natuurlijk geen echte oplossing. Het heeft dus iets met die nobody:nobody te maken.

Dit staat in de manual:
chown nobody:nobody /web/www.mydomain.com/smarty/templates_c/
chmod 770 /web/www.mydomain.com/smarty/templates_c/

chown nobody:nobody /web/www.mydomain.com/smarty/cache/
chmod 770 /web/www.mydomain.com/smarty/cache/
Dit heb ik uiteraard geprobeerd, maar daarvoor heb ik geen rechten. Het gaat om een virtual host bij WidXS. Heeft iemand een idee hoe ik dit probleem kan oplossen?

[ Voor 26% gewijzigd door Verwijderd op 15-12-2002 23:25 ]


Acties:
  • 0 Henk 'm!

  • supakeen
  • Registratie: December 2000
  • Laatst online: 09-09 14:42
WideXS even mailen of ze dat voor je willen doen :?

Acties:
  • 0 Henk 'm!

  • luc
  • Registratie: Maart 2000
  • Niet online

luc

Of je zet de caching functie van smarty uit..
Even de docs er op nalezen maar 't is een configuratieoptie..

Acties:
  • 0 Henk 'm!

Verwijderd

"/pad/naar/server/smarty/templates_c//%%192/%%1926952680"

Die // lijkt me niet helemaal goed he?

Acties:
  • 0 Henk 'm!

Verwijderd

Ik heb dit probleem ook gehad, na effe zoeken kwam ik erachter dat smarty standaard een submap aanmaakt en daarin je templates zet, dit kan niet op elke server dus moet je het gebruik van submappen uitzetten, staat gewoon in de class van smarty, het betreft deze regel

var $use_sub_dirs = true; // use sub dirs for cache and compiled files?
// sub directories are more efficient, but
// you can set this to false if your PHP environment
// does not allow the creation of them.

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
"/pad/naar/server/smarty/templates_c//%%192/%%1926952680"

Die // lijkt me niet helemaal goed he?
Zoals ik al zei, het pad klopt wel. Lokaal werkt het prima.
Ik heb dit probleem ook gehad, na effe zoeken kwam ik erachter dat smarty standaard een submap aanmaakt en daarin je templates zet, dit kan niet op elke server dus moet je het gebruik van submappen uitzetten, staat gewoon in de class van smarty, het betreft deze regel
Thanks! Dit was de oplossing, het werkt nu perfect.
Pagina: 1