Page 1 of 1

Server error generating report

PostPosted: Sun Nov 25, 2012 2:04 am
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?

Re: Server error generating report

PostPosted: Sun Nov 25, 2012 10:51 am
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

Re: Server error generating report

PostPosted: Sun Nov 25, 2012 10:56 am
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.

Re: Server error generating report [SOLVED]

PostPosted: Mon Nov 26, 2012 1:52 am
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.

Re: Server error generating report

PostPosted: Mon Nov 26, 2012 11:24 am
by admin
Well done!

Re: Server error generating report

PostPosted: Sun May 19, 2013 5:14 pm
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

Re: Server error generating report

PostPosted: Wed Jun 12, 2013 1:37 pm
by admin
.