ID: 30254
User updated by: mave at clanteamtreff dot com
-Summary: MySQL Connection lost on ftp_close
Reported By: mave at clanteamtreff dot com
Status: Open
-Bug Type: FTP related
+Bug Type: Sockets related
Operating System: Debian 3.0 r2 kernel 2.6.7
PHP Version: 5.0.1
New Comment:
im currently develope some new interfaces, the problem i told with
problems on ftp_close() can reproduced with all socket connections.
This mean, my SQL Connection gets lost if any command closes a socket
connection.
I connect to sql server ( mysql_connect(...) )
then i want to use file_get_contents with fopen wrappers from an
ftpserver.
The File read from the ftp server is sucessfully, but after that
command, the mysql connection is lost.
All the Commands i have testet with using sockets or something like
this, kills the mysql connection.
If there are any questitions, just ask.
(Sorry for my bad english, i hope you understand all)
Previous Comments:
------------------------------------------------------------------------
[2004-09-27 12:51:37] mave at clanteamtreff dot com
Description:
------------
currently i use a MySQL Class to handle the Connection to the Database.
No i wrote a litte FTP tool, to get a logfile from an other server.
After the command ftp_close my MySQL Connection is broken, he tells me,
MySQL Connection lost during Query or Connection to MySQL lost,
reconnecting.
If i deactivate the ftp_close command, the whole page runns perfectly.
I think there is a problem with handling the resources.
I use the XAMPP Linux 1.4.8 from www.apachefriends.org.
Reproduce code:
---------------
$handle = ftp_connect(gethostbyname("localhost"), 21);
$res = ftp_login( $handle, $login, $pass);
if( !$res ) echo "Can't login to FTP";
$f_name = "/tmp/FTP-TMP.".randomstring(20);
$file = fopen( $f_name, "w+" );
if( !$file ) echo "Can't fopen the File";
ftp_fget( $handle, $file, "lastout.txt", FTP_ASCII);
...
$kontent = writemessage($out); // Produce the output
fclose($file);
ftp_close($handle); // clean up
unlink($f_name); // clean up
Expected result:
----------------
Output from the MySQL Class:
[MySQL]: Verbindung zum Host verloren, neuaufbau der Verbindung
(that means connection lost, reconnecting)
And the rest of the Page can't connect to the mysql server.
after i remove the "ftp_close($handle);" line, it works fine.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30254&edit=1