homepage Welcome to WebmasterWorld Guest from 54.227.62.141
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP ftp does not work with Cron
pemba76




msg:4231110
 6:04 pm on Nov 16, 2010 (gmt 0)

I have simple php script that does a FTP between 2 servers.

<?php
$server = "ftp.server.com";
$ftp_user_name = "user123";
$ftp_user_pass = "pass123";
$connection = ftp_connect($server);
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);

if (!$connection || !$login) { die('Connection attempt failed!'); }

ftp_get($connection,"file1.txt","file1.txt",FTP_ASCII);

ftp_close($connection);
?>

When i run this script directly from the browser (http://www.mysite.com/script.php), the file tranfers without any problem. The file copies from server.com to mysite.com.

But when i try to run it from Cron, nothing happens. The file does not transfer and nor does it show any error. I have all other scripts running fine with cron. The cron command is :

/usr/local/bin/php /hsphere/local/home/user/mysite.com/script.php

Please help

 

coopster




msg:4235023
 8:23 pm on Nov 25, 2010 (gmt 0)

It could be the CLI versus CGI executable of PHP. See Command Line Usage in the PHP online manual: [php.net...]
Try running the crontab from /usr/bin/php instead.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved