strange 500 - Internal server error - after moving to IIS

I developed a small app, it works good in both my local PC (Windows/XAMPP) and Linux server, surprisingly it generates 500 at Windows IIS server. I know for sure assets and runtime dirs are writable by web server.

Unfortunately, despite having the following code


define('YII_DEBUG',true);


if(defined('YII_DEBUG'))

{

	ini_set('display_errors', true);

	error_reporting(E_ALL);

}

else

{

	ini_set('display_errors', false);

	error_reporting(0);

}

and tried configuring log component with several logging possibilities, but I couldn’t make Yii to show the errors in screen or to write to file. Then I started writing die statements from the flow I know.

In my default controller, it comes to filters() and accessRules(). die statement at the beginning of accessRules works, but moving the die to end produces 500. So the error must be in-between.


	public function accessRules()

	{

		//die('canvascontroller - access rules - starts');						

		return array(

			array('allow',  // allow all users to perform 'index' and 'view' actions

				'actions'=>array('create','thanks'),

				'users'=>array('*'),

			),

		);

		

		die('controller - access rules - end');				

	}

In fact, I do not require any access control, I tried removing both filters & accessRules(), still in vain. Any idea what might be issue and why the logger is not working for me?

Error is not here. Your last die() function will never execute, because there is return statement before it. Don’t use die() function. Use xdebug with some IDE (Netbeans for example) and breakpoints on every steps. Then you will find error very quickly.

PS. As I know, framework use @ to turn off errors in some places. May be you don’t see error due to this mark.

Can you check if IIS is setup correctly. Create just simple index.php file, and see if IIS will generate error or not. So, you will know if problem lie in IIS setup itself(it is tricky anyway), or in your Yii app.

[font=Arial, Helvetica, sans-serif]I thins That issue Comes from IIS installation Plase verify

HTTP 500 Errrot Having Following reason Eplanation[/font]

[font=Arial, Helvetica, sans-serif]

This error can only be resolved by fixes to the Web server software. It is not a client-side problem. It is up to the operators of the Web server site to locate and analyse the logs which should give further information about the error [/font]

[font=Arial, Helvetica, sans-serif]

[/font]

@Jampire: I overlooked the return statement in the debugging tension. Thanks for pointing it out.

@Ivica && @shailesh: It’s very unlikely to have IIS setup issue, it’s godaddy commercial shared hosting. And, yes, simple scripts run just fine. In fact, Yii requirements script passed the minimum requirement.

Thank you guys, I’m going to pull my hair once again and will keep you posted, if I had any success :frowning:

There is no error log (application/server) ?

you mean IIS Webserver? I do not have access to logs, going to ask the concerned person. Thanks!

First add this to the start script index.php




// development error reporting

error_reporting(E_ALL | E_STRICT);

ini_set('display_errors', 1);

//date_default_timezone_set("Europe/Stockholm");



  1. Probably you will have to adjust the path to yii.php.

  2. Next uncomment the default time zone setting and change to a default time zone of your choice.

  3. You may need to enable write access to protected/runtime and /assets.

Now you should be able to see the start page of blog demo or a freshly yiic generated app.

(Next problem will be to enable url rewriting. For now set showScriptName to true in config.)

/Tommy

Thanks Tommy, will try your guidelines and will keep you updated. btw, this forum post is also seems to be related with my issue

[topic=‘7956’]urlmanager-and-godaddy-trouble/[/topic]

As per you guys guidelines, I moved a "fresh" copy of framework directory to server and tried executing the blog app (after giving write access to assets & runtime), still received the 500 error, but this time application.log was written with actual error.

2012/01/22 18:11:31 [error] [exception.CDbException] exception ‘CDbException’ with message ‘CDbConnection failed to open the DB connection: could not find driver’ in D:\Hosting\**\yii-1.1.9.r3527\framework\db\CDbConnection.php:382

Running the requirement script resulted passing of everything but the following:

extension Warning

PDO MySQL extension Warning

PDO PostgreSQL extension Warning

Memcache extension Warning

APC extension Warning

Since PDO extension is passed, it supposed to connect to the db. right? I tried the correct connection string for both MySQL hosted db I have and a MSSQL database in that server. Both generates the same error.

What exactly should I have to tell to hosting provider (Godaddy) to resolve this issues and make Yii compatible with the server?

You must install not only PDO extension, but one of the appropriate PDO drivers. For example, MySQL PDO driver or MSSQL PDO driver.

In fact, we cannot demand PDO drivers in a shared hosting, but I managed to run the script by using PDO emulators (available as extensions). With MySQL everything works perfectly, but for MSSQL, PDO emulator was able to extract rows, but non-English character rows are coming as empty. When trying to save, again I’m receiving 500 error. I’m going to import the blog db into MSSQL so I will get the exact error for failure.