Destorying Yii

I wast to use a Yii project to check if users have access to other projets on my server. I was wanting to use the following:

<Directory "/Library/WebServer/Projects/">

Php_value auto_prepend_file /server/auth.php


This is all working fine, but once the user is logged in I want to destroy the Yii app completely so the other project can then be loaded in.

Is there anyway to achieve this?


if(!Yii::app()->user->isGuest) exit;

this wont work as exit prevents the web app I want to load from loading.

Try to explain in more details the problem.

I have the auth.php file being called from my ‘Gateway’ web app.

This will check the domain and make sure the user is logged in and has access. Once they are The Gateway app should allow them through to the main app. At the minute Yii is loaded still when the main app is called and this is calling me issues.

I need to be able to continue with the page load to the main app as if the Gateway app was never loaded.

I cant exit or the main app will never load.

If i try and let the main app load after not destroying reference to the Gateway all. Otherwise I will end up with error like: Yii application can only be created once.

And other problems with projects created in zend etc.

Would this work?

Yii::app()->end(0, false);

Unfortunately not I still have the same “Yii application can only be created once.” error. So Yii is still alive and kicking! :(

Still not understand well what you want to acomplish…

But Yii is an empty class…

So one time you can create YiiBase

And second time Yii instance for example…

not sure :rolleyes:

  • Create new yii project call authproject (or anything)

  • Add the following to your httpd.conf

<Directory "/Library/WebServer/Projects/">

Php_value auto_prepend_file /path to your projects/authproject/index.php


  • Open another yii project in your broswer. First it will run authproject/index.php. You will see that you cannot just load in the following Yii project without error. This is what I am after.


I guess there isn’t an easy way to do this :P

how about using header(‘location:XXX’) after you running the first one?

It will still always go through the prepend file. So location:blah would reload the same page and still hit the prepend file. So same issue :(