homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
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

5+ Year Member

Msg#: 4231108 posted 6:04 pm on Nov 16, 2010 (gmt 0)

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

$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!'); }



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



WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4231108 posted 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved