?
Solved

How to write php application to transfer file to remove server

Posted on 2004-08-19
7
Medium Priority
?
236 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
[X]
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
  • 2
  • 2
7 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

762 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