Solved

How to write php application to transfer file to remove server

Posted on 2004-08-19
7
230 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now