Ask your Symfony questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Why does template die mid-decoration? Symfony


So, we are trying to move to the RackSpace Cloud. We are trying to set up our code so that we can have one Symfony project and then have the code shared among hundreds of websites. As a test, I'm trying to set up the first site on the new server. The templates are rendering oddly.

The front page renders correctly:

[[LINK href=""]][[/LINK]]

but this page dies mid way:

[[LINK href=""]][[/LINK]]

See screen shot. The error only happens when you are logged in.

In the Apache error logs, the only error is:

[Tue Nov 30 21:52:23 2010] [error] [client] Action "sf/sf_web_debug" does not exist., referer:
[Tue Nov 30 21:52:23 2010] [error] [client] Action "sf/sf_web_debug" does not exist., referer:
[Tue Nov 30 21:52:23 2010] [error] [client] Action "sf/sf_web_debug" does not exist., referer:
[Tue Nov 30 21:52:23 2010] [error] [client] Action "sf/sf_web_debug" does not exist., referer:

There are no recent errors in the Symfony logs.

No errors appear on screen, even when I look using a dev controller.

In layout.php the area of the template looks like this:


<div id="topbar">
<div class="wrapper">

<form id="filtered-search" action="<?php echo url_for('search/index') ?>" method="get">
<input name="query" class="field" type="text" value="<?php echo $sf_request->getParameter('query') ?>"/>
<input type="button" id="magnify" value="Search" onclick="document.getElementById('filtered-search').submit();" />

<!-- tailor_made_answer_template_block_2_start -->

<!-- This UL contains the links in the top bar. The links change when the user is logged in -->

<ul id="nav">
<!-- <li><a href="/archives">Archives</a></li> -->
<li><a href="/page/contact">Contact</a></li>
<li><a href="/question/refunded">Refunds</a></li>

<?php if (!$sf_user->isAuthenticated()): ?>

<!-- These links only appear if the user is not logged in -->

<li><a href="<?php echo url_for('sfGuardAuth/signin') ?>">Log In</a></li>
<li><a href="<?php echo url_for('user/register') ?>">Register</a></li>
<?php else: ?>

<!-- These links only appear if the user is logged in -->

<li><a href="<?php echo url_for('sfGuardAuth/signout') ?>">Log Out</a></li>
<li><a href="<?php echo url_for('user/home') ?>">Welcome back, <?php echo $sf_user->getGuardUser()->getProfile()->getNiceName() ?></a></li>
<?php endif ?>

<!-- tailor_made_answer_template_block_2_end -->


<div id="page">

<!-- tailor_made_answer_template_block_3_start -->

<!-- This the HTML for the top part of the page. The TEMPLATE_TAGS here draw values that you, the owner of the site, should have already set from\
the admin page -->

<div id="masthead">
<a id="logo" href="/" title="Back Home"><?php echo sfConfig::get('app_subdomain_specific_info_nice_name_for_site') ?> | Become a <?php echo sfCon\
fig::get('app_subdomain_specific_info_technology_nice_name') ?> Expert and Win Money</a>
<a id="mast-asker" href="/page/static/name/About" title="Read more about <?php echo sfConfig::get('app_subdomain_specific_info_technology_nice_name\
') ?>">Post emergency <?php echo sfConfig::get('app_subdomain_specific_info_technology_nice_name') ?> questions for fast help...</a>
<a id="mast-expert" href="/page/static/name/About" title="Read more about <?php echo sfConfig::get('app_subdomain_specific_info_technology_nice_nam\
e') ?>">...Or answer questions first &amp; win prize money.</a>

<!-- tailor_made_answer_template_block_3_end -->

<div id="main">

<div id="content">
<?php if ($sf_user->hasFlash('notice')): ?>
<p class="alert"><?php echo $sf_user->getFlash('notice') ?></p>
<?php endif ?>
<?php if ($sf_user->hasFlash('uploadError')): ?>
<p class="alert"><?php echo $sf_user->getFlash('uploadError') ?></p>
<?php endif ?>
<?php echo $sf_content ?>

Any thoughts about how I might be able to get an error message that gives me useful information?

This problem happens to me in Chrome and FireFox on a Mac. Have not tested on the a PC.

I'm guessing the problem has something to do with being logged in, or with some kind of shared session data, or the fact that we've got one cache folder for the whole server (though we've turned off most forms of caching). The software works fine on our other servers, such as the one you are looking at now. So it has to be something specific to the way we've got it set up on this server.

Answers (2)


José Nahuel Cuesta Luengo answers:

Two guesses:

1) You haven't made the symlink for 'sf' web dir: you should add a symbolic link (or copy, otherwise) to %SF_DATA_DIR%/web/sf named 'sf' in your web dir. That will stop the errors in your apache logs stating 'sf/sf_web_debug does not exist'.

2) Have you taken a look at the HTML page rendered with your browser? Sometimes, when PHP errors occur inside a hidden HTML tag or something like that, such errors won't show up directly in the browser, but if you take a look at the last part of the source code of the rendered HTML, they might appear.

Lawrence Krubner comments:

I've looked at the source code. Please go look at it yourself. You can create an account.

The crazy part is, the form works. You can go all the way through and get to PayPal. So the code in the actions works.

And then something strips out the top of the template.

José Nahuel Cuesta Luengo comments:

It doesn't seem to be an error that kills PHP. If that was the case, you'd get everything from the top of the page (including the <head> element and everything else) until the line in which the error killed PHP. But that's not this case. Are you testing this in a 'dev' environment? That would give you some info on possible errors and which views are being rendered.

The form will still work, as the whole <form> tag is being rendered, so I wouldn't give that part much more thinking..

I'm thinking of a view configuration problem, but if the code for your layout.php view is the one you pasted before it shouldn't be randomly stripped by symfony. Have you changed something in your view.yml file for that module/action?

Lawrence Krubner comments:

Good thought! Somehow the module view.yml never made it into Subversion and was not being deployed! Thanks for thinking of that!


Nate Flink answers:

DO you have enough memory to render the page? Check php.ini. I think the default is something like 8m.

Here is possibly a useful like for doing this:

This is usually a setting that always needs to be increased for some symfony apps.

Lawrence Krubner comments:

How can I get an error message that tells me what the problem is?

I could guess a hundred things, but I'd rather not.

I would rather get a good error message.

Lawrence Krubner comments:

By the way, memory limit is 128 megs, which should be enough. Its the same as this server, which is handling the software just fine.

Nate Flink comments:

Php usually complains when it runs out of memory but it depends what the error settings are.

To view errors in php:

ini_set('display_errors', '1');

just drop that in as the first two lines in the suspect template.