I have XAMPP installed on a Windows 2000 server. Everything works fine except for the fopen PHP function. I can neither create nor open files with it. it is strange that I can include / require / file_get_contents / other file-related functions; also fopen does not generate any errors or notifications, it just returns NULL.
I went so far as to give full control over the file and all private folders to everyone, but I still get NULL instead of the file pointer.
I tried this on php 5.2.9, 5.2.13 and 5.3.1 with the same effect. I looked at the php.ini file, looking for something that violates it; I even tried removing and using the main ini file from the linux window, where fopen works and still nothing.
I know that I need to restart apache after changing my ini and all that was (I even restarted the server), so it is not.
I am in this poing, assuming this is an apache configuration problem somehow, tomorrow I will run the test through php-cli to make sure.
I really don't want to hurt my head anymore over this, can any apache / php helper come to my aid?
Hi guys,
thanks for answers. you are right, this is not a configuration problem. the problem should be related to one of my dlls or one of my included files. I just tried the same code that does not work in the new file without any inclusions, and I turned off my custom libraries and it worked.
for the record here, what I was doing was not 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 } }
what i turn on must somehow break the fopen. works as expected in a new file without inclusions.