Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Talk about working with different database types

Moderator: alexandrleonenko

neverton
Newbie
Newbie
Posts: 5
Joined: Jul 27th, '09, 13:25

Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Postby neverton » Feb 9th, '15, 12:08

Hi,
I've just upgraded from Centos6 ( and some CentOS 5 installs) where datagrid works great, no issues at all.

I've just upgraded to CentOS 7, and now the exact same pages no longer work.

I appreciate CentOS 7 has got upgraded versions of PHP, Apache, etc. but the error message I'm getting is;
[nativecode=Database connection has been lost.]

I've checked, and I can access postgresql using psql from a different machine, so it's accepting external connections and I can log on locally using the user, so it's accepting local connections as well.

This is the error message, the sql works fine and returns results.

Image

Looking at the versions, I've got the following;
CentOS 5.11, Apache 2.2.3, PHP 5.1.6/Postgresql 8.2 ( works fine on this)
CentOS 6.5, Apache 2.2.15, PHP 5.3.3, Postgresql 8.3 ( works fine on this)
CentOS 7.0, Apache 2.4.6, PHP 5.4.16, Postgresql 9.2.7 ( doesn't work on this)

I have tried it with the latest 7.9.9 version and I'm getting the same error messages, so I'm wondering if it's a postgresql issue, but I can't see what :(

Any pointers gratefully recieved, I have tried emailing support but they just pointed me to the webpage on how to set the connections up, and I already know that, I sent them code samples which are pretty much identical to the page they sent me to.

Regards
Neil

neverton
Newbie
Newbie
Posts: 5
Joined: Jul 27th, '09, 13:25

Re: Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Postby neverton » Feb 9th, '15, 12:14

Forgot to add the code!!

Code: Select all

<?php

  define ("DATAGRID_DIR", "datagrid/");            /* Ex.: "datagrid/" */
  define ("PEAR_DIR", "datagrid/pear/");           /* Ex.: "datagrid/pear/" */
//
  require_once(DATAGRID_DIR.'datagrid.class.php');
  require_once(PEAR_DIR.'PEAR.php');
  require_once(PEAR_DIR.'DB.php');
##
##  *** creating variables that we need for database connection
  $DB_USER='lor';           /* usually like this: prefix_name             */
  $DB_PASS='lor%1234';      /* must be already enscrypted (recommended)   */
  $DB_HOST='localhost';     /* usually localhost                          */
  $DB_NAME='lor';           /* usually like this: prefix_dbName           */
//
  ob_start();
  $db_conn =& DB::factory('pgsql');
  $result_conn = $db_conn->connect(DB::parseDSN('pgsql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME), true);

        $sql = "SELECT lor_order_id, customer_account as Customer,";

        $sql .= "to_char(date_received,'DD-MM-YY HH24:MI') as Date,";
        $sql .= "order_reference as Reference,";
        $sql .= "CASE WHEN passthru = 't' THEN file_rec_size || '/' || file_snt_size ELSE CAST (number_lines as char(5)) END as Size,";

        $sql .= "order_protocol_text.protocol_text as Protocol,";
        $sql .= "modem_number as Modem,";
        $sql .= "CASE WHEN order_protocol=8 THEN NULL ELSE connect_speed END as Speed,";
        $sql .= "order_status_text.status_text as Status,";
        $sql .= "refused_reason as Refused,";
        $sql .= "process_time as TimeTaken,";
        $sql .= "CASE WHEN order_protocol = 8 THEN ' ' WHEN oos_sent = 't' THEN 'Yes' WHEN oos_sent = 'f' THEN '<SPAN style=\"color:red\">No</SPAN>' END as OOSSent,";
        $sql .= "CASE WHEN order_protocol = 8 THEN ' ' WHEN cd_dropped = 't' THEN '<SPAN style=\"color:red\">Yes</SPAN>' WHEN cd_dropped = 'f' THEN 'No' END as CDDrop,";
        $sql .= "'O' as O, ";
        $sql .= "'I' as I, ";
        $sql .= "'L' as L, ";
        $sql .= "'X' as X, ";
        $sql .= "'R' as R ";
        $sql .= "from order_header,order_status_text,order_protocol_text ";
        $sql .= "where date_received > '2001-01-01' and ";
        $sql .= "order_header.order_status=order_status_text.status_key and ";
        $sql .= "order_header.order_protocol=order_protocol_text.protocol_key ";

#  echo $sql;
  $debugsql = true;
  $messages = true;
  $dgrid = new DataGrid($debugsql, $messages, "", DATAGRID_DIR);
  $default_order_field = "date_received";
  $default_order_type = "DESC";
  $dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);

  $dgrid->setCssClass("blue");

  $multirow_option = true;
  $dgrid->allowMultirowOperations($multirow_option);
  $multirow_operations = array(
        "delete" => array("view"=>true),
        "view" => array("view"=>true)
  );
  $dgrid->setMultirowOperations($multirow_option);

  $paging_option = true;
  $row_numeration = false;
  $numeration_sign = "N #";
  $dgrid->allowPaging($paging_option, $row_numeration, $numeration_sign);

  $bottom_paging = array("results"=>true,"results_align"=>"left","pages"=>true,"pages_align"=>"center","page_size"=>true,"page_size_align"=>true);
  $top_paging=array();
  $pages_array = array("10"=>"10","25"=>"25","50"=>"50","100"=>"100");
  $default_page_size = 25;
  $dgrid->setPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size);

  $filtering_option = true;
  $dgrid->allowFiltering($filtering_option);

  $filtering_fields = array(
        "Customer"      => array("table"=>"order_header","field"=>"customer_account", "source"=>"self", "operator"=>"true","default_operator"=>"like","type"=>"textbox","case_sensitive"=>false,"comparison_type"=>"string"),
        "Protocol"      => array("table"=>"order_protocol_text","field"=>"protocol_text", "source"=>"self", "operator"=>"true","default_operator"=>"like",type=>"dropdownlist"),
        "Status"        => array("table"=>"order_status_text","field"=>"status_text", "source"=>"self", "operator"=>"true","default_operator"=>"like",type=>"dropdownlist"),
        "Modem"         => array("table"=>"order_header","field"=>"modem_number", "source"=>"self", "operator"=>"true","default_operator"=>"like",type=>"dropdownlist","comparison_type"=>"numeric")
  );
  $dgrid->setFieldsFiltering($filtering_fields);

  $dgrid->allowPrinting(true);
  $dgrid->allowExporting(true,"/var/www/html/datagrid/export/");


  $modes = array(
    "add" => array("view"=>false,"edit"=>false,"type"=>"link"),
    "delete" => array("view"=>false,"edit"=>true,"type"=>"link"),
    "view" => array("view"=>false,"edit"=>true,"type"=>"link")
  );
  $dgrid->setModes($modes);

//  $vm_table_properties = array("width"=>"90%");
//  $dgrid->setViewModeTableProperties($vm_table_properties);

  $auto_column_in_view_mode = true;
  $dgrid->setAutoColumnsInViewMode($auto_column_in_view_mode);

  $vm_columns = array (
//      "chk"=>array("header"=>"Chkd","type"=>"link","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"floating","title"=>"Flag order as checked","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"lor_order_id","field_data"=>"chk","rel"=>"","target"=>"","href"=>"redirect.php?cmd=checked.php?orderid={0}&close=true","on_js_event"=>"onClick=\"document.location.reload(true);\""),
        "chk"=>array("header"=>"Chkd","type"=>"link","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"floating","title"=>"Flag order as checked","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"lor_order_id","field_data"=>"chk","rel"=>"","target"=>"","href"=>"checked.php?orderid={0}&close=true","on_js_event"=>"onClick=\"document.location.reload(true);\""),
        "customer"=>array("header"=>"Customer","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","labelbgcolor"=>"RED","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "date"=>array("header"=>"Date Received","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "reference"=>array("header"=>"Reference","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "size"=>array("header"=>"Num.Ln","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "picklines"=>array("header"=>"Num.Pk","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "protocol"=>array("Protocol"=>"Modem","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "modem"=>array("header"=>"Modem","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "speed"=>array("header"=>"Connect Speed","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "status"=>array("header"=>"Status","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "refused"=>array("header"=>"Refused Reason","type"=>"label","align"=>"left","width"=>"","wrap"=>"wrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "timetaken"=>array("header"=>"Process Time","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "oossent"=>array("header"=>"OOS Sent","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "cddrop"=>array("header"=>"CD Dropped","type"=>"label","align"=>"left","width"=>"","wrap"=>"nowrap","tooltip"=>"false","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>""),
        "o"=>array("header"=>"","type"=>"link","text_length"=>"1","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"simple","title"=>"View Ordered Products","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"lor_order_id","field_data"=>"o","rel"=>"","target"=>"","href"=>"redirect.php?cmd=order.php?orderid={0}"),
        "i"=>array("header"=>"","type"=>"link","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"simple","title"=>"View Order Information","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"lor_order_id","field_data"=>"i","rel"=>"","target"=>"","href"=>"redirect.php?cmd=info.php?orderid={0}"),
        "l"=>array("header"=>"","type"=>"link","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"simple","title"=>"View Order Log","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"lor_order_id","field_data"=>"l","rel"=>"","target"=>"","href"=>"redirect.php?cmd=logs.php?orderid={0}"),
        "x"=>array("header"=>"","type"=>"link","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"simple","title"=>"View FTP Logs for account number","case"=>"floating","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"customer","field_data"=>"x","rel"=>"","target"=>"","href"=>"redirect.php?cmd=grepxfer.php?account={0}"),
        "r"=>array("header"=>"","type"=>"link","align"=>"centre","width"=>"","wrap"=>"nowrap","tooltip"=>"true","tooltip_type"=>"simple","title"=>"Resend Order to Server","case"=>"normal","summarize"=>"false","sort_by"=>"false","visible"=>"true","on_js_event"=>"","field_key"=>"lor_order_id","field_data"=>"r","rel"=>"","target"=>"","href"=>"redirect.php?cmd=resend.php?orderid={0}&prompt=Resend Order {0}?"),
        );

  $dgrid->setColumnsInViewMode($vm_columns);

  $table_name = "order_header";
  $primary_key = "lor_order_id";
  $condition = "";
  $dgrid->setTableEdit($table_name, $primary_key, $condition);
  $dgrid->setAutoColumnsInEditMode(true);

  $dgrid->bind();
  ob_end_flush();
?>



administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Postby administrator » Feb 9th, '15, 19:00

Please use our paid version, we've stopped to support free versions of DataGrid.

neverton
Newbie
Newbie
Posts: 5
Joined: Jul 27th, '09, 13:25

Re: Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Postby neverton » Feb 9th, '15, 22:07

Hi,
This is the paid version, I purchased it in 2009.

Regards

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Postby administrator » Feb 10th, '15, 18:43

Please upgrade it to the latest version to use PDO, not PEAR.
PEAR has a very old drivers, that were not updated many years.

neverton
Newbie
Newbie
Posts: 5
Joined: Jul 27th, '09, 13:25

Re: Upgrade from CentOS 6 to CentOS 7 has broken datagrid

Postby neverton » Feb 10th, '15, 20:07

Hi,
Upgraded to 7.9.9, now I'm getting this;

[08006] [7] could not connect to server: Permission denied Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Permission denied Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

But I can connect to postgresql using psql from another PC without any errors;

C:\Program Files\PostgreSQL\9.2\bin>psql -U lor -h 192.168.1.11
psql (9.2.4, server 9.2.7)
WARNING: Console code page (850) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

lor=>

So it's definitely running and accepting connections, can you offer any advice to move forward with this?

Here's the test code I'm using;

Code: Select all

<?php
  define ('DATAGRID_DIR', 'datagrid/');            /* Ex.: "datagrid/" */
  require_once(DATAGRID_DIR.'datagrid.class.php');

  $DB_USER='lor';           /* usually like this: prefix_name             */
  $DB_PASS='password';      /* must be already enscrypted (recommended)   */
  $DB_HOST='localhost';     /* usually localhost                          */
  $DB_NAME='lor';           /* usually like this: prefix_dbName           */
//
  ob_start();
  session_start();

        $sql = "SELECT lor_order_id, customer_account as Customer,";
        $sql .= "to_char(date_received,'DD-MM-YY HH24:MI') as Date,";
        $sql .= "order_reference as Reference,";
        $sql .= "CASE WHEN passthru = 't' THEN file_rec_size || '/' || file_snt_size ELSE CAST (number_lines as char(5)) END as Size,";
        $sql .= "order_protocol_text.protocol_text as Protocol,";
        $sql .= "modem_number as Modem,";
        $sql .= "CASE WHEN order_protocol=8 THEN NULL ELSE connect_speed END as Speed,";
        $sql .= "order_status_text.status_text as Status,";
        $sql .= "refused_reason as Refused,";
        $sql .= "process_time as TimeTaken,";
        $sql .= "CASE WHEN order_protocol = 8 THEN ' ' WHEN oos_sent = 't' THEN 'Yes' WHEN oos_sent = 'f' THEN '<SPAN style=\"color:red\">No</SPAN>' END as OOSSent,";
        $sql .= "CASE WHEN order_protocol = 8 THEN ' ' WHEN cd_dropped = 't' THEN '<SPAN style=\"color:red\">Yes</SPAN>' WHEN cd_dropped = 'f' THEN 'No' END as CDDrop,";
        $sql .= "'O' as O, ";
        $sql .= "'I' as I, ";
        $sql .= "'L' as L, ";
        $sql .= "'X' as X, ";
        $sql .= "'R' as R ";
        $sql .= "from order_header,order_status_text,order_protocol_text ";
        $sql .= "where date_received != 0 and ";
        $sql .= "order_header.order_status=order_status_text.status_key and ";
        $sql .= "order_header.order_protocol=order_protocol_text.protocol_key ";

  $debug_mode = true;
  $messaging = true;
  $dgrid = new DataGrid($debug_mode, $messaging, "aaa_");
  $default_sort = array('date_received'=>'DESC');
  $dgrid->dataSource('PDO', 'pgsql', $DB_HOST, $DB_NAME, $DB_USER, $DB_PASS, $sql, $default_sort);

  $dgrid->setCssClass("blue");

  $multirow_option = true;
  $dgrid->allowMultirowOperations($multirow_option);
  $multirow_operations = array(
        "delete" => array("view"=>true),
        "view" => array("view"=>true)
  );
  $dgrid->setMultirowOperations($multirow_option);

  $table_name = "order_header";
  $primary_key = "lor_order_id";
  $condition = "";
  $dgrid->setTableEdit($table_name, $primary_key, $condition);
  $dgrid->setAutoColumnsInEditMode(true);

  $dgrid->bind();
  ob_end_flush();
?>




Return to “Databases: different types implementation”