#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    163
    Rep Power
    10

    Warning: ftp_login() expects parameter 1 to be resource, boolean given ...


    Hello,

    I recently am having a problem with a php-triggered ftp-upload script, that keeps giving me that error, even though it worked fine before and I didnīt do any changes.

    "Warning: ftp_login() expects parameter 1 to be resource, boolean given in script.php on line 98

    Warning: ftp_pasv() expects parameter 1 to be resource, boolean given in script.php on line 99

    Warning: ftp_put() expects parameter 1 to be resource, boolean given in script.php on line 102
    "

    Here is the matching part of the php-code:

    PHP Code:
    $FTPserver "ftpserver";
    $FTPuser ="user";
    $FTPpass ="pass";

    $ftp ftp_connect($FTPserver);
    $login ftp_login($ftp$FTPuser$FTPpass);
    $modus ftp_pasv($ftp1); 
    Does anyone probably know what that error messages mean?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    88
    Rep Power
    11
    Warning: ftp_login() expects parameter 1 to be resource, boolean given in script.php on line 98

    Warning: ftp_pasv() expects parameter 1 to be resource, boolean given in script.php on line 99

    Warning: ftp_put() expects parameter 1 to be resource, boolean given in script.php on line 102
    The functions wanted first parameter(argument) as a FTP-resource ie. link identifier but they got a boolean value ie. FALSE.

    I guess, your code could be :
    PHP Code:
     $ftp ftp_connect($FTPserver) or die ("Can't connect to FTP Server : $FTPserver");
    $login ftp_login($ftp$FTPuser$FTPpass) or die ("Can't login to FTP Server : $FTPServer"); 
    The problem has it basis in the fact that, when ftp_connect() cannot connect to a FTP Server it returns FALSE instead of the resource link identifier it generally returns. Check whether your FTP server is alive using ping.

    -- Knight Samar
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    163
    Rep Power
    10
    thx so the basis of the problem is that it cannot connect to the ftp-server?

    best regards, pdoms
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    163
    Rep Power
    10
    changed the host for the ftp now a little (to the by the provider suggested url), but funny thing now is that sometimes I get that error sometimes not. The only pattern I could detect behind that is, that if I donīt use the script for like 10 minutes it would work the first time but every time after it wonīt work any more if I donīt wait 10 minutes again to run the script. Does that make sense to any of you?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    88
    Rep Power
    11
    Originally Posted by pdoms
    thx so the basis of the problem is that it cannot connect to the ftp-server?
    Yes, that must be so, I would say. Try echoing $ftp or using the die() function.

    Regards,
    Knight Samar
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    163
    Rep Power
    10
    thx

    do you have any idea on what could cause it to sometimes work and sometimes donīt even when using the exact same script with exact same data?

    best regards, pdoms
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    88
    Rep Power
    11
    I guess, it could be the server itself. Prolly you aren't closing the connection properly and the the server doesn't accept more than one connection from a user at a time and its timeout is set to 10 minutes after which you are able to connect.

    I really don't know,pdoms. You could ask the provider himself, he might or should know.

    Regards,
    Knight Samar.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    163
    Rep Power
    10
    ok will try that, thx for the help

    I always close the ftp-connection by ftp_quit($ftp), I guess that should work?
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Location
    Paraguay
    Posts
    2
    Rep Power
    0
    I had the same f*kin' problem, then I try to connect directly from the server with a console, but It was my server that has time out problems....

    if anyone had this kind of problem, try connecting directly from your host server to your FTP server...


    regards to all...

    ron.-

IMN logo majestic logo threadwatch logo seochat tools logo