Page 1 of 1

File Handle Problem

Posted: Sun Jul 16, 2006 3:48 pm
by Zeroed
Hi Folks,

I've been trying to Open a directory on my Hosted website (it's with GoDaddy - the account is enabled with PHP 4.3) and I'm having troubles obtaining a file handle. Here's the code:

Code: Select all

<?php

        $handle = opendir("d:\\hosted\\zeroed"); // $_SERVER['DOCUMENT_ROOT']
        $test = "This is a test.";
        if ($handle) echo "Handle";
        else echo "No handle.";

 ?>
It always outputs "No handle", no matter what directory I attempt to open. It could be DOCUMENT_ROOT, my home folder, or just ".". Can anyone tell me what I'm doing wrong? Am I testing $handle correctly? Do I not have permissions to open the folders? Any ideas?

-Zeroed

Posted: Sun Jul 16, 2006 4:18 pm
by MarK (CZ)
It may be the permissions issue. Try putting

Code: Select all

error_reporting(E_ALL);
before the code and see what it writes (as php manual says: "If path is not a valid directory or the directory can not be opened due to permission restrictions or filesystem errors, opendir() returns FALSE and generates a PHP error of level E_WARNING.").

PS: please use

Code: Select all

tags for php code.

Posted: Sun Jul 16, 2006 5:49 pm
by wtf
You may want to read through godaddy's knowledge base. Last time I've had a client with godaddy's account it was a bitch to get anything done since they purposly disable bnch of PHP functions and most of them are related to file manipulation etc. Somewhere in the knowledge base you will find a list of functions that are disabeled. You can also run phpinfo() and look for the disable_functions to see what's not available to you.

Here's something from google

"Godaddy PHP Disabled Functions (Linux): All Posix functions disabled. Also, the following functions are disabled: fpassthru, file, mail, exec, system, passthru, popen, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, psockopen, opendir, readdir, closedir, phpinfo"

http://www.imscart.com/blog/?postid=382

http://www.nutt.net/2006/07/06/godaddy- ... functions/

http://www.vbulletin.com/forum/archive/ ... 33216.html


Good luck!

~wtf