symfony
symfony forum
Home » legacy support » symfony 1.0 » [resolved] When SF_DEBUG is false Content-Length is null :/
[resolved] When SF_DEBUG is false Content-Length is null :/ [message #17841] Wed, 13 December 2006 18:51 Go to next message
j0k3r  is currently offline j0k3r
Messages: 44
Registered: December 2006
Location: France - Paris
Member
Hi all !

I have install sf 1.0.0beta2 "by hand" and I use it with xampp 1.5.5a (with apache on 8080).
I have init a new project and add an app frontend. When i go to "/frontend_dev.php" i have the sf debug bar with all images, and the beautiful page "Congratulations" .

But, when i want to see on "prod", i go to "/index.php" and here i have noting display and firefox allow me to download an empty file index.php.
When i take a look to the header request, all seems to be fine except :
Quote:

X-Powered-By: PHP/5.2.0
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/x-httpd-php


After some investigation, i discover that the problem comes from SF_DEBUG. When it is to true, the page is display fine and when it is to false ... doesn't work :/

If someone knows something about that, it will be very cool Smile
And thanks for your answers Smile

[Updated on: Wed, 10 January 2007 18:01]

Re: When SF_DEBUG is false Content-Length is null :/ [message #17946 is a reply to message #17841 ] Fri, 15 December 2006 07:21 Go to previous messageGo to next message
fabien  is currently offline fabien
Messages: 484
Registered: October 2005
Faithful Member
Administrator
Can you have a look at your Apache error log messages. I think your page is empty because something crashes somewhere in symfony.
Re: When SF_DEBUG is false Content-Length is null :/ [message #18085 is a reply to message #17946 ] Mon, 18 December 2006 13:46 Go to previous messageGo to next message
lucjan  is currently offline lucjan
Messages: 69
Registered: December 2006
Location: Gdansk
Member
There seems to be no error reported in apache log.

Lucjan
Re: When SF_DEBUG is false Content-Length is null :/ [message #18155 is a reply to message #17841 ] Tue, 19 December 2006 11:20 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9514
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Can you turn on symfony logging and see what that puts in the symfony log?


Remember Palestine
Re: When SF_DEBUG is false Content-Length is null :/ [message #18170 is a reply to message #18155 ] Tue, 19 December 2006 13:15 Go to previous messageGo to next message
lucjan  is currently offline lucjan
Messages: 69
Registered: December 2006
Location: Gdansk
Member
Not sure if I did it properly, but I have setted up in ./apps/frontend/config/logging.yml :

prod:
enabled: on
level: debug
rotate: on
purge: off

And there was no log created for prod, only for dev Sad
Re: When SF_DEBUG is false Content-Length is null :/ [message #18175 is a reply to message #17841 ] Tue, 19 December 2006 14:06 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9514
Registered: January 2006
Location: West Midlands, UK
Faithful Member
I'd find the php source of the debugging stuff, take a backup, and then add echo statements in there until the culprit is tracked down. As Fabien says, there is something in there that is causing a fatal error before symfony gets a chance to render anything.


Remember Palestine
Re: When SF_DEBUG is false Content-Length is null :/ [message #18191 is a reply to message #18175 ] Tue, 19 December 2006 15:56 Go to previous messageGo to next message
lucjan  is currently offline lucjan
Messages: 69
Registered: December 2006
Location: Gdansk
Member
Suggested way of debugging lead to this file:
./cache/frontend/prod/config/config_bootstrap_compile.yml.ph p

where it seems to crash on a part:


if (!$sf_debug && !sfConfig::get('sf_test'))
{
$core_classes = $sf_app_config_dir_name.'/core_compile.yml';
$configCache->import($core_classes, false);
}

there is no file

./apps/frontend/prod/config/core_compile.yml

any suggestions?
Can the lack of this file may be a problem? Or should we search deeper?
Re: When SF_DEBUG is false Content-Length is null :/ [message #18203 is a reply to message #17841 ] Tue, 19 December 2006 16:57 Go to previous messageGo to next message
lucjan  is currently offline lucjan
Messages: 69
Registered: December 2006
Location: Gdansk
Member
Further debug lead me to file:

sfCompileConfigHandler.class.php

and method execute where this part fails:

if (!sfConfig::get('sf_debug'))
{
$data = sfToolkit::stripComments($data);
}

and another deeper search showed up that the call inside of sfToolkit::stripComments that fails is this one:

$tokens = token_get_all($source);

The $source variable seems to contain all php code merged with all require/require_once calls.
Re: When SF_DEBUG is false Content-Length is null :/ [message #19393 is a reply to message #17841 ] Wed, 10 January 2007 09:46 Go to previous messageGo to next message
lucjan  is currently offline lucjan
Messages: 69
Registered: December 2006
Location: Gdansk
Member
I have pointed exactly where is the problem in my previous posts, but I still don't know why this function call fails and is there is any solution for this.

Can anyone help? It is rather important issue for me.
Re: When SF_DEBUG is false Content-Length is null :/ [message #19401 is a reply to message #18203 ] Wed, 10 January 2007 10:42 Go to previous messageGo to next message
fabien  is currently offline fabien
Messages: 484
Registered: October 2005
Faithful Member
Administrator
Try to disable comment stripping. In you settings.yml:

prod:
  .settings:
    strip_comments: off

Re: When SF_DEBUG is false Content-Length is null :/ [message #19402 is a reply to message #17841 ] Wed, 10 January 2007 11:19 Go to previous messageGo to next message
lucjan  is currently offline lucjan
Messages: 69
Registered: December 2006
Location: Gdansk
Member
Seems to solve the problem as a walkaround, but it is enough for me, thanks a lot Smile
Re: When SF_DEBUG is false Content-Length is null :/ [message #19405 is a reply to message #19402 ] Wed, 10 January 2007 11:26 Go to previous messageGo to next message
j0k3r  is currently offline j0k3r
Messages: 44
Registered: December 2006
Location: France - Paris
Member
Thanks a lot too Very Happy
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #21442 is a reply to message #17841 ] Mon, 12 February 2007 15:16 Go to previous messageGo to next message
gudsoft  is currently offline gudsoft
Messages: 6
Registered: January 2007
Junior Member
Sorry but I've tried to set strip_comments: off but It doesn't work.

I've set define('SF_DEBUG', true); to (temporarily) solve the problem.

But I don't think the problem is resolved !
Re: When SF_DEBUG is false Content-Length is null :/ [message #21904 is a reply to message #19401 ] Sun, 18 February 2007 02:27 Go to previous messageGo to next message
aljungberg  is currently offline aljungberg
Messages: 5
Registered: February 2007
Location: San Jose, CA, USA
Junior Member
I have experienced the same problem. Setting strip comments to false solved the issue but it would be nice if there was a smoother solution. Besides, it took me four hours to find this post and solve the problem. :)
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #25060 is a reply to message #17841 ] Wed, 04 April 2007 10:33 Go to previous messageGo to next message
Schnaaf  is currently offline Schnaaf
Messages: 89
Registered: June 2006
Member
I have experienced exact the same problem, however the problem only occured in one module. This module has three actions one works fine, the other two show an empty page. That behaviour rules out the suggested strip_comments fix.

After investigating the differences between the working and non-working actions I've discovered a few unset() calls in the non-working actions. Removing those made my actions work fine again.

Any particular reason why unset can't be used or should this be considdered a bug?
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #26227 is a reply to message #17841 ] Tue, 24 April 2007 20:00 Go to previous messageGo to next message
nfuids  is currently offline nfuids
Messages: 58
Registered: April 2007
Location: Quebec
Member
I too have experienced the exact same problem. Lost almost 4 days looking for this with the help of IRC users ! Thanks for the support!

Now, it'd be nice to know what's going on Smile

For every project I create, I have to do this.. I'm pretty sure it is not what it's supposed to be Smile

Thanks
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #27301 is a reply to message #17841 ] Tue, 15 May 2007 16:42 Go to previous messageGo to next message
andyjeffries  is currently offline andyjeffries
Messages: 36
Registered: May 2007
Member
I'm another user (actually an absolutely brand new user, although I have just ordered the book from Amazon.co.uk) that's experiencing this problem.

I don't know what's causing this - but if Symfony hadn't already impressed me with the screencasts I don't know if I'd have got this far.

Guys, you really need to fix this problem - you could be losing a lot of potential users with this!
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #29623 is a reply to message #27301 ] Mon, 18 June 2007 11:20 Go to previous messageGo to next message
lajkonik86  is currently offline lajkonik86
Messages: 190
Registered: June 2007
Location: The Netherlands
Senior Member
add me to the list,
no index.php displaying, while in the tutorial everything goes so smooth:P
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #29626 is a reply to message #29623 ] Mon, 18 June 2007 11:26 Go to previous messageGo to next message
andyjeffries  is currently offline andyjeffries
Messages: 36
Registered: May 2007
Member
I couldn't find it in the bug tracking system, so I've submitted it so I know it's in there:

http://trac.symfony-project.com/trac/ticket/1862
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #29684 is a reply to message #29626 ] Mon, 18 June 2007 21:55 Go to previous messageGo to next message
fabien  is currently offline fabien
Messages: 484
Registered: October 2005
Faithful Member
Administrator
Can you try to comment line 187 and 188 in lib/util/sfToolkit.class.php file to see if it solves the problem?

    // tokenizer available?
    if (!function_exists('token_get_all'))
    {
#      $source = sfToolkit::pregtr($source, array('#/\*((?!\*/)[\d\D\s])*\*/#' => '',   // remove /* ... */
#                                                 '#^\s*//.*$#m'               => '')); // remove // ...

      return $source;
    }
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #29687 is a reply to message #29684 ] Mon, 18 June 2007 22:44 Go to previous messageGo to next message
andyjeffries  is currently offline andyjeffries
Messages: 36
Registered: May 2007
Member
No, still gives a 0 content-length/blank page.

I literally did:

symfony init-project foo
symfony init-app foo frontend
symfony init-module foo frontend items
nano -w apps/frontend/config/routing.yml
(changed homepage rule to go to items/index)
nano -w apps/frontend/modules/items/actions/actions.class.php
(changed it to return sfView::SUCCESS rather than redirect)
nano -w apps/frontend/modules/items/templates/indexSuccess.php
(changed it to have the content FOO)
symfony cc

It works using:

http://localhost/frontend_dev.php/
but not using:
http://localhost/

I'm using symfony 1.0.3 on PHP 5.2.1 on Ubuntu 7.04.

Cheers,


Andy
Re: [really-resolved] When SF_DEBUG is false Content-Length is null :/ [message #29956 is a reply to message #29687 ] Fri, 22 June 2007 09:50 Go to previous messageGo to next message
andyjeffries  is currently offline andyjeffries
Messages: 36
Registered: May 2007
Member
Whatever you did in 1.0.4 you fixed it. I've upgraded to 1.0.4, repeated the steps above and it now works fine.
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #30911 is a reply to message #17841 ] Thu, 05 July 2007 22:31 Go to previous messageGo to next message
s3ntinel76  is currently offline s3ntinel76
Messages: 1
Registered: July 2007
Location: UK
Junior Member
The problem still occurs in symfony 1.0.5, with XAMPP 1.6.2 (PHP 5.2.2) on RHEL4.

core_compile.yml is still the culprit with token_get_all(), but the workaround with strip_comments set to off does enable the controller to work.
icon11.gif  Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #32211 is a reply to message #17841 ] Wed, 25 July 2007 11:51 Go to previous messageGo to next message
symfony_in_china  is currently offline symfony_in_china
Messages: 1
Registered: July 2007
Junior Member
This is caused for memory list.
try to change memory_limit in php.ini. When I set it as follows the symfony is OK.

memory_limit = 32M 


Welcome to www.symfony.net.cn
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #33027 is a reply to message #32211 ] Tue, 07 August 2007 22:14 Go to previous messageGo to next message
lholtzclaw  is currently offline lholtzclaw
Messages: 1
Registered: August 2007
Junior Member
symfony_in_china wrote on Wed, 25 July 2007 11:51

This is caused for memory list.
try to change memory_limit in php.ini. When I set it as follows the symfony is OK.

memory_limit = 32M 




I'll confirm that; script capable memory limit needs to be changed to the above setting or higher.

I've reproduced this problem and changing the memory_limit directive in your php.ini will resolve this issue.
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #34971 is a reply to message #17841 ] Wed, 05 September 2007 16:43 Go to previous messageGo to next message
spl13  is currently offline spl13
Messages: 7
Registered: June 2006
Junior Member
Wow! It took me a while to find this, but it works like a charm.
On my development machine (Windows) this wasn't a problem, but my live machine (Unix/FreeBSD) showed the white page of death. I worked-around this by setting SF_DEBUG to true, but restoring this to false and turning off strip_comments works better!
Any ideas why this is happening at all?
icon4.gif  php tokenizer support solved the problem [message #35357 is a reply to message #17841 ] Tue, 11 September 2007 20:04 Go to previous messageGo to next message
Atko  is currently offline Atko
Messages: 5
Registered: February 2007
Location: Budapest, Hungary
Junior Member
I have exactly the same problem with symfony 1.0.7. Setting
strip_comment: off

in settings.yml solved the problem, but I was not pleased with this solution. Finally I recompiled php (I'm using gentoo) with tokenizer support, and now everything works like a charm.
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #35381 is a reply to message #17841 ] Wed, 12 September 2007 10:04 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9514
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Hmm, 32M of memory per PHP instance seems rather high for a base symfony install. Anyway according to the manual, since PHP 4.3, compiled binaries have needed to have been specifically built with --disable-tokenizer in order for the tokeniser functions to be unavailable. I guess some distros have used that, perhaps because it is a rarely used set of functions.

With the assumption that the absence of the tokenizer is the problem, I've raised a ticket for you:

http://trac.symfony-project.com/trac/ticket/2231


Remember Palestine
Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #35454 is a reply to message #35381 ] Thu, 13 September 2007 08:53 Go to previous messageGo to next message
fabien  is currently offline fabien
Messages: 484
Registered: October 2005
Faithful Member
Administrator
I'm just unable to reproduce the error. It really drives me crazy. I can lower my memory limit to just 1Mo and everything just works fine (I've tested with PHP 5.1.6 and PHP 5.2.0), even if I force symfony to use the regex in the sfToolkit::stripComments() method.

I've just commited a patch (in http://trac.symfony-project.com/trac/changeset/5061) to sfCompileConfigHandler to call all the regexes and the tokenizer stuff for each file instead of doing those transformations on one big string.

Please, can you try it and tell me if it fixes the problem for some/all of you?

If you don't use the /branches/1.0 subversion repository, you can change the sfCompileConfigHandler.class.php by this one here: http://trac.symfony-project.com/trac/browser/branches/1.0/li b/config/sfCompileConfigHandler.class.php?format=txt

Before being able to test it properly, you will need to remove all your cache files.

Thanks

[Updated on: Thu, 13 September 2007 08:54]

Re: [resolved] When SF_DEBUG is false Content-Length is null :/ [message #35476 is a reply to message #29684 ] Thu, 13 September 2007 12:27 Go to previous message
alanz  is currently offline alanz
Messages: 1
Registered: September 2007
Junior Member
I am not 100% familiar with the regular expression engine used in the strip-comments code, but it seems to me that no provision is made for end of comment delimiters appearing in string literals, which should be ignored.

This is probably unrelated to the issue at hand, but can cause problems.
Previous Topic:1.0 Beta conflict with XCache?
Next Topic:database connection leads to blank page
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software