Re: Re: DataObjects: problem connecting to postgres
| From: | Jeroen Houben | Date: | Fri, 28 Mar 2003 14:38:55 +0000 |
| Subject: | Re: Re: DataObjects: problem connecting to postgres | ||
| References: | 1 2 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-14710@lists.php.net to get a copy of this message | ||
Jeroen Houben wrote:
Jeroen Houben wrote:require_once 'DB/DataObject/Generator.php'; /* if (!ini_get('register_argc_argv')) { PEAR::raiseError("\nERROR: You must turn register_argc_argv On in you php.ini file for this to work\neg.\n\nregister_argc_argv = On\n\n", null, PEAR_ERROR_DIE); exit; } if (!@$_SERVER['argv'][1]) { PEAR::raiseError("\nERROR: createTable.php usage:\n\nC:\php\pear\DB\DataObjects\createTable.php example.ini\n\n", null, PEAR_ERROR_DIE); exit; } */ // just put the file here $config = parse_ini_file('/usr/local/share/php/private_v2/DataObjects.ini', true); Changed the permissions so Apache can read/write the files and it works :-) - JeroenHi, Running createtables.php on the command line for my postgres DB doesn't work. It says the db doesn't exists, but the same DSN works fine with DB and MDB. Here's the debug info CREATING FOR pgsql://postgres:xxxx@localhost/sixnetI just remembered something that may cause my problem. A while ago I tried to run an MDB script on the command line which also wouldn't work, but when I ran it in a browser it worked. Running PHP from the command line does not work well with the Postgresql module I think. I'll try run createtables.php in a browser... Yep, that's it. I moved createtables and generator.php to a browseable location. Changed createtables a little:CONNECT : NEW CONNECTION CONNECT : pgsql://postgres:xxxx@localhost/sixnet d3a68a9e7862280d4fd844a0cf67ad08 CONNECT : a:1:{s:32:"d3a68a9e7862280d4fd844a0cf67ad08";O:8:"db_error":8:{s:20:"error_message_prefix";s:0:"";s:4:"mode";i:1;s:5:"level";i:1024;s:4:"code";i:-25;s:7:"message";s:26:"DB Error: no such database";s:8:"userinfo";s:40:"pgsql://postgres:xxxx@localhost/sixnet";s:9:"backtrace";a:9:{i:0;a:6:{s:4:"file";s:32:"/usr/local/share/php/pear/DB.php";s:4:"line";i:605;s:8:"function";s:10:"pear_error";s:5:"class";s:8:"db_error";s:4:"type";s:2:"->";s:4:"args";a:5:{i:0;s:26:"DB Error: no such database";i:1;i:-25;i:2;i:1;i:3;i:1024;i:4;s:0:"";}}i:1;a:6:{s:4:"file";s:34:"/usr/local/share/php/pear/PEAR.php";s:4:"line";i:509;s:8:"function";s:8:"db_error";s:5:"class";s:8:"db_error";s:4:"type";s:2:"->";s:4:"args";a:4:{i:0;i:-25;i:1;i:1;i:2;i:1024;i:3;s:0:"";}}i:2;a:6:{s:4:"file";s:39:"/usr/local/share/php/pear/DB/common.php";s:4:"line";i:297;s:8:"function";s:10:"raiseerror";s:5:"class";s:4:"pear";s:4:"type";s:2:"::";s:4:"args";a:7:{i:0;N;i:1;i:-25;i:2;N;i:3;N;i:4;s:0:"";i:5;s:8:"DB_Error";i:6;b:1;}}i:3;a:6:{s:4:"file";s:38:"/usr/local/share/php/pear/DB/pgsql.php";s:4:"line";i:85;s:8:"function";s:10:"raiseerror";s:5:"class";s:8:"db_pgsql";s:4:"type";s:2:"->";s:4:"args";a:1:{i:0;i:-25;}}i:4;a:6:{s:4:"file";s:32:"/usr/local/share/php/pear/DB.php";s:4:"line";i:283;s:8:"function";s:7:"connect";s:5:"class";s:8:"db_pgsql";s:4:"type";s:2:"->";s:4:"args";a:2:{i:0;a:9:{s:7:"phptype";s:5:"pgsql";s:8:"dbsyntax";s:5:"pgsql";s:8:"username";s:8:"postgres";s:8:"password";s:6:"xxxx";s:8:"protocol";s:3:"tcp";s:8:"hostspec";s:9:"localhost";s:4:"port";b:0;s:6:"socket";b:0;s:8:"database";s:6:"sixnet";}i:1;b:0;}}i:5;a:6:{s:4:"file";s:43:"/usr/local/share/php/pear/DB/DataObject.php";s:4:"line";i:1211;s:8:"function";s:7:"connect";s:5:"class";s:2:"db";s:4:"type";s:2:"::";s:4:"args";a:1:{i:0;s:40:"pgsql://postgres:xxxx@localhost/sixnet";}}i:6;a:6:{s:4:"file";s:53:"/usr/local/share/php/pear/DB/DataObject/Generator.php";s:4:"line";i:144;s:8:"function";s:8:"_connect";s:5:"class";s:23:"db_dataobject_generator";s:4:"type";s:2:"->";s:4:"args";a:0:{}}i:7;a:6:{s:4:"file";s:53:"/usr/local/share/php/pear/DB/DataObject/Generator.php";s:4:"line";i:114;s:8:"function";s:16:"_createtablelist";s:5:"class";s:23:"db_dataobject_generator";s:4:"type";s:2:"->";s:4:"args";a:0:{}}i:8;a:6:{s:4:"file";s:56:"/usr/local/share/php/pear/DB/DataObject/createTables.php";s:4:"line";i:45;s:8:"function";s:5:"start";s:5:"class";s:23:"db_dataobject_generator";s:4:"type";s:2:"->";s:4:"args";a:0:{}}}s:8:"callback";N;}}DB Error: no such database Any ideas? TIA