PDA

View Full Version : Permissions question


biobrew
11th July 2008, 02:47
I have a client who has a website on my debian etch with ispconfig server, this client has shell access and admin access.

He has a script that makes some shell calls, all of shell calls work except for one that reads a .doc file and converts into .txt file using the linux command line tool antiword

I installed antiword for him in /var/www/web1/web/bin/antiword and gave that directory and antiword www-data ownership and write and execute permissions

the files are read and written to in /var/www/web1/web/uploads

when I do:

su www-data

and run antiword from the command line it will read the .doc file and convert it into a text file just fine, e.g.

/path/to/antiword /path/to/docfile > /path/to/txtfile

And that works just fine

But using from php:

system("/path/to/antiword /path/to/docfile /path/to/txtfile");

Will in fact output a text file, but it will be 0 bytes in length.

Does that make any sense at all?

biobrew
11th July 2008, 03:04
Another thing that I just realized that is a little weird, i'm trying to run pdftohtml from php and I get a strange error message.

but when I su www-data and run it, it works just fine. I'm not really sure how to make it so my client can run programs from the command line that read and write files to his directories.

biobrew
11th July 2008, 04:27
1 more thing, this used to work before I moved the site to ispconfig, so I'm pretty sure it's a permissions problem and not a problem with the script.

till
11th July 2008, 08:31
Do you use suphp or do you have php safemode enabled?

biobrew
11th July 2008, 13:18
Do you use suphp or do you have php safemode enabled?

nope && nope

Should I?

falko
12th July 2008, 12:45
Shouldn't it read
system("/path/to/antiword /path/to/docfile > /path/to/txtfile");?

biobrew
12th July 2008, 13:05
It does, sorry for my typo. I should say that the code all worked perfectly before moving to ispconfig.

I kind of figure it out though. I moved antiword and the other linux command line tools needed to be called from php into a directory off of the webroot for that user, and chowned those 3rd party programs as www-data and gave www-data chmod u+x permissions and now it seems to work. It's still a little wonky but I can work around it now.