php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40214 Bad File Descriptor, Please help me
Submitted: 2007-01-24 04:40 UTC Modified: 2007-01-24 09:28 UTC
From: support at vikoshosting dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5CVS-2007-01-24 (snap) OS: Linux Kernel version 2.6.9-42.0.
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:
MUST BE VALID
Solve the problem:
15 + 1 = ?
Subscribe to this entry?

 
 [2007-01-24 04:40 UTC] support at vikoshosting dot com
Description:
------------
When I create a file using the FOPEN function and then try to change permissions on the file it says it cant be done because Bad File Descriptors. PHP version 5.1.6

Reproduce code:
---------------
$conn_id = chmod_open();

$ourFileName = "testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

function chmod_open()
{
   // Use your own FTP info
   $ftp_user_name = 'vikoshos';
   $ftp_user_pass = 'frath0pr';
   $ftp_root = '/';
   $ftp_server = 'localhost';
   $conn_id = ftp_connect($ftp_server);
   $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
   return $conn_id;
}

function chmod_file($conn_id, $permissions, $ftpath)
{
  echo "$ftpath";
  if (ftp_site($conn_id, 'CHMOD ' . $permissions . ' ' . $ftp_root . $ftpath) !== false)
   {
       return TRUE;
   }
   else
   {
       return FALSE;
   }
}

chmod_file($conn_id, 0777, $ourFileName);

Expected result:
----------------
Change the file mod to 777

Actual result:
--------------
Warning: ftp_site() [function.ftp-site]: Could not change perms on newfile.txt: Bad file descriptor in code.php on line 168

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-24 09:28 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC