state.bin file

I’m having a problem with my sessions getting lost on page load.

I’ve set the program to use a cookie value if the session is blank but enev that is getting lost sometimes.

Recently i’ve noticed a file called state.bin in my public_html folder which was not there before. maybe it has something to do with it.

Did I delete the folders where it’s normally stored so it has to come in this public_html folder and then causing all these session issues?

I’m new to yii and a little bit lost over here.

Thanks.

The file state.bin is usually in the protected/runtime folder. That folder needs to be writeable by the web server process.

I don’t have a runtime folder. ??

Do you use the default yii folder structure or did you customize it? If so could you please post it? And what is public_html? Your webserver’s root folder?

I did use yii’s folder structure but for some reason i don’t have protected/runtime. maybe it got deleted.

public_html is my webserver’s root folder but protected is outside of that folder. I guess for security purposes.

protected

/components


/config


/controllers


/extensions


/models


/modules


/views


 htaccess

public_html

/assets


/css


/images


/themes


 htaccess


 index.php


 index-test.php


 state.bin

yii

Ok, try the following:

1.) Create a "runtime" folder in your protected folder and make it writeable by your webserver process as Roman already mentioned.

2.) Delete the state.bin file

3.) Check your main config. Did you config anything regarding the statePersister component? If there is any option called "stateFile", please delete it (or comment it out). Maybe you explicitly told Yii to write the file in your root folder

Thanks Haensel. You saved the day!

My config file didn’t have anything about statepersister but looks like its working better now.

I hope it remains that way.