tags:

views:

113

answers:

4

For a simple web application, I'd like to be able to take advantage of several UNIX features that are stable, have a long history, and are well proven in production, rather than having to write my own code. Take users, for example. Rather than having an entire user, group, permission infrastructure in my webapp, I'd like to be able to simply piggyback on top of the equivalent features of UNIX.

Is there a PHP library that will allow me to register users, log them in, manage permissions, etc. ?

+1  A: 

If php or your webserver is running with root rights it should be no problem to use this functions.

For security reasons I would strongly recommend to reimplement these things or using any existing php library instead!!

Hippo
+2  A: 

It's really not a good idea to fumble around with the user and permission settings of the actual system that is hosting your site. If you want to protect individual directories of your site, you're better off using .htaccess files. If OTOH you're working with virtual URLs, you'll have a hard time mapping the UNIX directory permissions to them anyway.

deceze
I'm thinking more of a basic CMS that just manages files on the web server, and allows appropriate users/groups to edit content they're entitled to. Would be great to not have to write that entire infrastructure when there's already one there.
Bobby Jack
+1  A: 

It seems there are standard functions for interfacing with Kerberos or Radius in php. These both have a long history and are well proven in production, while being separate from the system users.

bjarkef
Don't forget LDAP.
Sean McSomething
+1  A: 

Based on your comment to deceze's answer, are you looking for something like PHP's filesystem functions?

Then, there is system and its related functions, which gives access to Unix commands, but I'd recommend other ways of doing things if possible.

Edit: In response to the comments about needing user and group functionality:

  • Firstly, in case your plan is to let web users have access to the whole file system (or even just their regular log in directories), I just want to advise against that - lots of security concerns (eg. if someone else gets into a user's account, they could delete everything to which they have access).
  • The little experience I have with handling users in PHP was in some beginner level training. In that class, we had our users in an SQL database and used sessions. We didn't use SSL, but I'd advise some sort of crypto when passing passwords around.
  • If you're using Apache, it can handle the authentication for you. Other server software can probably do the same, but Apache is all I've ever worked with. I can't address whether Apache can handle sessions itself and don't have the time to research it right now.
PTBNL
Filesystem functions would certainly be involved, but the user and group accounts are important requirements too. I realise that there are potential issues, but I just wonder if (and hope that) someone's solved them already.
Bobby Jack