php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44360 Each new instance of ftp_connect breaks other connections in other scripts
Submitted: 2008-03-07 09:13 UTC Modified: 2008-03-07 13:40 UTC
From: upandhigh at gmail dot com Assigned:
Status: Closed Package: FTP related
PHP Version: 5.2.5 OS: Fedora Core 6/8
Private report: No CVE-ID: None
 [2008-03-07 09:13 UTC] upandhigh at gmail dot com
Description:
------------
When you trying to use FTP connections from different PHP scripts, the new created connection from one THREAD or FILE running - breaks another connection what was made from other THREAD or FILE. 

Reproduce code:
---------------
if ($pid = pcntl_fork())
{
  $my_pid = getmypid();
  print $pid." - ".$my_pid."\n";
  $a = ftp_connect("ftp.debian.com", 21, 5);
  echo $a;
  sleep(10);
}
else
{
  $my_pid = getmypid();
  $b = ftp_connect("ftp.kernel.org", 21, 5);
  echo $b;
  sleep(10);
}

Expected result:
----------------
This code will return Resource Id#4 for all threads. So if we will download or upload files with $b - connection ID it will be stopped when another thread will be started, with $a - connection ID. It happens when code started from different CLI FILES, or from FORKED processes of one source file.

Actual result:
--------------
Well I just wanted to have several FTP connections from one server - but seems it's impossible, because each new connection - breaks previous one what was made from other script.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-07 13:40 UTC] upandhigh at gmail dot com
situation was affected by incorrect OS settings. not PHP problem. ticket closed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 19:01:30 2024 UTC