MyBB Community Forums

Full Version: Windows NT Server + Install
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

does anyone know whats going wrong - on install/index.php:

echo file_exists("../inc/settings.php"); // results true
echo is_writable("../inc/settings.php"); // results true

$file = fopen('../inc/settings.php', 'w');
fwrite($file, "hello again");
fclose($file);

results:

Warning: fopen(../inc/settings.php) [function.fopen]: failed to open stream: Permission denied in C:\websites\www.lphant.com\forums\install\index.php on line 925

phpinfo:

PHP Version 5.1.2
Windows NT SERVER194 5.2 build 3790
allow_url_fopen = on
safe_mode = off
IIRC, Windows systems some times fail opening directories using fopen. Don't you have to escape any backslashes used?

http://us2.php.net/manual/en/function.fopen.php#55434
I try'd with any - but i need to test some other things. I don't admin this rootserver. I also don't know where installed it. So it can be that php don't has write permissions on IIS?
You might need to have read/write permissions on the directory that you're trying to open. I *think* it should be IUSR_{machinename}, but I'm not sure off the top of my head.
Yes, stupidly PHP doesn't take in to account user permissions for files when using is_writable. It will when you try to write to it when using fopen with either w or a

We've modified 1.2 to use the fopen method to check if files are writable.
Now I understand nearly nothing. If it was a problem with the user permissions why the following code runs fine?:

<?php

$name = '../demo.txt';
$text = "welcome";

$fp = fopen($name, 'w');
fwrite($fp, $text);
fclose($fp);

echo $name; exit;

?>
The setup runs without problems now. Only things I done is: Run step one - After the check if the files config.php and settings.php exists I deletet the files from ftp. Then all other steps runs fine. These files are created automaticly.