Solved

How to write php application to transfer file to remove server

Posted on 2004-08-19
7
231 Views
Last Modified: 2013-12-12
Hi

Please advise couple of ways by using php application to transfer file to remove (linux)server.

My concern is, I didn't want to write a unix con script to do the transfer because it would be the bottonneck and hard to maintain

                    application (at server 1)
                      /          \
                 1  /             \  2
      backup database       \
      (mysql)                     transfer to backup server (at server 2)

1. I manage to backup the db and tar it locally using php application
2. How to proceed this step ???


I have tried step 2 by using php built in function, ftp_connect( ) but doesn't work, it say need to enable ftp while install php something, the error log " PHP Fatal error:  Call to undefined function:  ftp_connect( )".

Your feedback and steps are greatly appreciated

Gary
0
Comment
Question by:garytan
  • 2
  • 2
7 Comments
 
LVL 26

Accepted Solution

by:
ushastry earned 125 total points
ID: 11849649

Hi,

You have to configure PHP with: "--enable-ftp". to use php's ftp functions..
Like

./configure --prefix=/usr/share \
--datadir=/usr/share/php \
--with-apxs=/usr/sbin/apxs \
--bindir=/usr/bin \
--libdir=/usr/share \
--includedir=/usr/include \
--with-_lib=lib \
--with-config-file-path=/etc \
--with-exec-dir=/usr/lib/php/bin \
--with-mysql \
--disable-debug \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-inline-optimization \
--enable-magic-quotes \
--enable-mbstr-enc-trans \
--enable-mbstring \
--enable-track-vars \
--enable-trans-sid \
--with-bz2 \
--with-ftp \
--with-xml \
--with-dom \
--with-curl \
--with-zlib-dir=yes \
--with-mcrypt \
--with-xpm-dir \
--with-gd \
--with-jpeg-dir=/usr \
--with-tiff-dir \
--with-png-dir \
--with-freetype-dir \
--with-ttf \
--with-xpm-dir \
--enable-gd-native-ttf \
--with-ssl \
--with-kerberos=/usr/kerberos/include/ \
--with-pgsql
--with-jpeg-dir

make && make install

Check this link for more details..

http://www.ez.no/ez_publish/documentation/obsolete/installation/manual/compiling_php



Hope this Helps!
0
 
LVL 26

Expert Comment

by:ushastry
ID: 11849660


If all went fine..  confirm this by running this script.. you will see ftp is enabled this time

<?php

   phpinfo();

?>

also check this url..here you will find how to upload/download using php.

http://us3.php.net/ftp
0
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 125 total points
ID: 11851763
If you have a linux-box you can try the following, so you don't need to recompile:

system("ftp -u 'ftp://user:password@host/path/and/filename.tgz' /path/to/your/to/upload/file.tgz")

installed ftp-command at my box was lukemftp version 1.5 but that syntax may also work with other ftp-clients (maybe have a different syntax)
0
 
LVL 48

Expert Comment

by:hernst42
ID: 12569795
splitpoints  ushastry and hernst42
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question