firestarapple Posted November 13, 2008 Share Posted November 13, 2008 I have this problem. i use mkdir() to create a folder. after that, i use touch() to create a file but the file somehow cant be created. Why is it like this? The folder has chmod 777, why cant i use touch to create a file in this folder? how can i solve this problem in order to create the file? Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/ Share on other sites More sharing options...
.josh Posted November 13, 2008 Share Posted November 13, 2008 Post some code, post some error messages. Also, what is your goal for creating this file? touch will attempt to create a file if it doesn't exist but that's not really it's primary purpose. If you're trying to create a file and save stuff to it, use fopen, fwrite, fclose Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/#findComment-689293 Share on other sites More sharing options...
firestarapple Posted November 17, 2008 Author Share Posted November 17, 2008 touch(ROOTDIR.'/'.$section.'/advertisers/'.$tmpF."/apple.xml") or die("Cant create".ROOTDIR.'/'.$section.'/advertisers/'.$tmpF."/apple.xml"); Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/#findComment-691766 Share on other sites More sharing options...
corbin Posted November 17, 2008 Share Posted November 17, 2008 Put error_reporting(E_ALL) and ini_set('display_errors', '1') above that line and see if there are any more errors. Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/#findComment-691803 Share on other sites More sharing options...
firestarapple Posted November 18, 2008 Author Share Posted November 18, 2008 now i realize the problem is the group permission and not the problem of creating file. i try to create file into other folders and file created successfully.and i check that the group of the file are different. for example, i cant create file in folder 1 but i can create file in folder 2.both are different group file permission. how can i change the group permission?i have try use chown but fail. any other method using php to change the group permission? Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/#findComment-692517 Share on other sites More sharing options...
.josh Posted November 18, 2008 Share Posted November 18, 2008 chmod Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/#findComment-692815 Share on other sites More sharing options...
firestarapple Posted November 19, 2008 Author Share Posted November 19, 2008 i manage to change the group permission, but it seems that it doesn't allow to create files in that new folder that i have created using mkdir. but if i login to ftp and manually create folder, new file can be created in this folder(the one i created manually when i login ftp). why is it like this? both folders contain same group permission and same chmod but why it allows to create file in that folder that i manually create when i login into FTP but not in that folder that i created using script (mkdir)? how to solve? Quote Link to comment https://forums.phpfreaks.com/topic/132555-cant-create-file/#findComment-693160 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.