Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to write php application to transfer file to remove server

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses how to create an extensible mechanism for linked drop downs.
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.

860 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