Loans - Credit Cards - Cheap Magazines - Nationwide Building Society - Electricity Suppliers

PDA

View Full Version : Using php for admin tasks


foobaa
Mar 4th 2007, 1:10 pm
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!

Louis11
Mar 4th 2007, 1:59 pm
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 :)

wmtips
Mar 4th 2007, 2:26 pm
You need a permission (775) for parent directory (directory above the newly created directory) to create subdirs in it.

foobaa
Mar 6th 2007, 7:20 am
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 :)