[SOLVED]white page on production server

I have a 216,912 rows data in a cities table

what i did to be able to render the data in the UI as a selection is by this,

*Model




	public function fetchCityName()

	{

		$connection = Yii::app()->db->createCommand("SELECT CityName from gg_t_worldareascities ORDER BY CityName ASC")->queryColumn();

		return $connection;

		

	}



*_form




		<?php 

			$this->widget('CAutoComplete', array(

				'model' => $model,

				'attribute' => 'CityID',

				'data' => $model->fetchCityName(),

				'multiple' => false,

				'htmlOptions' => array('size' => 25),

			));

		?>



it looks so cool that when I type the first letter, it suggests the matching city names

but the problem now is with the production server, it turns the page into white

what should I do ?

First enable Yii logging and look onto Yii and Http server logs for errors.

the yii loggin doesn’t show error, because the code works in my local server(xampp)

the problem is with the production, i think it can’t handle it that’s why it turns white page.

do you have a sample code snippet that can better help me with this thing?

Turn on errors on server.

You can write in index:




error_reporting(E_ALL);

ini_set('display_errors',1);

Usually, if there are difference in behavior between server and home installation, is case sensitive problem.

Maybe you work with windows (case insensitive) and the server is linux (case sensitive).

That means, that case errors will works on home installation and not on production.

Display the errors, and if you see "cannot find class file for something" it means that you have to check all your code.

FIRST OF ALL: display error for understand what is going on.

I did the exact thing you suggested




<?php

error_reporting(E_ALL);

ini_set('display_errors',1);

// change the following paths if necessary

$yii=dirname(__FILE__).'/yii/framework/yii.php';

$config=dirname(__FILE__).'/protected/config/main.php';


// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);


require_once($yii);

Yii::createWebApplication($config)->run();



it doesn’t work…, when I click the create company link

it turns to white (on production server)

on my local it doesn’t

In your situation I would enable different CFileLogRoute’s and log them in different log files to see what’s going on.

e.g for example:

One route that log the standard level logs like error, [b]warning

[/b]One route that logs only my own categories. This log messages are written before the possible problem (beginning in the controller/view where the "create company link" is displayed) zone in your code and after so you could see how far your code is correctly executed.

Definitive Guide: Logging

If you are running Apache server, try to check it’s error.log.

In Ubuntu I use this command:




tail /var/log/apache2/error.log



Try to minimize code block that cause an blank page. Perhaps you’re forget to delete die() functions or something else.

thanks for the suggestions, it’s a memory problem

this time i was asked to do this

  1. when user selects a country like e.g united states, only the states within the US will automatically

appear on the 2nd drop down menu.

  1. on the 2nd drop down menu, when the user selects a state e.g California, only the cities in california will

appear on the 3rd drop down menu

  • Is there a built-in function in Yii to help me accomplish this ? ( i don’t really know how to code using ajax )

  • I found a sample but it’s not clear for me. any other suggestions ? or atleast help me figure out how to use this thing ?

this problem was solved, i have a separate thread about the drop down menu, and solution was posted at yii wiki creating dependend dropdown, thanks for the help