redirect() problems
#1
Posted 12 November 2009 - 11:10 PM
on my testsystem is everything fine working, but on my production system, the redirect() method is nothing doing!!!!
i only get the error "Header alreday sends...."
anybody an idea?
#2
Posted 12 November 2009 - 11:18 PM
#3
Posted 12 November 2009 - 11:24 PM
but i have no echo's and no print_r before!!!
the strange thing is, that on the test-system (windows 7) everything is ok, only on the production system i have problems (debian)
#4
Posted 12 November 2009 - 11:25 PM
Stack trace:
#5
Posted 12 November 2009 - 11:35 PM
yii, on 12 November 2009 - 11:25 PM, said:
Stack trace:
I've had that before. You php files are messed up (maybe wrong charset or whatever).
Open main.php in your favorite php-editor, copy everything, paste into a new file and save. Upload and try again.
Also check transfer mode of your ftp-app. Maybe it needs a change to binary or something.
This post has been edited by qiang: 29 December 2009 - 09:52 AM
#6
Posted 12 November 2009 - 11:42 PM
I have load the main.php in my editor and encode it to UTF-8 and uploaded it.... nothing
my STACK TRACE
Cannot modify header information - headers already sent by (output started at /var/www/xyz/protected/config/main.php:1) (/var/www/yii/framework/web/CHttpRequest.php:509) Stack trace: #0 /var/www/blog/protected/controllers/EngineController.php(74): EngineController->redirect() #1 /var/www/yii/framework/web/actions/CInlineAction.php(32): EngineController->actionSearch() #2 /var/www/yii/framework/web/CController.php(300): CInlineAction->run() #3 /var/www/yii/framework/web/CController.php(278): EngineController->runAction() #4 /var/www/yii/framework/web/CController.php(257): EngineController->runActionWithFilters() #5 /var/www/yii/framework/web/CWebApplication.php(310): EngineController->run() #6 /var/www/yii/framework/web/CWebApplication.php(120): CWebApplication->runController() #7 /var/www/yii/framework/base/CApplication.php(135): CWebApplication->processRequest() #8 /var/www/blog/index.php(11): CWebApplication->run() REQUEST_URI=/engine/search.html?value=xyz
edit
if a call directly the URL, than is everything fine working. I have only problems with redirect()
else if ( preg_match( $pattern_alpha, $searchword ) )
{
$this->redirect(array("engine/phrase", "value" => $searchword));
}
#8
Posted 13 November 2009 - 12:02 AM
what editor are you using, to find so a invisible character?
edit
if i'm uploaded the file on my system, the failure is coming back!
i'm using Filezilla
#9
Posted 13 November 2009 - 12:09 AM
yii, on 13 November 2009 - 12:02 AM, said:
what editor are you using, to find so a invisible character?
Hex-editor? Have none installed, just remembered some month ago I had the same problem. Opened with some shareware hex-editor I found via google and fixed it.
#10
Posted 13 November 2009 - 01:57 PM
#11
Posted 13 November 2009 - 05:36 PM
After that I have uploaded the files (under Ubuntu) with filezilla.
And everything works fine
thx @ Y!!
#12
Posted 16 November 2009 - 02:13 AM
However, because of that random character (I haven't run into it on my windows 7 stuff and I'm using utf8 and filezilla) you may have had some interesting display issues even after the output buffer configuration was changed.
In general, though, I find it a good idea to turn output buffering on by default in the php.ini file. That's just me, though.
#13
Posted 28 December 2009 - 06:16 AM

POPULAR
In the /protected/config/main.php you have to add before returning the config array:
ob_start('My_OB');
function My_OB($str, $flags)
{
//remove UTF-8 BOM
$str = preg_replace("/\xef\xbb\xbf/","",$str);
return $str;
}
return array( ... yii config array ...);
P.S. You don't have to call ob_end_flush(), php will do this automatically at the end of the script.
#14
Posted 28 December 2009 - 07:25 AM
#15
Posted 31 December 2010 - 07:29 AM
Mirco, on 28 December 2009 - 06:16 AM, said:
In the /protected/config/main.php you have to add before returning the config array:
ob_start('My_OB');
function My_OB($str, $flags)
{
//remove UTF-8 BOM
$str = preg_replace("/\xef\xbb\xbf/","",$str);
return $str;
}
return array( ... yii config array ...);
P.S. You don't have to call ob_end_flush(), php will do this automatically at the end of the script.
This solution worked for me.
Is this a good solution or could this cause for problems?
Does this mean I have an UTF-8 BOM? Is there a terminal batch script to verify this? Or within the IDE (I'm using Dreamweaver CS 5 for Mac)
#16
Posted 07 April 2011 - 01:22 PM
I had the same problem with you. When I started writing a new file, it's encoding was ASCII adn when I changed it to UNICODE I had this kind of problem. I am using Notepad++ and it has an option under "Encoding" which says "UTF-8 without BOM". I used to just choose encode in "UTF-8" and not UTF-8 without BOM" and that's why I had this problem. BOM adds three bytes in front of the file which are not recognized as encoding characters but as true output.
I don't know how you can change your file encoding through other editors but Notepad++ is quite helpful in that!
This is the link about BOM.
#17
Posted 15 July 2011 - 10:05 AM
My extensions:
ActiveResource for Yii - the RESTful equivalent to ActiveRecord | Neo4Yii - wrapper for the Neo4j graph database | EPhpThumb - a simple, lightweight wrapper for the phpThumb library
Get social:
Circle me on Google Plus
Follow me on Twitter
#18
Posted 27 October 2011 - 03:22 PM
Y!!, on 12 November 2009 - 11:35 PM, said:
Open main.php in your favorite php-editor, copy everything, paste into a new file and save. Upload and try again.
Also check transfer mode of your ftp-app. Maybe it needs a change to binary or something.
#19
Posted 26 November 2011 - 08:29 AM
I ran into the same issue but in my case everything was in UTF.
The problem was in one CController, it had two spaces into the beginning of the controller.
Attaching a shot to illustrate.
Attached File(s)
-
Screen shot 2011-11-26 at 10.27.52 AM.png (18.95K)
Number of downloads: 63
#20
Posted 21 June 2012 - 11:27 PM
Dave, on 28 December 2009 - 07:25 AM, said:
This led to my solution.... Dave, you rock!
I enabled logging of errors and tried to reload the offending page.
protected/config/main.php
...
array('class'=>'CWebLogRoute',), // to enable debugging
This told me which file to look at...
I then opened that file, deleted lines after closing ?> tag and my problem (Captcha was failing to generate) went away!
Buys Dave virtual beer!

Help

This topic is locked













