Page 1 of 1

Ways to create files on Apache Server from a php file

Posted: Mon Jan 17, 2011 2:29 am
by hsuoahpainng
Hi everybody,

I'm a pretty new guy/woman at Php. I need to create a XML file to store data on the server. The server is a hosting Apache Linux server.

However, I guess because of the security issues, the php file cannot save the created XML file on the server. I used "$xml = new DOMDocument()" method, then create elements, append to the file, and use "$xml->save("test.xml")" to try to save the xml file generated. It works perfectly fine on my local machine (WAMP), yet, failed to work on the remote hosting server.

How to overwrite security issues and able to save the xml file on the server from the Php program running on the server? Please shed some lights if you can... This seems to be the bottleneck of my current project

Thanks a lot for any suggestions

Maggie

Re: Ways to create files on Apache Server from a php file

Posted: Mon Jan 17, 2011 9:47 am
by pickle
It's likely a permissions issue - the Apache user doesn't have write permissions to the directory in which you're trying to create the directory.

Re: Ways to create files on Apache Server from a php file

Posted: Tue Jan 18, 2011 1:52 am
by Peter Kelly
Generally you need to login with either your FTP or File Manager and check the permissions of the location in which you want the file saved/created. To save/create you need to set them to 777 *If anyone else knows the specific ones for specifically file write please comment this was just off the top of my head*. You should be cautious though as open folders like this can be used maliciously so I would make sure you lock down the permissions as much as possible.