Using php for admin tasks

Discussion in 'PHP' started by foobaa, Mar 4, 2007.

  1. #1
    Hi,

    I've decided to try to make my life easier by automating tasks with php scripts and an html interface. I want to do things like:

    - automate setting up of directory structures for new projects,
    - import into svn, then checkout,
    - and the like

    and I've got stuck on the first line of code: mkdir()! - Permission denied.

    I realise now that I need to run php scripts as a different user, but without complicating things by having to (re)compile things or anything like that!

    Any ideas? cheers!
     
    foobaa, Mar 4, 2007 IP
  2. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #2
    Are you on linux? Sounds like you don't have the appropriate permissions to create a directory. Maybe you can run them under sudo permissions? Just a thought :)

    http://www.gratisoft.us/sudo/man/sudo.html

    I think that should do the trick. It lets you run files as another user which sounds exactly what you are asking for :)
     
    Louis11, Mar 4, 2007 IP
  3. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #3
    You need a permission (775) for parent directory (directory above the newly created directory) to create subdirs in it.
     
    wmtips, Mar 4, 2007 IP
  4. foobaa

    foobaa Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the responses - just thinking though, is sudo a good idea? I was planning on running as a particular user, the one which is limited to the directories & docs I'm interested in etc.

    Thanks for the tips, I'll try to see what I can manage with sudo although I haven't used the command line much in recent months so easily forget pretty much everthing lol so might have to ask for examples!

    Yes it's linux - ubuntu - cheers :)
     
    foobaa, Mar 6, 2007 IP