jays_rhino Posted July 9, 2007 Share Posted July 9, 2007 Hello, I am having trouble with a ridiculously easy script, and I am hoping you can help. Here is the code I am having trouble with. if(!file_exists("Batch/TheReport.txt")) { $Error = 1; $ErrorReason = "There is no file<br>"; } if(!$file = fopen("Batch/TheReport.txt", "w")) { $Error = 1; $ErrorReason .= "Can't Open The File<br>"; } When I ran this on my local windows server it worked just fine, but when I uploaded it to our linux server, it passes the first test of recognizing the file is there, but it can't open it. I have made sure that the permissions are set properly so that I am able to write to the file but still no luck. Do any of you know what I might need to look at that would cause this to work diferrently from a windows server to a linux server? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
LiamProductions Posted July 9, 2007 Share Posted July 9, 2007 Linux has better security. So there might be a permission stopping you Quote Link to comment Share on other sites More sharing options...
calabiyau Posted July 9, 2007 Share Posted July 9, 2007 did you make the permissions so that you can write to the file, or so that php can write to the file? there is a difference I believe. Try setting the permissions to 777 for now and see if it works. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 www.php.net/chmod The file and the directory need to be able to be written to. 777, you should be able to do it manually with an FTP program. Quote Link to comment Share on other sites More sharing options...
jays_rhino Posted July 9, 2007 Author Share Posted July 9, 2007 ok, I had set the permissions on the directory, but just assumed those permissions carried on down to what was in there. I changed the permission on the file itself and works fine now. Thanks again for the help on such a simple thing. Quote Link to comment 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.