Yii Outputing Only View File

I have an application that works fine on my local server(wamp, apache v2.22.2, php 5.4.3) and test unix server (apache, php 5.3).

But it won’t work on production server which is running on Windows because of some other requirements.

It’s only outputing contents of the view file.

After some digging through Yii files i found that this is happening in CBaseController’s renderInternal function on line :




public function renderInternal($_viewFile_,$_data_=null,$_return_=false)

{

    // we use special variable names here to avoid conflict when extracting data

    if(is_array($_data_))

	extract($_data_,EXTR_PREFIX_SAME,'data');

    else

	$data=$_data_;

    if($_return_)

    {

	ob_start();

	ob_implicit_flush(false);

	require($_viewFile_);

	return ob_get_clean();

    }

    else

	require($_viewFile_);

    }



Problem is line 127: require($viewFile);

It’s supposed to return content of the view file but is instead echoing it out.

PHP installation on server is new with default settings and AFAIK with the same ones as on the Unix server.

Is there a way to fix this?

Which web server are you using on Windows? Which PHP version and which SAPI (fastcgi, etc)? Is there anything in the server logs?

IIRC, output buffering was rewritten in PHP 5.4, so the PHP version is important in this case.

Did you try a simple test case?




<?php

ob_start();

echo "Should not appear\n";

// then check with an include() instead of echo

ob_end_clean();

echo "Done.";