Installation problems on qnap

Hi,

I am trying to install backlight on my qnap nas (Backlight-5-Installer-118.zip). When running the installer i get
“The installer was unable to connect to the server. Please wait a few minutes and try again.”

Browsed the forum and found an old thread with qnap problems.
https://discourse.theturninggate.net/t/no-modules-found-something-went-wrong-on-my-nas/1793
My installation files didnt exactly match the ones in the thread though.
I tried to modify the ssl verification by chaning

	if (defined('SKIP_SSL_VERIFICATION') && SKIP_SSL_VERIFICATION) {
			curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
		}

by just removing the if…to

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

Now i get the error.

We were not able to find a Backlight 5 purchase for the Order ID and Email you provided

Not sure anymore if its a ssl issue, or there is something else going on.

answering my own question,

Tried a new clean install and uncommented “skip_ssl_verificartion” in env.php.skel
This gave me back the error "“The installer was unable to connect to the server. Please wait a few minutes and try again.”

Changing the url for get.theturninggate.net/install from https to http in env.php.skel and config.php got me to successfully install.

Seems to be working ok, but now i have the error on page
/backlight/designer/list_templates/

Something went wrong
Unexpected error: Undefined index: page_template_id in TemplateDAO.php on line 105

Please report error at https://discourse.theturninggate.net

I’m not sure what could be causing that message. Had you deleted anything from the templates page?
Does the page load below that message? If so can you take a screenshot and post here?

Lastly, what do you see when visiting the galleries page on the main site? E.g. at http://yoursite.com/galleries (where yoursite.com would be the actual address of your site).

Hello
Nothing is deleted, it is a clean install.

Galleries seems to be working fine. I added a test gallery with a screenshot of the error.

Thanks, @msjogren. That is a strange error that should not happen. In general, NAS servers are problematic and have caused various issues due to not providing a consistently configured web environment.

Can you find the file backlight/modules/module-designer/application/dao/TemplateDAO.php on your server and add a line at line 102:

		__dd($templateCounts);

So that that part of the file looks like:

	public function getTemplateChildCountLookup()
	{
		$templateCounts = $this->dbHandler->selectRows('SELECT t.page_template_id, count(*) AS child_count FROM template t LEFT JOIN engine e ON t.engine_identifier = e.identifier WHERE e.type IN (\'album\', \'autoindex\', \'theme\') GROUP BY t.page_template_id');
		__dd($templateCounts);

		$lookup = array();
		foreach ($templateCounts as $templateCount) {
			$lookup[$templateCount['page_template_id']] = $templateCount['child_count'];
		}

		return $lookup;
	}

After doing so, visit Designer > Templates, and post the contents of that page here?

Once done, remove the line from the file.

Yes I understand the headache with these “home” environments. I appreciate the support.

adding the line makes the designer pages crash harder.
Pointing to a new row
crash

Added your suggested code to the new error line and got this. (in getTemplatePageCountLookup)

Array
(
    [0] => Array
        (
            [t.page_template_id] => 1
            [page_count] => 4
        )

)

Thanks. The database query is returning the field name using a different approach to what we usually see. (In technical terms, the query uses a table alias of t, and the column selection of t.page_template_id is being returned with that name literally instead of page_template_id that we expect.

Can you take a look at the PHP Info (available via Admin > Special Links) and report back the PHP version and value for “SQLite Library”?

This error is inconsequential - it results in the Templates page showing zeros for Child Templates rather than the actual value. I’ll put in a workaround, however this type of issue may come up in other parts of Backlight.

I’ll look into whether there is some SQLite setting we can set to control this behaviour.

wasn’t really aware, but my qnap firmware only supports up to PHP Version 5.6.40, witch is the one installed.
sqllite lib 3.4.1

Would be great if it would be possible to get this running with not too much hassle?

I’ll look into upgrading my nas in the future.

Thank you @Ben for the directions,
I specified column alias in the query and the error seems to be gone.
ie. SELECT t.page_template_id AS page_template_id,

What i dont understand is why the other queries doesnt generate the error. But it doesnt matter.

That’s the exact change that I planned to make. Good to hear that it’s solved it for you.

I need to review queries across the board, but it may be the case that that particular query is unique.