HTTP 500 - Internal server error


I login just fine as demo/demo. However, I got the error message below when trying to login as demo/demo with option "Remember Me" checked, then after that I can no longer login; this time with error msg "HTTP 500 - Internal server error". Could anyone please help. Thank you, Loc Pham, staff.

PHP Error


file_put_contents(C:\Inetpub\wwwroot\testdrive\protected\runtime\state.bin) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied

Source File


00088:        else if(($content=@file_get_contents($stateFile))!==false)

00089:            return unserialize($content);

00090:        else

00091:            return null;

00092:    }


00094:    /**

00095:      * Saves application state in persistent storage.

00096:      * @param mixed state data (must be serializable).

00097:      */

00098:    public function save($state)

00099:    {

00100:        file_put_contents($this->stateFile,serialize($state),LOCK_EX);

00101:    }

00102: }

Stack Trace

#0 C:\Inetpub\wwwroot\yii\framework\core\CStatePersister.php(100): file_put_contents()

#1 C:\Inetpub\wwwroot\yii\framework\core\CApplication.php(516): CStatePersister->save()

#2 C:\Inetpub\wwwroot\yii\framework\core\CComponent.php(311): CWebApplication->saveGlobalState()

#3 C:\Inetpub\wwwroot\yii\framework\core\CApplication.php(180): CWebApplication->raiseEvent()

#4 C:\Inetpub\wwwroot\yii\framework\core\CApplication.php(147): CWebApplication->onendRequest()

#5 C:\Inetpub\wwwroot\testdrive\index.php(11): CWebApplication->run()

Make sure protected/runtime is writable by Web server process.

Hi Giang! Can you give me some more details how to make sure of it. I am using window XP/IIS. Thank you.

As the error message says:

file_put_contents(C:\Inetpub\wwwroot\testdrive\protected\runtime\state.bin) [<a href=‘function.file-put-contents’>function.file-put-contents</a>]: failed to open stream: Permission denied

The application is unable to write to this file. Please first check if protected/runtime directory exists (it normally should). And you may write a simple PHP script with the following statement to test if it can write the file:



Are you using NTFS? If so, you need to check the file permission about the folder.

Thanks Giang! I went to the testsite folder and gave internet user a read and write permission. That does the trick. Loc Pham.