Page 1 of 1

Installation on Synology NAS

Posted: Mon Mar 20, 2023 12:49 pm
by Vygantas
Hi,

I am trying to run nuBuilder 4.5 on Synology NAS.
There is already running Apache 2.4, PHP 7.4, MariaDB 10 and phpMyAdmin.
I have set up a database and connection privileges. However when trying to run I get following error message:
"Parse error: syntax error, unexpected '?' in /volume1/web/nubuilder/core/nuchoosesetup.php on line 24 Call Stack: 0.1637 131656 1. {main}() /volume1/web/nubuilder/index.php:0"
What could be the problem? Is it related to the database or PHP version? How to fix it?

Thanks

Re: Installation on Synology NAS

Posted: Mon Mar 20, 2023 12:59 pm
by kev1n
Hi,

This code uses the null coalescing operator (??), which was introduced in PHP 7.0. Therefore, the minimum PHP version required to run this code is PHP 7.0 and it should work with the PHP version installed on Synology NAS.

I'm uncertain why the syntax is causing an error. It might be a good idea to seek assistance on a Synology NAS forum, where you can find more specialised knowledge on the topic.

In the meantime, you can try replacing the function nuIsHTTPS() in the file nuchoosesetup.php with the one below
that doesn't use the null coalescing operator but uses ternary operators:

Code: Select all

function nuIsHTTPS() {

    $isHttps = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (
        isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : (
            isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ? $_SERVER['HTTP_X_FORWARDED_PROTO'] : null
        )
    );

    return
        $isHttps && (
            strcasecmp('on', $isHttps) == 0
            || strcasecmp('https', $isHttps) == 0
        )
    ;

}

Re: Installation on Synology NAS

Posted: Mon Mar 20, 2023 1:01 pm
by Vygantas
Update: Sorry, I found that I was setting the wrong PHP version. This error was with PHP 5.6. After setting PHP 7.3 error disappeared. Thank you!