Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

restarting apache after every edit
Goto page 1, 2  Next
 
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
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Thu May 25, 2006 8:34 pm    Post subject: restarting apache after every edit Reply with quote

Why would i need to do that? Is there an odd configuration or soemthing not set properly?

So every change I make to a template causes me to have to restart apache. Make a new tag and I get an error so I restart and its fine, until I have to do it again.
Back to top
View user's profile Send private message
susandc
Smarty n00b


Joined: 25 May 2006
Posts: 1

PostPosted: Thu May 25, 2006 8:52 pm    Post subject: Caching Reply with quote

Could this be a caching problem? Try using this:

$this->caching = false;

I had similar problems. You can turn it back on once you are out of development/testing phases.
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu May 25, 2006 11:56 pm    Post subject: Re: restarting apache after every edit Reply with quote

iceman42 wrote:
Why would i need to do that? Is there an odd configuration or soemthing not set properly?

So every change I make to a template causes me to have to restart apache. Make a new tag and I get an error so I restart and its fine, until I have to do it again.


Of course not. Can you be more specific as to the errors you are getting? Versions of PHP/Smarty you are using? What OS? What extensions? Etc?
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Wed May 31, 2006 6:01 pm    Post subject: Reply with quote

Errors are pretty much bogus errors, having to do with "unrecognized tag"


[client xx.xx.xx.xx] PHP Fatal error: Smarty error: [in index.tpl line 1]: syntax error: unrecognized tag: config_load file="config.conf" (Smarty_Compiler.class.php, line 436) in /usr/share/Smarty/Smarty.class.php on line 1095.

This code works, then I make an edit to the tpl file and I get the unrecognized tag error until I restart Apache, each and every time, and even if its something small like adding a period or some other non smarty or php code to the tpl page.
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Wed May 31, 2006 6:18 pm    Post subject: Reply with quote

A PHP fatal error is not a server abend and shouldn't require a restart. It seems that you don't have your plugins directory set properly for one. For two, why are you putting php code in your templates?

At this point it seems your code is doing something wrong. It is certainly not the norm so I suggest to you to post an example of code that demonstrates this behaviour.

Greetings.
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Wed May 31, 2006 6:40 pm    Post subject: Reply with quote

boots wrote:
A PHP fatal error is not a server abend and shouldn't require a restart. It seems that you don't have your plugins directory set properly for one. For two, why are you putting php code in your templates?

At this point it seems your code is doing something wrong. It is certainly not the norm so I suggest to you to post an example of code that demonstrates this behaviour.

Greetings.


Actually I have seen several examples of this in the forum, thats where I got the idea to restart to "fix" the problem.

Sorry didnt mean php code as there is no php code in the templates, it does occur any time I add anything to a template, any html, js, css, text, anything to a tpl file it will fail and I will have to restart apache.
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Wed May 31, 2006 7:55 pm    Post subject: Reply with quote

Tell us more because it seems simply perposterous.
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Wed May 31, 2006 8:07 pm    Post subject: Reply with quote

What would you like to know.

Setup has Smarty in /usr/share/Smarty.

Setup of site and templates is:
http://www.domain.com/site1
http://www.domain.com/site2
http://www.domain.com/site3
http://www.domain.com/site4
http://www.domain.com/site5


site(X)/index.php
Code:

require('/usr/share/Smarty/Smarty.class.php');

$smarty = new Smarty();

$smarty->compile_check = true;
$smarty->debugging = true;

$subdir = array_shift(preg_split('|/|', $_SERVER['PHP_SELF'], 0,PREG_SPLIT_NO_EMPTY));

$smarty->template_dir = '/home/site/domain.com/htdocs/smarty/templates';
$smarty->compile_dir = '/home/site/domain.com/htdocs/smarty/templates_c/'.$subdir;
$smarty->cache_dir = '/home/site/domain.com/htdocs/smarty/cache/'.$subdir;
$smarty->config_dir = '/home/site/domain.com/htdocs/smarty/configs';

include_once('/home/site/domain.com/php/config_news.php');
include_once('/home/site/domain.com/php/main_functions.php');
include_once('config.php');

$FP=frontPage($site_id);

