I've been tinkering with Apache2 in Ubuntu and am trying to get a script of mine to be able to create files. It doesn't seem to be working, sadly. I think the issue is that whichever user is running doesn't have the right permission to create files. I've been going round in circles with this, though - I thought I had set the permissions for the /var/www (it's testing only so I'm not worried about security) to 777. Still no luck.

Is there anything I'm missing?

I've tried: adding my main user to the www-data user group; setting www-data as owning the /var/www folder, and lots of other attempts besides.

What have I missed?

link|improve this question
feedback

1 Answer

Have you tried to make a folder inside /var/www/ putting your script in that and running it from there. Making sure to do sudo chmod -R 777 /var/www/test before hand?

Seems strange it won't do it even with the permissions set to 777. Is it a PHP script you are playing with?

Maybe try the following:

$ cd /var/www
$ php -a
php> file_put_contents('test','test');
php> exit
$ cat test

And see if it outputs the file. If that works, paste <?php file_put_contents('test','test'); ?> into a file and run it, see if it does the same thing.

If it outputs the file too, then it must be a problem with your script.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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