[ permission for my php to create a dynamic file on the server ]
For a project I need my php file to create a dynamic file (on remote server which I bought) which loads into a flash component. Everything is working fine on my localhost. But once I upload it to the server, it throws the following errors:
Warning: fopen(output.html) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\vhosts\x.co.in\httpdocs\blabla.php on line 25 Warning: DOMDocument::save(k_id.xml) [domdocument.save]: failed to open stream: Permission denied in C:\Inetpub\vhosts\x.co.in\httpdocs\blabla.php on line 136
where on those lines fopen is written.
I understood as there is no permission to my php file to create any dynamic files on the server. So i just wanna understand is there a way by which I can privilege my php to create that file on the server.
I've the login access, which I think I've to put somewhere in code before it tries to create such file...but i dont know how to figure this...any suggestions?
The user that runs the PHP process needs to have permissions to write new files in the target folder. On linux servers this is done using CHMOD.
chmod 777 -R /path/to/folder
777 is the permission (full permission for testing only), -R means recursive for the files/folders inside. As you are using windows just right click on the folder and look at properties and search for permissions.
Create a new directory where the PHP will write the files. For that directory set permissions to
705 (that is owner has Read, Write, Execute permission)
You can either do that using a FTP client (Filezilla) or via a Bash shell
mkdir inputfiles chmod 705 inputfiles