Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Server error generating report

Locked
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

Server error generating report

Unread post by tschutter »

I am using nubuilder-v2.7.4.11-12.10.24-Build529 on Ubuntu 12.10 browsing with Chromium 22.0.1229.94.

If I attempt to generate a Cu report from the sample nuFinancial application, when I click on the "Print to PDF" button I get a new empty window.

If I attempt to generate a report from my own application, I get a server error:

Code: Select all

Server error
The website encountered an error while retrieving http://localhost/nubuilder/productionnu2/runpdf.php?x=1&dir=db/cohu&ses=150b0e99d63b87&form_ses=150b0eacf5dda1&r=PRICES_RETAIL&printIt0=PRICES_RETAIL. It may be down for maintenance or configured incorrectly.
This is my Add Activity -> Report -> PHP Data Code:

Code: Select all

nuDebug("SETUP!");
nuRunQuery(
<<<EOSQL

CREATE TABLE #dataTable#
SELECT
    ProductCategory.CategoryName,
    Product.ProductName,
    Product.RetailPriceIncTax
FROM Product
INNER JOIN ProductCategory ON Product.ProductCategoryID = ProductCategory.ProductCategoryID
WHERE
    Product.DiscontinuedDate IS NULL
ORDER BY
    ProductCategory.SortOrder, Product.ProductName

EOSQL
);
nuDebug("COMPLETE!");
But I don't think that it is even getting this far, because I don't see my nude bugs in zzsys_trap. These zzsys_trap messages may be related to the error, but they are inscrutable:

Code: Select all

$TRAP_sql='53454c454354207361745f616c6c5f636f64652c207361745f616c6c5f6465736372697074696f6e2c207361745f616c6c5f67726f75702c207361745f616c6c5f747970652046524f4d207a7a7379735f616374697669747920'; $TRAP_b4sql=''; $TRAP_col='3230302c6c2c436f64652c7e3430302c6c2c4465736372697074696f6e2c7e3230302c6c2c47726f75702c7e3130302c6c2c41637469766974792c7e'; $TRAP_cnt='4'; $TRAP_tmp='___nu150b0ecae20a1b___';
$TRAP_sql='53454c454354207361745f616c6c5f636f64652c207361745f616c6c5f6465736372697074696f6e2c207361745f616c6c5f67726f75702c207361745f616c6c5f747970652046524f4d205f5f5f6e7531353062306563643363343464655f5f5f20'; $TRAP_b4sql='2463757272656e744163636573734c6576656c203d2027676c6f626561646d696e273b202463757272656e74557365724964203d2027676c6f626561646d696e273b202473716c5f64656661756c74203d2022435245415445205441424c45202462726f7773655461626c652053454c454354207a7a7379735f61637469766974792e2a2046524f4d207a7a7379735f6163636573735f6c6576656c20223b202473716c5f64656661756c74202e3d2022494e4e4552204a4f494e207a7a7379735f6163636573735f6c6576656c5f6163746976697479204f4e207a7a7379735f6163636573735f6c6576656c5f6964203d207361765f7a7a7379735f6163636573735f6c6576656c5f696420223b202473716c5f64656661756c74202e3d2022494e4e4552204a4f494e207a7a7379735f6163746976697479204f4e207361765f7a7a7379735f61637469766974795f6964203d207a7a7379735f61637469766974795f696420223b202473716c5f64656661756c74202e3d202257484552452028272463757272656e744163636573734c6576656c27203d2027676c6f626561646d696e27204f522073616c5f6e616d65203d20272463757272656e744163636573734c6576656c272920223b202473716c5f64656661756c74202e3d202247524f5550204259207a7a7379735f61637469766974795f696420223b202473716c5f676c6f626561646d696e203d2022435245415445205441424c45202462726f7773655461626c652053454c454354202a2046524f4d207a7a7379735f616374697669747920223b20696620282463757272656e74557365724964203d3d2027676c6f626561646d696e2729207b206e7552756e5175657279282473716c5f676c6f626561646d696e293b207d20656c7365207b206e7552756e5175657279282473716c5f64656661756c74293b207d20'; $TRAP_col='3230302c6c2c436f64652c7e3430302c6c2c4465736372697074696f6e2c7e3230302c6c2c47726f75702c7e3130302c6c2c41637469766974792c7e'; $TRAP_cnt='4'; $TRAP_tmp='___nu150b0ecd3c44de___';
What can I do to diagnose this issue?
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Server error generating report

Unread post by admin »

tschutter,

We don't support Sample nuFinancial.

It hasn't been maintained through recent upgrades as we have more pressing things to do.

It is just a sample, learn from it what you will, but don't use it.

Steven
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

Re: Server error generating report

Unread post by tschutter »

I am not trying to use the nuFinancial app. I am just using it to figure out how to properly generate reports. I have looked through the wiki and the tutorial videos, but a working example would be extremely helpful.

It turns out that the zzsys_trap messages do not have anything to do with the problem. They were generated before. If I clear out the zzsys_trap table and then click on the "Print to PDF" button (or any of the other generate buttons like "Print to Screen") the zzsys_trap table remains empty.

As a side note, I figured out that some of the zzsys_trap messages (but not all) are hex encoded. I wrote a quick tool to dump the zzsys_trap table, decoding and prettifying as necessary. It is available at https://github.com/tschutter/nubuilder Unfortunately I am not a PHP guru, so it is a Python script rather than some button that is part of nuBuilder.
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

Re: Server error generating report [SOLVED]

Unread post by tschutter »

I solved the problem. This is a genuine nuBuilder bug when run under PHP >= 5.4.0.

My apache error.log revealed this error:

Code: Select all

PHP Fatal error:  Cannot redeclare hex2bin() in /var/www/nubuilder-v2.7.4.11-12.10.24-Build529/productionnu2/report_object.php on line 240
I can now generate a report if I comment out the definition of hex2bin() at report_object.php:240. I suspect that the correct answer is to only define the hex2bin() function if PHP < 5.4.0.
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Server error generating report

Unread post by admin »

Well done!
vario
Posts: 119
Joined: Mon Dec 05, 2011 12:23 pm
nuBuilder Version: 4.5
Location: Newton Abbot, UK

Re: Server error generating report

Unread post by vario »

I have also just tripped up on this when upgrading my server from Squeeze to Wheezy. Following a Google search, this solution worked for me: http://jadawin-freebsd.morpheushosting. ... x2bin.html
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Server error generating report

Unread post by admin »

.
Locked