I'm creating an internet site which, amongst other things, databases pictures. For simplicity allows state that every picture may have a description along with a file path, which is saved inside a table, like so

  description VARCHAR(150),
  file VARCHAR(150) NOT NULL,

Instead of storing each one of these pictures in one location and setting arbitrary file pathways, I would like the consumer to have the ability to upload the images via ftp to some unix account and make their very own directory hierarchy. By doing this they are able to use ftp/sftp/scp copying them, or ssh and, use other Linux programs, like imagemagik or zip. In order to change permissions for pictures (see below)

Now I recognize this makes problems when the user decides to remove pictures or move them, however i suppose you will find ways for this (database doesn't guarantee pictures is going to be there, write safeguard pictures, re-implement mv/rm...)

I have little databasing experience. I needed to understand if this sounds like advisable. Particularly, be it good to make use of Linux file permisions as database permissions. So for instance, user Manderly could create group MJ12 and add customers WSimons, BPage, and ANavarre into it, then online individuals customers would get access to these pictures (not instantly I understand, but scripted via PHP) Plus they could sftp/ftp/scp them also.

After you have solutions with other questions in the community, I'm able to now answer my very own question.

It's clearly easy to implement this in PHP by utilizing /etc/passwd, getting file permissions via int fileperms ( string $filename ), and only upgrading the database with individuals, or with them like a check before permitting use of files. Nevertheless this is overkill. It's simpler to merely use suPHP.

suPHP is really a tool for performing PHP scripts using the permissions of their proprietors. It includes an Apache module (mod_suphp) along with a setuid root binary (suphp) that's known as through the Apache module to alter the uid from the process performing the PHP interpreter.

Whether it's advisable, general consensus at SO appears to become that certain should only implement this type of server whether it serves an objective. This is often come to be mean "it's generally not advisable"