tonit Posted April 30, 2011 Share Posted April 30, 2011 I'm trying this simple script on my windows server 2008 standard edition but keep getting errors. <?php error_reporting(-1); ini_set( 'display_errors' , 1 ); $file=fopen("2.txt","a") ; fwrite($file,"Hai"); ?> Warning: fopen(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\inetpub\wwwroot\10.php on line 3 Warning: fopen(2.txt): failed to open stream: Permission denied in C:\inetpub\wwwroot\10.php on line 3 Warning: fwrite(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\inetpub\wwwroot\10.php on line 4 Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\inetpub\wwwroot\10.php on line 4 Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/235224-writing-to-files-under-windows/ Share on other sites More sharing options...
wildteen88 Posted April 30, 2011 Share Posted April 30, 2011 IIS is preventing PHP from writing files to C:\inetpub\wwwroot\. I think you need to configure IIS to allow PHP to write files to www directory. To fix this error It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in C:\inetpub\wwwroot\10.php on line 3 Set date.timezone to Europe/Paris or whatever your timezone is within the php.ini date.timezone = Europe/Paris IIS may need to be restated in order for the changes to take affect. Quote Link to comment https://forums.phpfreaks.com/topic/235224-writing-to-files-under-windows/#findComment-1208806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.