Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a local test server, and I am attempting to write a file with PHP. I am getting a message that the folder (../uploads/) does not exist or I do not have permission.

My directory structure is

D:\xampp\htdocs\website\ //<--root
D:\xampp\htdocs\website\library //<--where script runs
D:\xampp\htdocs\website\uploads //<--where I'd like to save

I know on a *nix server, I can just chmod the permission to 0777. What do I need to set on my windows box to give apache the ability to write a file?

share|improve this question
    
pls post some of your code for us to review it. I think the issue must be with the read/write access. –  Jigar Tank Nov 8 '11 at 6:06
    
Are you sure that's the working directory of the script, or is that just the location of the script? If it's a library that is being included from a script in /htdocs/website/somescript.php, then the working directory would be /htdocs/website/. The working directory can also be changed by the way the script is executed. –  Lèse majesté Dec 8 '11 at 8:15

2 Answers 2

I'm not an expert on this but as long as the directory is not set to be read only, and it usually isn't by default, it should be writable. Are you 100% sure your path is correct? Have you tried the full path instead of a relative path?

share|improve this answer
    
Best way to find out is to output getcwd(). If you use cron to run a php script, or just run it from another directory, then the working directory won't be the script's location. –  Lèse majesté Dec 8 '11 at 8:27

Personally i don't use XAMPP, but i use WAMP as my test server, it is perfect for my needs since you can enable/disable mods on the run.

If you don't use the Perl install in XAMPP you should maybe check out WAMP at http://www.wampserver.com/en/

Also i read that XAMPP could have problems with file permissions on Windows at http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/installing_on_windows_with_xampp_and_wamp

share|improve this answer
    
That link makes no mention of XAMPP having problems with file permissions on Windows. And I've never had any problems with XAMP not following the file permissions set on the actual filesystem. –  Lèse majesté Dec 8 '11 at 8:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.