using yii2 with yii1 is erro.

we do it. but erro.

$yii2config = require(’/home/yii1/yii/vendor/basic/config/web.php’);

new yii\web\Application($yii2config); // this is display erro.

An internal server error occurred.

and we found Application.php in vendor/yiisoft/yii2/base

Component::__construct($config);

why reason?

Yii 2.0 isn’t compatible with Yii 1.1.

Yii 2.0 isn’t compatible with Yii 1.1. ? why?

But guide 2.0 have yii2 with yii1

this is link

http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html

Using Yii 2 with Yii 1

It looks like you are trying to create a Yii 2 app with the configuration of Yii 1.

It’s not possible.

What you can do is to use Yii 2 as a library of Yii 1 application. The guide describes how to do it.

Using Yii 2 with Yii 1

If you were using Yii 1 previously, it is likely you have a running Yii 1 application. Instead of rewriting the whole application in Yii 2, you may just want to enhance it using some of the features only available in Yii 2. This can be achieved as described below.

Note: Yii 2 requires PHP 5.4 or above. You should make sure that both your server and the existing application support this.

First, install Yii 2 in your existing application by following the instructions given in the last subsection.

Second, modify the entry script of the application as follows,

// include the customized Yii class described below

require(DIR . ‘/../components/Yii.php’);

// configuration for Yii 2 application--------------------------------------------------------------------hi, softark thanks your reply. you can see this.

$yii2Config = require(DIR . ‘/../config/yii2/web.php’);

new yii\web\Application($yii2Config); // Do NOT call run()

// configuration for Yii 1 application

$yii1Config = require(DIR . ‘/../config/yii1/main.php’);

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

So, what is ‘/home/yii1/yii/vendor/basic/config/web.php’?

I think you’d be better read the whole chapter of Working with Third-Party Code

When seeing from Yii 1.1, Yii2 is simply a "third party" library.

can you Using Yii2 with Yii1 success?

I haven’t tried it. And, frankly saying, I have no plan to do it with my existing Yii 1.1 apps.

What kind of enhancement do you have in mind for your existing Yii 1.1 app?

please see this url。

http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html#using-both-yii2-yii1

anybody can do success? using-both-yii2-yii1

please give me demo? my email 582994784@qq.com

i need use yii2 in yii1

Just suck it up and port your Yii 1 applications to Yii 2 :)

[color="#006400"]/* topics merged */[/color]

Please cool down a little. :)

We all know the doc you mentioned. Probably I have read it more often than you.

It says that you can use some features of Yii 2 in Yii 1 app.

You say you want to use Yii 2 with Yii 1, but it’s not clear enough. What exactly do you want to do? What features of Yii2 do you want to use?

i want new modules use yii2 and old modules use yii1

I have a sysem use yii1

if I upgrade all code to yii2. huge work 。 :-)

Maybe you could use iframes to a separate yii2 app. This may also help with a gradual move from yii1 to yii2. I saw a thread a while back about sharing sessions but I don’t know if it was successful.

I would also try to create 2 separated apps: the existing Yii 1 app and the new Yii 2 app.