Page 1 of 2

Run V3 and V4 on the same box.

Posted: Mon May 04, 2020 4:17 pm
by hagie
Hi,

for migrating an application I need to run Version3 and Version4 on the same box. V4 is runnign without any problem. But right now I can't get V3 running.

I tried installing it from scratch ( source https://github.com/mmiscool/nuBuilderPro ) , created a database, run the nuinstall.php without problem. I see the database is set up and I get the login Screen.
After login in I see only a white page.

In the Log I see 3 php warnings :

Code: Select all

2020/05/04 16:00:09 [error] 52749#52749: *1742 FastCGI sent in stderr: "PHP message: PHP Warning:  ini_set(): A session is active. You cannot change the session module's ini settings at this time in /var/www/oldgdt.delegates.site/nudatabase.php on line 34
PHP message: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /var/www/oldgdt.delegates.site/nucommon.php on line 389" 
2020/05/04 16:03:20 [error] 52749#52749: *1750 FastCGI sent in stderr: "PHP message: PHP Warning:  ini_set(): A session is active. You cannot change the session module's ini settings at this time in /var/www/oldgdt.delegates.site/nudatabase.php on line 34" 
2020/05/04 16:03:21 [error] 52750#52750: *1751 FastCGI sent in stderr: "PHP message: PHP Warning:  ini_set(): A session is active. You cannot change the session module's ini settings at this time in /var/www/oldgdt.delegates.site/nudatabase.php on line 34
PHP message: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /var/www/oldgdt.delegates.site/nucommon.php on line 389"
Any Idea what can I do to get this old àpp running on the new system (Ubuntu 20, PHP Version 7.4.3) ?

Thanks
Stefan

Re: Run V3 and V4 on the smae box.

Posted: Mon May 04, 2020 4:31 pm
by kev1n
ini_set(): A session is active
You could try this: https://forums.nubuilder.cloud/viewtopic. ... ive#p19895

Re: Run V3 and V4 on the smae box.

Posted: Mon May 04, 2020 4:37 pm
by kev1n
hagie wrote: PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/oldgdt.delegates.site/nucommon.php on line 389"
Try changing this line here https://github.com/mmiscool/nuBuilderPr ... n.php#L389

Code: Select all

for($f = 0 ; $f < count($form_data['data']) ; $f++){	
with this:

Code: Select all

for($f = 0 ; $f < count((array)($form_data['data'])) ; $f++){	

Re: Run V3 and V4 on the smae box.

Posted: Mon May 04, 2020 5:22 pm
by hagie
kev1n wrote:
ini_set(): A session is active
You could try this: https://forums.nubuilder.cloud/viewtopic. ... ive#p19895
Well I don't get the WARNING in the browser - it's from the logfile. Both Messages are only warnings - not sure if they are the cause for non seeing anything in the browser.

I can even remove the ini_set from the php (looks like this only sets some garbage collector threshold) , don't get any warning in the log but still only a white page after login.

Regards
Stefan

Re: Run V3 and V4 on the smae box.

Posted: Mon May 04, 2020 5:43 pm
by kev1n
I succeded in installing and running nuBuilder 3 using XAMPP (Apache/2.4.41, PHP 7.4.2, MariaDB 10.4.11)

I first run http://localhost/nubuilder3/nuinstall.php and then logged in. And I didn't get any error messages on my side.

Re: Run V3 and V4 on the smae box.

Posted: Mon May 04, 2020 7:27 pm
by hagie
kev1n wrote:I succeded in installing and running nuBuilder 3 using XAMPP (Apache/2.4.41, PHP 7.4.2, MariaDB 10.4.11)

I first run http://localhost/nubuilder3/nuinstall.php and then logged in. And I didn't get any error messages on my side.
have you checked your logfiles for warnings ? these ini_set() and .count() warnings should appear because the recent php version.
could you try nginx with php-fpm to see if it still works ?

Regards

Re: Run V3 and V4 on the smae box.

Posted: Mon May 04, 2020 7:55 pm
by kev1n
Ok, I checked the Apache Logs and found the same errors as you got.

And display_errors was Off in php.ini. That's why I didn't see the errors. When I set display_errors=On, I see them and I'm unable to login. So setting display_errors=Off should do the job.

Re: Run V3 and V4 on the smae box.

Posted: Tue May 05, 2020 10:50 am
by hagie
Hi,

I just tracked it further down a bit. As I wrote 3 posts ago there is something different between mod-php (apache) and pgp-fpm (nginx). In this case the problem is an empty session (file)

Code: Select all

nucommon.js?ts=20200504232509:1588 Uncaught TypeError: Cannot read property 'session_id' of null
    at Object.<anonymous> (nucommon.js?ts=20200504232509:1588)
    at fire (jquery-1.8.3.js:974)
    at Object.fireWith [as resolveWith] (jquery-1.8.3.js:1084)
    at done (jquery-1.8.3.js:7803)
    at XMLHttpRequest.callback (jquery-1.8.3.js:8518)
which leads to

Code: Select all

.....
  var request = $.ajax({
        url: "nuapi.php",
        type: "POST",
        data: {nuWindow : w},
        dataType: "json"
        }).done(function(data){
            if(data.DATA['session_id'] == 'Login Failed'){
                alert(nuTranslate('Your username or password was incorrect'));
                toggleModalMode();
                $('#p').val('');
                $('#u').focus();
            }else{
....
going deeper into this - and looking at the session file itself (on the server) , it is initialized with the database and globeadmin information but nothing more:

Code: Select all

root@public /var/lib/php/sessions # more sess_plo2ulg96ac80ge94988jv1o66
DBHost|s:9:"127.0.0.1";DBName|s:9:"nubuilder";DBUser|s:9:"nubuilder";DBPassword|s:9:"nubuilder";DBGlobeadminPassword|s:2:"nu";title|s:9:"nubuilder";IsDemo|N;SafeMode|b:0;SafePHP|a:0:{}
If I use nubuilder4 on the same box it works .. I can see much more information in the sessionfile.

Will further investigate

Regards

Re: Run V3 and V4 on the same box.

Posted: Tue May 05, 2020 12:52 pm
by hagie
Ok,

it's working on nginx + php7.2 on ubuntu 18

Code: Select all

root@ubuntu-4gb-hel1-2:/var/www# nginx -v
nginx version: nginx/1.14.0 (Ubuntu)
root@ubuntu-4gb-hel1-2:/var/www# php -v
PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr  8 2020 15:45:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend Technologies
it's not working on ubuntu 20 at all .. I installed php 7.1 on ubuntu 20 without success - empty session

not sure if there is any security enhancement which cause the problem on ubuntu 20

will further investigate
regards

Re: Run V3 and V4 on the same box.

Posted: Tue May 05, 2020 12:57 pm
by kev1n
I've never used nginx / ubuntu - I'm afraid I can't help you much...