Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#354 dbexport.php problem

GIT
closed-fixed
5
2010-08-26
2009-03-28
Mike Robinson
No

I'm running Pgsql 8.3.6. When I try to export a table in phpPdAdmin 4.2.2 I get the following message
<br />
<b>Notice</b>: Undefined offset: 1 in <b>/usr/src/library/docs/pgadmin/dbexport.php</b> on line <b>75</b><br />
<br />
<b>Notice</b>: Undefined offset: 1 in <b>/usr/src/library/docs/pgadmin/dbexport.php</b> on line <b>78</b><br />

On inspecting the code it appears the code at line 71 of dbexport.php is not creating the required array elements in $version. To get past the problem I inserted " $version[1]='8.3.6' " at line 72, and although it fixed the error message it didn't fix the problem because nothing was dumped from the table.

I looked at the variable $cmd and it contains: /home/pgsql/bin/pg_dump -i -t '"public"'.'"tindex"'. Executing this command on the command line produces an error message: pg_dump: [archiver (db)] connection to database "root" failed: FATAL: database "root" does not exist.

I'm trying to connect to database 'webRIMS' so I changed the command to /home/pgsql/bin/pg_dump -i -t '"public"'.'"tindex"' webRIMS, adding the name of the database as required by pg_dump. This produced the following error: pg_dump: [archiver (db)] connection to database "webRIMS" failed: FATAL: role "root" does not exist.

Here is my config file:
<?php
$conf['servers'][0]['desc'] = 'webRIMS';
$conf['servers'][0]['host'] = '127.0.0.1';
$conf['servers'][0]['port'] = 5432;
$conf['servers'][0]['sslmode'] = 'allow';
$conf['servers'][0]['defaultdb'] = 'webRIMS';
$conf['servers'][0]['pg_dump_path'] = '/home/pgsql/bin/pg_dump';
$conf['servers'][0]['pg_dumpall_path'] = '/home/pgsql/bin/pg_dumpall';
$conf['servers'][0]['slony_support'] = false;
$conf['servers'][0]['slony_sql'] = '/usr/share/pgsql';
$conf['default_lang'] = 'english';
$conf['autocomplete'] = 'default on';
$conf['extra_login_security'] = false; // MJR changed from true;
$conf['owned_only'] = false;
$conf['show_comments'] = true;
$conf['show_advanced'] = false;
$conf['show_system'] = false;
$conf['show_reports'] = true;
$conf['reports_db'] = 'phppgadmin';
$conf['reports_schema'] = 'public';
$conf['reports_table'] = 'ppa_reports';
$conf['owned_reports_only'] = false;
$conf['min_password_length'] = 6; // MJR changed from 1;
$conf['left_width'] = 250; // MJR changed from 200;
$conf['theme'] = 'default';
$conf['show_oids'] = false;
$conf['max_rows'] = 300; // MJR changed from 30;
$conf['max_chars'] = 50;
$conf['use_xhtml_strict'] = false;
$conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/';
$conf['version'] = 19;
?>

I created the database 'webRIMS' using psql, and I created the tables in webRIMS using phpPgAdmin 4.2.2.

MJR

Discussion

  • Mike Robinson
    Mike Robinson
    2009-04-03

    Thanks Guillaume, but the change you made doesn't fix the problem. Now I get the following error message: Export error: Failed to execute pg_dump (given path in your conf/config.inc.php : /home/pgsql/bin/pg_dump). Please, fix this path in your configuration and relog.

    My copy of pg_dump is in /home/pgsql/bin, and I want to leave it there.

    [root@Centos ~]# locate pg_dump
    /home/pgsql/bin/pg_dump
    /home/pgsql/bin/pg_dumpall
    /usr/share/man/man1/pg_dump.1
    /usr/share/man/man1/pg_dumpall.1
    [root@Centos ~]# ls -l /home/pgsql/bin/pg_dump
    -rwxr-xr-x 1 root root 1628312 2009-03-25 09:34 /home/pgsql/bin/pg_dump

    MJR

     
  • Mike Robinson
    Mike Robinson
    2009-04-03

    Guillaume,

    I copied pg_dump into /usr/bin/ and changed conf/config.inc.php to reflect this, and the export function works.

    However, I know of no rule that says pg_dump must reside in a specific location. Is there such a rule?

    MJR

     
  • Mike,

    I suspect you have some kind of permissions problems when you try to use pg_dump from the /home/pgsql folder. Take care anyone have enought rights to access files in /home/pgsql/bin/ AND execute them.

    As instance, your PPA is probably runned with your httpd user rights, usualy httpd or www-data.

    /ioguix

     
  • Mike Robinson
    Mike Robinson
    2009-04-08

    Guillaume,

    You're right. The pgsql install process created /home/pgsql with restricted access, although the pg_dump program has 0755 permissions, which is why it works when copied to /bin.

    Thank you for your assistance.

     
  • Hey,

    I fixed a couple of bugs in this file (dbexport.php). Please, give it a test using our current dev tree snapshot from our GIT repository:

    http://github.com/xzilla/phppgadmin

    you can download a tarbal or a zip file from this page.

    Thank you for your report and next feedback !

     
    • milestone: 897043 --> GIT
    • assigned_to: nobody --> ioguix
    • status: open --> pending-fixed
     
  • oh, it was actually solved...so I guess I can just close it :)

     
    • status: pending-fixed --> closed-fixed