Php fopen returns false, but the file is read / write

there is a file that is readable and writable, but fopen returns false ...

if(is_readable($file)) echo 'readable '; if(is_writable($file)) echo 'writable '; $fp = fopen($file, 'a+'); var_dump($fp); 

result

 readable writable bool(false) 

Any ideas?

sure it should be a permissions thing, but tried 777 in a file with the same results.

+4
source share
1 answer

Try to get more information.
What is he doing

 $file = 'p:\muh'; error_reporting(E_ALL); ini_set('display_errors', true); echo 'phpversion: ', phpversion(), "\n"; echo 'uname: ', php_uname("sr"), "\n"; // name/release of the operating system echo 'sapi: ', php_sapi(), "\n"; echo $file, file_exists($file) ? ' exists' : ' does not exist', "\n"; echo $file, is_readable($file) ? ' is readable' : ' is NOT readable', "\n"; echo $file, is_writable($file) ? ' is writable' : ' is NOT writable', "\n"; $fp = fopen($file, 'a+'); if ( !$fp ) { echo 'last error: '; var_dump(error_get_last()); } else { echo "ok.\n"; } 

print?

see also: http://docs.php.net/error_get_last

+16
source

All Articles