Help - Search - Members - Calendar
Full Version: Why Simple Script Isn't Working?
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Axle12693
Unless this is a server issue, this should be working just fine; I examined it several times:

<?php
if (file_exists("x/y") == false) {
mkdir("x/y", 0777);
}
file_put_contents("x/y/z.txt", "Hello world!");
?>

This is just a test script of course. The folder is created just fine, no problems there. However, when I try to create a new file inside it, it doesn't work.
This problem doesn't happen if the folder is created in the file manager. If you need the error messages to help me:


Warning: file_put_contents() [function.file-put-contents]: SAFE MODE Restriction in effect. The script whose uid is 75463 is not allowed to access /www/uuuq.com/a/b/e/abentley/htdocs/x/y owned by uid 2001 in /www/uuuq.com/a/b/e/abentley/htdocs/x.php on line 5

Warning: file_put_contents(x/y/z.txt) [function.file-put-contents]: failed to open stream: No such file or directory in /www/uuuq.com/a/b/e/abentley/htdocs/x.php on line 5

Thanks in advance


EDIT***
Just an afterthought, should I not have used file_exists() to detect the existence of a directory?
Ed
Afraid this is safe mode at play, not much you can do apart from with the file manager edit the permissions on the y directory, this should set the user back to your user's.
Axle12693
So, are you saying that there is no way to make such a thing fully automated on this server? Also, is it just the server?
Ed
QUOTE(Axle12693 @ Jul 24 2009, 01:13 AM) *
So, are you saying that there is no way to make such a thing fully automated on this server? Also, is it just the server?


At the moment, no, yeah it's just php's safe mode, something at some point we'd like to do away with.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.