The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bad init.php after 4.1.2 install
#1
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!
  Reply
#2
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.
  Reply
#3
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?
  Reply
#4
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.
  Reply
#5
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.
  Reply
#6
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!
  Reply
#7
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.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)