siddscool19 Posted October 8, 2008 Share Posted October 8, 2008 I want to know how to create file on server using php.. Sometimes fopen is not able to create so what is the other way? ??? Quote Link to comment https://forums.phpfreaks.com/topic/127572-create-file-on-server-using-php/ Share on other sites More sharing options...
JonnoTheDev Posted October 8, 2008 Share Posted October 8, 2008 fopen() should work if you have the correct permissions set on the directory and specify the correct mode parameter. If using linux you could issue a system command with exec() (if your host allows this) exec("touch myfile.txt") Quote Link to comment https://forums.phpfreaks.com/topic/127572-create-file-on-server-using-php/#findComment-660049 Share on other sites More sharing options...
awpti Posted October 8, 2008 Share Posted October 8, 2008 The only reason fopen() wouldn't be able to create file is if: - The directory you are attempting to write to isn't writable. - The file you are attempting to write to isn't writable and/or has a different owner without the world-writable flag set - fopen() is disabled in php.ini What error are you getting? The error is pretty painfully verbose. Quote Link to comment https://forums.phpfreaks.com/topic/127572-create-file-on-server-using-php/#findComment-660053 Share on other sites More sharing options...
siddscool19 Posted October 8, 2008 Author Share Posted October 8, 2008 Well file doesn't exist i get this error (if i had not uploaded the file) Quote Link to comment https://forums.phpfreaks.com/topic/127572-create-file-on-server-using-php/#findComment-660058 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.