The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Bad init.php after 4.1.2 install - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Bad init.php after 4.1.2 install (/showthread.php?tid=155)



Bad init.php after 4.1.2 install - venedude - 06-05-2016

Hi, let me start by saying thanks for UserSpice! I used usercake 1.x a few years back for a project and that led me to this new and improved version.

I installed latest 4.1 ($user_spice_ver="Version 4.1.2") on Ubuntu 16.04LTS LAMP. The installation went ok, no errors, but here is what I got when trying to access the page:

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /var/www/html/S2S_DEV1/users/init.php on line 95

Dug around the init.php file and editor was reporting a syntax error on line 95:
//Check to see that user is verified
if($user->isLoggedIn()){
if($user->data()->email_verified == 0 && $currentPage != 'verify.php' && $currentPage != 'logout.php' && $currentPage != 'verify_thankyou.php'){
Redirect::to('verify.php');
}
}'host' => '192.168.xxx.xxx',
'username' => 'xxxxx',
'password' => 'xxxxx',
'db' => 'S2SDB_DEV1',
),
'remember' => array(
'cookie_name' => 'yyyyyyyyyyyyy',
'cookie_expiry' => 604800 //One week, feel free to make it longer
),
'session' => array(
'session_name' => 'user',
'token_name' => 'token',
)
);




I looked around some of the code on github and playing around with some of the code was able to change it to this:
//Check to see that user is verified
if($user->isLoggedIn()){
if($user->data()->email_verified == 0 && $currentPage != 'verify.php' && $currentPage != 'logout.php' && $currentPage != 'verify_thankyou.php'){
Redirect::to('verify.php');
}
};
$GLOBALS['config'] = array(
'mysql' => array(

'host' => '192.168.xxx.xxx',
'username' => 'xxxxx',
'password' => 'xxxxx',
'db' => 'S2SDB_DEV1',
),
'remember' => array(
'cookie_name' => 'yyyyyyyyyyy',
'cookie_expiry' => 604800 //One week, feel free to make it longer
),
'session' => array(
'session_name' => 'user',
'token_name' => 'token',
)
);




Now, that seems to fix the problem as everything works after that but I have not looked at the code enough to call it a fix. I'm not 100{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} sure of what I did there so can you guys confirm if that is indeed the missing piece?


Thanks again!


Bad init.php after 4.1.2 install - venedude - 06-05-2016

Just realized the same information, correctly formatted, is in line 25 of init.php. So technically removing the extra stuff after line 95 is a better fix.


Bad init.php after 4.1.2 install - brian - 06-05-2016

Hmm, we've not had any issues ourselves with the init.php that installer creates. I believe @mudmin also packages a complete init.php in an "installer issues" folder or something like that that allows you to manually customize it.

Did it give any clues during the installation about write problems or anything like that?


Bad init.php after 4.1.2 install - venedude - 06-05-2016

I did have some write errors initially if chmod 664 so I did chmod 777 and that ran fine. maybe I ended up running install twice? I'll try it again fresh and report back.


Bad init.php after 4.1.2 install - mudmin - 06-05-2016

Yep. If your init file is that long, you've installed twice. Click the button at the top of the installer to reset the init and install files back to original. Do your chmodding and start over. My guess is that it will work right after that.


Bad init.php after 4.1.2 install - venedude - 06-05-2016

Well, I tried again fresh, watching my folder permissions carefully, and it ran fine. I think it is something with the way I have my dev environment setup I ended up so initially chmod 666 did not work for me and I ended up having to re-run it. Sorry should have tried this first! Thanks!


Bad init.php after 4.1.2 install - mudmin - 06-05-2016

It's not obvious that you'd have to reset that stuff. Creating an installer that writes directly to your server is tricky with all the different server configs out there. Every once in a while there is a hiccup. Glad you got it sorted.