|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14781 ftp_login failure after mysql_connect
Submitted: 2001-12-31 11:30 UTC Modified: 2002-01-02 05:30 UTC
From: flim at novadoc dot de Assigned:
Status: Not a bug Package: FTP related
PHP Version: 4.1.1 OS: Linux Redhat 6.2/7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
44 - 29 = ?
Subscribe to this entry?

 [2001-12-31 11:30 UTC] flim at novadoc dot de
I wanted to connect to a ftp server, get some files and insert them into a database.
I started connecting to the ftp server, then logging in and that worked fine. Then I added a mysql_connect and now I get an error on ftp_login that says that it can not find ftpbuf.
(tried on two systems: Linux Redhat 6.2, Linux Redhat 7.2).

I'm not sure if this is a failure of ftp functions, mysql, a documentation problem or me being too stupid.

After dropping all unneccessary code, the file looks like that:
  $hHandle=mysql_connect("localhost", "nobody", "")
    or die ("no connection.\n");
  mysql_close ($hHandle); #this can be dropped

  $hFtp = ftp_connect ("localhost") #this works
    || die ("Could not connect.\n");
  # next line results in an error:
  $iLoginResult=ftp_login($hFtp, "nobody", "")
    || die ("Error: Unable to login\n");

I got the following error message:
Warning: Unable to find ftpbuf 1 in "scipt" on line "XX",
(which is the ftp_login line (ftp_connect works!)).

If you drop mysql_connect, its working fine...

I'm using build in mysql support (for version 3.23.39), ftp is of course enabled too.

Hopefully this is a stupid question and there is an easy answer...
Thanks in advance and a happy new year,


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-01 07:56 UTC]
Your code doesn't watch out for operator precedence:

$foo = function1() ||  die("i'm dead now");

will evalute to

$foo = ( function1() ||  die("i'm dead now") );

which means $foo will be true (if function1 succeeded).

For your code this means:

$hFtp = ( ftp_connect ("localhost") || die ("Could not connect.\n") ).

and therefore $hFtp will be boolean true and not your resource/connection id. Proper parenthesizing will solve this:

( $hFtp = ftp_connect ("localhost") ) || die ("Could not connect.\n");
 [2002-01-02 05:30 UTC] flim at novadoc dot de
Well...ahm. Should have thought of that myself I guess...thanks a lot. And sorry to bother you with things I should solve on my own :-)
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jun 03 08:03:39 2023 UTC