Firefox PHP

Module: Store Files on Disk

Posted by Maurice Makaay 
Re: Module: Store Files on Disk
July 20, 2009 04:25PM
Quote
Maurice Makaay
Well, you need file moving and directory deleting permissions, so when you are root, it is likely to work.

I expect that for most hosting environments, "root" would not be strictly necessary. Errors like the unlink() error above are likely because the web server wrote all those files under it's user id (nobody, apache, or something like that), and now you're trying to manipulate them as your normal user id (via telnet/ssh).

When I have to do stuff like this, I try to reclaim the entire images directory first, EX:
cd /path/above/images/
cp -Rp images images.new
mv images ~/trash
mv images.new images

If that works, you'd have an images directory which is entirely owned by you - then, run your conversion scripts and make sure to set the perms on the whole structure to be writable by the web server.

That's how I would do it - each hosting environment will be different, of course.

Sp

------------------------
Sean Phelan
Sites By Sequoia - Web Marketing ... The Experts at Building Your Success Online
Re: Module: Store Files on Disk
July 20, 2009 05:16PM
If you have no root access, then this would be one way to go. Another way would be to write some code to be able to handle this from the settings screen in the admin interface. But this being considered an expert module, I expect the user to be able to manage the files that the webserver produces, so I only implemented the command line script for conversions.

The root way of managing the conversion would be something like:

$ su -
# cd /path/to/phorum/mods/store_files_on_disk
# php ./console_convert.php
# cd /path/to/filestoragedir
# chown -hR webuser:webgroup .
# chmod -R 700 .
# find . -type f -exec chmod 600 {} \;
# exit
$

The problem with doing things not as root, could be that you are not allowed to make files owned by the web server group, forcing you to do 777 on dirs and 666 on files. There's a reason that "666" has an evil taste to it ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Store Files on Disk
July 20, 2009 06:14PM
Quote
Maurice Makaay
But this being considered an expert module, I expect the user to be able to manage the files that the webserver produces

I agree whole-heartedly on this ... even the smartest programmer would have trouble making an automatic tool that could handle this perfectly for everyone.

Sp

------------------------
Sean Phelan
Sites By Sequoia - Web Marketing ... The Experts at Building Your Success Online
Re: Module: Store Files on Disk
July 20, 2009 07:40PM
Ok I will have to chown them back to nobody nobody when covert script is finish because it covert them all to root owners but it still accessable by the web server and I feel safer to have it back under nobody nobody.

So far no problem on the medium traffic phorum site and I haven't yet covert my biggest phorum site because it still backing up the storage folder ha! It'll be another day or two before it finish 8-P

Thanks for updating this Module and I can't wait to see how backup handle the new path this time.

Bill
Re: Module: Store Files on Disk
July 20, 2009 08:38PM
It not more or less secure to not have those files owned by the root user. It's not like these are programs that can be run as root or so. The only issue is that the webserver should be able to write to the directories and files. And that can be accomplished by either fully opening up all permissions (chmod 777, insecure) or by setting the owner and group of the file with restricted permissions (700 or 770, more secure).

I'm also very curious if this new file path will fix the issues. If it doesn't, I'm not sure what to do next, so I really hope it works ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Store Files on Disk
July 21, 2009 02:44PM
We converted our big phorum site .. one with over 10 gig of file attachments ...

So far it looking good and seem to be working as intended.

We enabled the backup to run tonight on Findmall and I will let you know how it went.

But we checked and it only took 20 seconds to dir list and about 2 minutes to du so it a big improvement over the old path for sure.

Thanks for improving on it!
Bill
Re: Module: Store Files on Disk
July 21, 2009 04:19PM
Quote
CBiLL
We converted our big phorum site .. one with over 10 gig of file attachments ...

So far it looking good and seem to be working as intended.

We enabled the backup to run tonight on Findmall and I will let you know how it went.

But we checked and it only took 20 seconds to dir list and about 2 minutes to du so it a big improvement over the old path for sure.

Thanks for improving on it!
Bill

At least Purge Stale Files is actually working now and quick too! Over 700 stales files found and deleted heh ...

It wouldn't work before and always times out ...


Bill
Re: Module: Store Files on Disk
July 21, 2009 05:23PM
That sounds really good :-)
I'm glad it helped that much to cut down the file tree.
Let me know if / how well the backup is performing after this change.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Store Files on Disk
July 23, 2009 12:20PM
Quote
Maurice Makaay
That sounds really good :-)
I'm glad it helped that much to cut down the file tree.
Let me know if / how well the backup is performing after this change.

The backup went great so the new file path was a big performance improvement for the backup system.

Thank you
Bill
Re: Module: Store Files on Disk
July 25, 2009 02:04PM
Thanks for letting me know!
And a bit *WOOT!* for the new path structure.

Since 5.2.12 is out now and since you seem to be able to run it ("It runs at Bill's, ship it!"), I removed the old version of the module and offer only the new version from this thread from now on.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 07/25/2009 02:05PM by Maurice Makaay.
Sorry, only registered users may post in this forum.

Click here to login