Forum Moderators: coopster

Message Too Old, No Replies

php ftp-commands: uploading larga data-files

         

Oliver Henniges

1:36 pm on Oct 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am currently trying to automate regular updates from our internal warehousemanagement to our webserver (e.g. price-changes etc).

Doing it by hand, I generate a mysql-dump twice a week, copy it to my webserver, and run a routine importing it there. This file currently covers almost 7 MByte (uncompressed

If I try to automate this ftp-process with the php-ftp-command (running on my intranet-server in the eveneing), the upload is interrupted after about 4,7MByte. The code I use after log-in in is:

$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

Is there a certain limit for such binary files?

Any simple solution instead of splitting or compressing the file?

Sekka

3:29 pm on Oct 22, 2008 (gmt 0)

10+ Year Member



I don't know much about ftp_put() off the top of my head, but could it be the script is running longer than the maximum execution time, or that the memory usage is being exceeded?

brotherhood of LAN

3:41 pm on Oct 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The max execution time would be my first guess too.

set_time_limit(1000);

That would rule it out.. I take it there are no warnings/errors generated?

eelixduppy

3:43 pm on Oct 22, 2008 (gmt 0)



Is this a CLI SAPI script? If not you might want to consider it.

Oliver Henniges

2:53 pm on Oct 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thx for your ideas.
No, time limit is not the issue, I set

set_time_limit(0);

which means infinite to my knowledge.

eelixduppy, yes, cli running under php 5.0.5

Do you think It'll help to change mode to ascII?

Knucklehead00

4:08 pm on Oct 23, 2008 (gmt 0)

10+ Year Member



I believe that it has to do with your memory allocation limit.

Try placing this at the top of your import script:

ini_set("memory_limit", "160M");

Oliver Henniges

11:33 am on Oct 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think for my purpose there is no difference whether the momory limit is set to 160 or the default 128 M. But the links you gave brought me to a hint that the reason was an apache timeout.

I change the value from the default 300 seconds to 1000 in httpd.conf and it worked.

thanks a lot.