pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
working with blobs in a two-server setup
4+ messages / 4 participants
[nested] [flat]

* working with blobs in a two-server setup
@ 2004-10-27 07:42 Joolz <joolz@arbodienst-limburg.nl>
  2004-10-27 07:50 ` Re: working with blobs in a two-server setup Justin Wyer <justin@isogo.co.za>
  0 siblings, 1 reply; 4+ messages in thread

From: Joolz @ 2004-10-27 07:42 UTC (permalink / raw)
  To: pgsql-php

Hi everyone,

I have a two server setup (both debian stable) with apache and the
PHP engine on server1 and postgresql on server2. My application
should be able to store BLOBs in the database. In a test environment
where everything was running on a single server it was OK (I used
the ADBOdb lo functions there) but now I get into all sorts of
trouble: the database can't find the uploaded file, which makes
sense: it's in /tmp on server1! :-(

Does anyone know how I can handle this or have a pointer to a howto?

Thanks!






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: working with blobs in a two-server setup
  2004-10-27 07:42 working with blobs in a two-server setup Joolz <joolz@arbodienst-limburg.nl>
@ 2004-10-27 07:50 ` Justin Wyer <justin@isogo.co.za>
  0 siblings, 0 replies; 4+ messages in thread

From: Justin Wyer @ 2004-10-27 07:50 UTC (permalink / raw)
  To: Joolz <joolz@arbodienst-limburg.nl>; pgsql-php

Joolz wrote:

>Hi everyone,
>
>I have a two server setup (both debian stable) with apache and the
>PHP engine on server1 and postgresql on server2. My application
>should be able to store BLOBs in the database. In a test environment
>where everything was running on a single server it was OK (I used
>the ADBOdb lo functions there) but now I get into all sorts of
>trouble: the database can't find the uploaded file, which makes
>sense: it's in /tmp on server1! :-(
>
>Does anyone know how I can handle this or have a pointer to a howto?
>
>Thanks!
>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>  
>
move the file to a location on server2?



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Fw: working with blobs in a two-server setup
@ 2004-10-27 17:25 Thom Dyson <TDyson@sybex.com>
  2004-10-27 20:28 ` Re: Fw: working with blobs in a two-server setup Jules Alberts <jules.alberts@arbodienst-limburg.nl>
  0 siblings, 1 reply; 4+ messages in thread

From: Thom Dyson @ 2004-10-27 17:25 UTC (permalink / raw)
  To: pgsql-php

Without a code sample it is pretty hard to offer any specific advice about 
what you are doing wrong.

Here is what I used to load some files.  All the $file____ variables are 
set above this block.

        $localname = "/home/tdyson/" . $filename;
        $fp = fopen($localname,"r");
        $buffer = fread($fp,filesize($localname));
        fclose($fp);
        $conn = pg_connect("host=myhost.sybex.com port=5432 dbname=my_db 
user=my_name password=my_password ");
        pg_query ($conn, "begin");
        $oid = pg_lo_create ($conn);
 
        $rs = pg_exec($conn,"insert into download_links (file_size, 
file_name, file_date, product_id, file_version, the_file) 
                        values('" . $filesize . "','" .  $filename . "','" 
.$filedate . "','" .  $product_id . "','" . $fileversion . "','" .  $oid . 
"')");     // the_file field type must be "oid"
 
        $handle = pg_lo_open ($conn, $oid, "w");

        pg_lo_write ($handle, $buffer);
        pg_lo_close ($handle);
        pg_query ($conn, "commit"); 
        pg_close();


Thom Dyson
Director of Information Services
Sybex, Inc.
 


pgsql-php-owner@postgresql.org wrote on 10/27/2004 12:42:34 AM:

> Hi everyone,

> I have a two server setup (both debian stable) with apache and the
> PHP engine on server1 and postgresql on server2. My application
> should be able to store BLOBs in the database. In a test environment
> where everything was running on a single server it was OK (I used
> the ADBOdb lo functions there) but now I get into all sorts of
> trouble: the database can't find the uploaded file, which makes
> sense: it's in /tmp on server1! :-(

> Does anyone know how I can handle this or have a pointer to a howto?

> Thanks!

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fw: working with blobs in a two-server setup
  2004-10-27 17:25 Fw: working with blobs in a two-server setup Thom Dyson <TDyson@sybex.com>
@ 2004-10-27 20:28 ` Jules Alberts <jules.alberts@arbodienst-limburg.nl>
  0 siblings, 0 replies; 4+ messages in thread

From: Jules Alberts @ 2004-10-27 20:28 UTC (permalink / raw)
  To: pgsql-php

Thom Dyson zei:
> Without a code sample it is pretty hard to offer any specific advice
> about
> what you are doing wrong.
>
> Here is what I used to load some files.  All the $file____ variables
> are
> set above this block.
>
>         $localname = "/home/tdyson/" . $filename;
>         $fp = fopen($localname,"r");
                ^^^^^

Thanks for reacting Tom. Seems that the problem was somewhere in the
adodb code. I switched to the native pg functions and they work
fine, so my problems are solved. Looking back i'm not sure if the
change to a two server setup was the problem... The test server was
a Fedora Core 2, now it's two Debian stables which have no doubt
older versions of adodb (and every other package, but that's the
price for stability I guess :)

Anyway, it's working now, thanks again.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2004-10-27 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-27 07:42 working with blobs in a two-server setup Joolz <joolz@arbodienst-limburg.nl>
2004-10-27 07:50 ` Justin Wyer <justin@isogo.co.za>
2004-10-27 17:25 Fw: working with blobs in a two-server setup Thom Dyson <TDyson@sybex.com>
2004-10-27 20:28 ` Jules Alberts <jules.alberts@arbodienst-limburg.nl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox