?
Solved

How to write php application to transfer file to remove server

Posted on 2004-08-19
7
Medium Priority
?
239 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
4 Comments
 
LVL 26

Accepted Solution

by:
Umesh earned 500 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:Umesh
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 500 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

807 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