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
Regel 686 is include($_smarty_compile_path);
Regel 968 is touch($compile_path, $template_timestamp);
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:
Dit is het enige wat ik in de FAQ/Manuals van Smarty heb kunnen vinden: http://smarty.php.net/faq.php#11
Dit probleem heb ik dus niet, ik krijg een andere error dit in totaal: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
Edit: stukjes code uit line 968 en 686. 589 is de trigger_error functie.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
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:
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?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/
[ Voor 26% gewijzigd door Verwijderd op 15-12-2002 23:25 ]