$smarty->assign('Newspaper', $name);
$smarty->assign('Logo_Img', '/images/'.$subdir.'_logo.gif');
$smarty->assign('FP_Img', '/images/'.$subdir.'/'.$FP['imageName'].'');
$smarty->assign('Edition_Date',$FP['editionDate']);
$smarty->assign('News_Headline',$FP['newsHeadline']);
$smarty->assign('News_Blurb',$FP['newsBlurb']);
$smarty->assign('News_Link','newsStory.php?sid='.$FP['newsId'].'');
$smarty->assign('Image_Blurb',$FP['imageBlurb']);

$smarty->display('index.tpl');


site(X)/config.php
Code:

$name='BLah BLah';
$site_id=4;
$header_img='blah.gif';


htdocs/smarty/configs.config.conf
Code:

Tagline="BLah Newspaper."
Copyright="Copyright 2006 BLah.  All Rights Reserved. "


templates/index.tpl
Code:

{config_load file="BLah.conf"}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<html>
<head>
   <title>{$Newspaper} | {#Tagline#}</title>
   <LINK REL=StyleSheet HREF="/style.css" TYPE="text/css">
</head>

<body class="index">

<table width="100%" height="100%">
   <tbody>
      <tr>
         <td class='td1'>
            <table width="669" height="90%" style="margin:0 auto; border:1px solid #000;background-color:#FFF">
               <tbody>
                  <tr>
                     <td valign="top" align="center" width="100%" height="100%">
                        <table>
                           <tr>
                              <td align="center" style="padding-top: 25px"><img src={$Logo_Img}></td>
                           </tr>
                           <tr>
                              <td align="center" class="topnav"><a href="index.html" class="index">HOME</a>&&&<a href="/about.html" class="about">ABOUT</a>&&&<a href="/advertise.html" class="advertise">ADVERTISE</a>&&&<a href="yournews.html" class="yournews">SEND YOUR NEWS</a>&&&<a href="/publications.html" class="publication">OUR PUBLICATIONS</a>&&&<a href="/jobs.html" class="jobs">JOBS</a>&&&<a href="/contact.html" class="contact">CONTACT</a></td>
                           </tr>
                           <tr>
                              <td class="news" valign="top" align="left" width="100%" height="100%">
                                 <table>
                                    <tr>
                                       <td style="font: 10px Verdana; padding-bottom: 5px">{$Edition_Date}</td>
                                       <td style="font: 10px Verdana; padding-bottom: 5px; padding-left: 57px">:</td>
                                    </tr>
                                    <tr>
                                       <td width="222" valign="top">
                                          <div style="border-top: 1px solid #000;border-right: 1px solid #000"><img src={$FP_Img} width="222" height="177"></div>
                                          <div style="font: bold 10px Verdana; color: #000;padding-bottom: 12px;">{$Image_Blurb}</div>
                                       </td>
                                       <td width="320" valign="top" style="padding-left: 57px">
                                          <div style="font: bolder 15px Verdana; color: #194C88; padding-top: 15px">{$News_Headline}</div>
                                          <div style="font: 12px Helvetica; color: #000">{$News_Blurb}</div>
                                          <div class="read"><a href={$News_Link} class="read">Read More</a></div>
                                       </td>
                                    </tr>
                                    <tr>
                                       <td colspan='2' align='right'><div style='font: 10px Myriad Roman, Myriad,sans serif; color: #999; padding-bottom: 12px;padding-top: 91px'>{#Copyright#}&&&&&</div></td>
                                    </tr>
                                 </table>
                              </td>
                           </tr>
                        </table>
                     </td>
                  </tr>.
               </tbody>
            </table>
         </td>
      </tr>
   </tbody>
</table>

</body>
</html>



Anything else?
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu Jun 01, 2006 12:46 am    Post subject: Reply with quote

Hi.

Well, I was hoping for something less involved but...there is nothing there that I see that would make your server crash in any way assuming it is setup and configured properly. I notice that you haven't setup your plugins dir but probably should (especially since you use the config_load plugin).

Probably just typos/transcription errors but why: "htdocs/smarty/configs.config.conf"? I suppose you mean "htdocs/smarty/configs/config.conf" and that you also mean {config_load file="config.conf"} instead of {config_load file="BLah.conf"}.

Other than that it looks fine (well, except for the HTML, but that's your thing to hack on Smile -- but I really suggest you don't put any whitespace before the DOCTYPE declaration -- some browsers automatically go into quirks mode if you do.)

I'd love to know why you have to restart apache when you change a template. Is there an error (either PHP or Apache) other than the PHP/Smarty one you gave earlier? Because that error shouldn't imply a restart.
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Thu Jun 01, 2006 3:11 pm    Post subject: Reply with quote

These are the two errors that I consistently get, and the only two errors.
Quote:

[client 67.151.38.170] PHP Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Compilation failed: nothing to repeat at offset 17 in /usr/share/Smarty/Smarty_Compiler.class.php on line 435
[client 67.151.38.170] PHP Fatal error: Smarty error: [in index.tpl line 1]: syntax error: unrecognized tag: config_load file="config.conf" (Smarty_Compiler.class.php, line 436) in /usr/share/Smarty/Smarty.class.php on line 1095


I will get this until I bounce apache, then I dont get any Warnings, Errors, Notices or anything.

I have noticed one thing that leads me to believe its a complile or cache issue. As I mentioned earlier the site1-5 run the same code, run the same index.tpl the only difference is the config.php and index.php for each site is in the site(X) directory. When I go to domain.com/site1 and restart and reload the site loads fine, I have noticed now that when I go to site2 I have to restart, and so on and so forth until I have gone to each site.

So http://www.domain.com/site1/index.php the first time will not display anything, refresh and its fine. Click over to http://www.domain.com/site2/index.php the first time (right after visiting site1) and it will not display anything until I restart, refresh and its fine. So on and so forth.
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu Jun 01, 2006 3:31 pm    Post subject: Reply with quote

Are you even trying to debug your issue? Did you try getting a stack trace (xdebug can help with that)

I've just gone through the trouble of reproducing what you have posted and as expected, it works perfectly fine on my test machine running PHP 5.1.4/Smarty 2.6.14/Apache 1.3.35 (please always include your setup info).

Your problem is something else, I don't know what. Try making sure that permissions are set properly, that your configurations are up to date, that you have everything installed (including the plugins!) and that you are using up-to-date versions of the software.

Good luck, but I don't think I can help you at this point.

Best regards.
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Thu Jun 01, 2006 5:38 pm    Post subject: Reply with quote

boots wrote:
Are you even trying to debug your issue? Did you try getting a stack trace (xdebug can help with that)


Yes of course I did, and I dont get any debug popup when the page fails.

boots wrote:
I've just gone through the trouble of reproducing what you have posted and as expected, it works perfectly fine on my test machine running PHP 5.1.4/Smarty 2.6.14/Apache 1.3.35 (please always include your setup info).


You can view my PHP setup here: http://elauwit.mccullough-net.com/info.php
Smarty is the lastest and greatest. Version 2.6.14

boots wrote:
Your problem is something else, I don't know what. Try making sure that permissions are set properly, that your configurations are up to date, that you have everything installed (including the plugins!) and that you are using up-to-date versions of the software.


Everything is installed, everything has permissions that are correct. What seems to happen is template_c/site1 and site2 will have the compiled php files, but then site3-5 wont. So there seems to be an issue with templates compiling, yet I have left template_c wide open, and I have double and triple checked the permissions and users.
[/quote]
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Thu Jun 01, 2006 7:09 pm    Post subject: Reply with quote

This also occured when I tried your basic example.
Back to top
View user's profile Send private message
iceman42
Smarty Rookie


Joined: 25 May 2006
Posts: 9

PostPosted: Thu Jun 01, 2006 7:12 pm    Post subject: Reply with quote

I found the problem.

Turck MMCache was complied into PHP so I had to comment out the loaded module in php.ini

If you cant comment out the MMcache module due to other sites running MMcache then you can easily add an .htaccess file with the php_values

Quote:
php_flag mmcache.enable "0"
php_flag mmcache.optimizer "0"


Last edited by iceman42 on Thu Jun 01, 2006 7:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu Jun 01, 2006 7:32 pm    Post subject: Reply with quote

Glad you got it sorted. It just had to be something else Smile

Best.
Back to top
View user's profile Send private message
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
Goto page 1, 2  Next
Page 1 of 2

 
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