I've XAMPP placed on a home windows 2000 server. things are working great except the PHP fopen function. I'm able to neither create nor open files by using it. the strange factor is will be able to include/require/file_get_contents/other file related functions also fopen doesn't generate any errors or notices it simply returns NULL.

I've gone so far as to grant full charge of the file and all sorts of attaching folders to everyone however i get NULL rather than personal files pointer.

I've attempted this on php 5.2.9, 5.2.13, and 5.3.1 with similar effect. i have undergone the php.ini file searching for something that's breaking it i've even attempted removing and taking advantage of the fundamental ini file from the linux box where fopen is working but still nothing.

I understand i must restart apache after altering my ini and all sorts of might happen to be (I've even restarted the server) so this isn't it.

I'm only at that poing presuming it's an apache configuration problem in some way, tomorrow im likely to operate a test through php-cli to make certain.

I truly don't wish to bruise my mind any longer over this could some apache/php wizard arrived at my aid?


Hi men,

just reactions. you're right is isn't any config problem. the issue needs to be and among my dlls a treadmill of my incorporated files. I simply attempted exactly the same code that is not your new file with no include and that i disabled my custom libraries also it labored.

for that record here's what I had been doing that wasn't working:

$test_file = 'c:\\test.csv';//everybody has full control. is very large.
    if(file_exists($test_file) && is_readable($test_file)){
        $fp = fopen($test_file, 'r');
        echo var_export($fp, true);//outputs NULL. on my linux box this is a number.
        if($fp !== false){
            //do the work
            fread($fp, 10);//throws the error that $fp is not a valid file handle
        }
    }

something that i'm including should be breaking fopen in some way. works not surprisingly in new file without any includes.

So we are to visualize you are by using this type of code:

$fp = fopen( "my_file.txt", "r" );
$contents = fread($fp, filesize( "my_file.txt" ) );
fclose($fp);

Shall We Be Held to visualize the filesize() function returns null? Likewise try the stat($filename) function to ascertain if you receive a relatively complete array.

Tell me your results.

just reactions. you're right is isn't any config problem. the issue needs to be and among my dlls a treadmill of my incorporated files. I simply attempted exactly the same code that is not your new file with no include and that i disabled my custom libraries also it labored.

for that record here's what I had been doing that wasn't working:

$test_file = 'c:\\test.csv';//everybody has full control. is very large.
    if(file_exists($test_file) && is_readable($test_file)){
        $fp = fopen($test_file, 'r');
        echo var_export($fp, true);//outputs NULL. on my linux box this is a number.
        if($fp !== false){
            //do the work
            fread($fp, 10);//throws the error that $fp is not a valid file handle
        }
    }

something that i'm including should be breaking fopen in some way. works not surprisingly in new file without any includes.