|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
liming Smarty n00b
Joined: 11 Oct 2012 Posts: 3
|
Posted: Thu Oct 11, 2012 8:43 am Post subject: 500 error with example when call display() |
|
|
I use the latest version.
I follow the document sample and get the http 500 error
my php code
Code: |
<?php
require_once('/var/www/smarty/libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->debugging = true;
$smarty->setTemplateDir('/var/www/html/drop/templates/');
$smarty->setCompileDir('/var/www/html/drop/templates_c/');
$smarty->setConfigDir('/var/www/html/drop/configs/');
$smarty->setCacheDir('/var/www/html/drop/cache/');
$smarty->assign('name','Ned');
$smarty->display('index.tpl');
?>
|
my index.tpl
Code: |
{* Smarty *}
Hello {$name}, welcome to Smarty!
|
I use testinstall() and all are fine
Code: |
Smarty Installation test...
Testing template directory...
/var/www/html/drop/templates is OK.
Testing compile directory...
/var/www/html/drop/templates_c is OK.
Testing plugins directory...
/var/www/smarty/libs/plugins is OK.
Testing cache directory...
/var/www/html/drop/cache is OK.
Testing configs directory...
/var/www/html/drop/configs is OK.
Testing sysplugin files...
... OK
Testing plugin files...
... OK
Tests complete.
|
the php log...
Code: |
Oct 11 16:32:55 ubuntu httpd: PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/smarty/libs/sysplugins/smarty_internal_templatelexer.php on line 153
|
|
|
Back to top |
|
liming Smarty n00b
Joined: 11 Oct 2012 Posts: 3
|
Posted: Thu Oct 11, 2012 9:17 am Post subject: |
|
|
If I use php CLI run it, it seems run normal
Code: |
root@ubuntu:/var/www/html/drop# php index.php
Hello Ned, welcome to Smarty!
<script type="text/javascript">
_smarty_console = window.open("","consoled41d8cd98f00b204e9800998ecf8427e","width=680,height=600,resizable,scrollbars=yes");
_smarty_console.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n <title>Smarty Debug Console<\/title>\n<style type=\"text/css\">\n\nbody, h1, h2, td, th, p {\n font-family: sans-serif;\n font-weight: normal;\n font-size: 0.9em;\n margin: 1px;\n padding: 0;\n}\n\nh1 {\n margin: 0;\n text-align: left;\n padding: 2px;\n background-color: #f0c040;\n color: black;\n font-weight: bold;\n font-size: 1.2em;\n }\n\nh2 {\n background-color: #9B410E;\n color: white;\n text-align: left;\n font-weight: bold;\n padding: 2px;\n border-top: 1px solid black;\n}\n\nbody {\n background: black; \n}\n\np, table, div {\n background: #f0ead8;\n} \n\np {\n margin: 0;\n font-style: italic;\n text-align: center;\n}\n\ntable {\n width: 100%;\n}\n\nth, td {\n font-family: monospace;\n vertical-align: top;\n text-align: left;\n width: 50%;\n}\n\ntd {\n color: green;\n}\n\n.odd {\n background-color: #eeeeee;\n}\n\n.even {\n background-color: #fafafa;\n}\n\n.exectime {\n font-size: 0.8em;\n font-style: italic;\n}\n\n#table_assigned_vars th {\n color: blue;\n}\n\n#table_config_vars th {\n color: maroon;\n}\n\n<\/style>\n<\/head>\n<body>\n\n<h1>Smarty Debug Console - Total Time 0.06008<\/h1>\n\n<h2>included templates & config files (load time in seconds)<\/h2>\n\n<div>\n <font color=brown>/var/www/html/drop/templates/index.tpl<\/font>\n <span class=\"exectime\">\n (compile 0.05629) (render 0.00041) (cache 0.00000)\n <\/span>\n <br>\n<\/div>\n\n<h2>assigned template variables<\/h2>\n\n<table id=\"table_assigned_vars\">\n <tr class=\"even\"> \n <th>$SCRIPT_NAME<\/th>\n <td><b>Smarty_Variable Object (3)<\/b><br><b> ->value<\/b> = "index.php"<br><b> ->nocache<\/b> = <i>false<\/i><br><b> ->scope<\/b> = "Global"<\/td><\/tr>\n <tr class=\"odd\"> \n <th>$name<\/th>\n <td><b>Smarty_Variable Object (3)<\/b><br><b> ->value<\/b> = "Ned"<br><b> ->nocache<\/b> = <i>false<\/i><br><b> ->scope<\/b> = "Smarty root"<\/td><\/tr>\n <\/table>\n\n<h2>assigned config file variables (outer template scope)<\/h2>\n\n<table id=\"table_config_vars\">\n \n<\/table>\n<\/body>\n<\/html>\n");
_smarty_console.document.close();
</script>
root@ubuntu:/var/www/html/drop#
|
So it means that is apache problem? |
|
Back to top |
|
liming Smarty n00b
Joined: 11 Oct 2012 Posts: 3
|
Posted: Thu Oct 11, 2012 9:38 am Post subject: |
|
|
oh god...I use php CLI to run php file and then the browser can show it, too...
What happen on it?
Other pages I also use PHP CLI to run first and the browser also can view those pages. 500 error if fixed... |
|
Back to top |
|
|
|
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
|