yii-node-socket icon indicating copy to clipboard operation
yii-node-socket copied to clipboard

Yii2 server is not starting throws name space error

Open abeersaeed opened this issue 10 years ago • 22 comments

capture I have followed all the steps you have mentioned but when i try to run the server using console it throws this error can you please check it and let me know. I have used your extension in Yii 1 now i want to use this in Yii 2 but i am stuck looking forward to listen from you Regards

abeersaeed avatar Oct 21 '15 14:10 abeersaeed

I am using Yii2 advance templete

abeersaeed avatar Oct 21 '15 14:10 abeersaeed

Hi, did you added comand to command map in configuration?

Отправлено с моего Xiaomi

Сообщение от "abeersaeed [email protected]":

I am using Yii2 advance templete

— Reply to this email directly or view it on GitHub.

oncesk avatar Oct 21 '15 15:10 oncesk

capture Yes i did

abeersaeed avatar Oct 21 '15 15:10 abeersaeed

I added it in console/config/main

abeersaeed avatar Oct 21 '15 15:10 abeersaeed

So, problem in configuration, i will think and let you know, you please too

Отправлено с моего Xiaomi

Сообщение от "abeersaeed [email protected]":

I added it in console/config/main

— Reply to this email directly or view it on GitHub.

oncesk avatar Oct 21 '15 15:10 oncesk

yeah sure i am looking into it and please you also let me know Thanks

abeersaeed avatar Oct 21 '15 15:10 abeersaeed

Can you look at all available yii command, is there yiinodesocket command?

Отправлено с моего Xiaomi

Сообщение от "abeersaeed [email protected]":

yeah sure i am looking into it and please you also let me know Thanks

— Reply to this email directly or view it on GitHub.

oncesk avatar Oct 21 '15 16:10 oncesk

capture i tried to include it using Require in config now i am getting Unknown component Id

abeersaeed avatar Oct 22 '15 08:10 abeersaeed

hi, can you show your configuration console/config/main.php?

oncesk avatar Oct 22 '15 08:10 oncesk

capture Here It is

abeersaeed avatar Oct 22 '15 09:10 abeersaeed

so, you set a wrong type to array_merge

require function can return some value from required file if in file used return statement array_merge used for merging arrays but in your case last require return nothing

you need to remove last require in array_merge statement and add node-socket configuration to components something like this only your configuration

'nodeSocket' => [
            'class' => '\YiiNodeSocket\NodeSocket',
            'host' => 'localhost',
            'allowedServerAddresses' => [
                "localhost",
                "127.0.0.1"
            ],
            'origin' => '*:*',
            'sessionVarName' => 'PHPSESSID',
            'port' => 3001,
            'socketLogFile' => '/var/log/node-socket.log',
        ],

oncesk avatar Oct 22 '15 09:10 oncesk

you can add nodeSocket to bootstrap

'bootstrap' => ['log', 'nodeSocket'],

oncesk avatar Oct 22 '15 09:10 oncesk

oh ok let me try

abeersaeed avatar Oct 22 '15 09:10 abeersaeed

capture Still it says

abeersaeed avatar Oct 22 '15 09:10 abeersaeed

Unable to find \YiiNodeSocket\NodeSocket

abeersaeed avatar Oct 22 '15 09:10 abeersaeed

So, read error message and check your syntax

Отправлено с моего Xiaomi

Сообщение от "abeersaeed [email protected]":

 Still it says

— Reply to this email directly or view it on GitHub.

oncesk avatar Oct 22 '15 09:10 oncesk

I have fixed the above issue the main issue is not able to find \YiiNodeSocket\NodeSocketCommand which is the main class for Socket Command

abeersaeed avatar Oct 22 '15 09:10 abeersaeed

do you have some errors? Is server starting?

oncesk avatar Oct 22 '15 09:10 oncesk

if you used composer and include vendor/autoload.php into your project all should works

oncesk avatar Oct 22 '15 10:10 oncesk

no server is not starting when i try to start the server by yii node-socket/start it throws error which i have shared with you

abeersaeed avatar Oct 22 '15 10:10 abeersaeed

you need to check your configuration. NodeSocket extension must be configured like any other extension installed with composer

oncesk avatar Oct 22 '15 10:10 oncesk

i do not know how i can help you with it because i do not see you project and etc...

oncesk avatar Oct 22 '15 10:10 oncesk