need help about accessing sevices of LINUX by PHP

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
tapas_bahirbag
Forum Newbie
Posts: 14
Joined: Sun Aug 06, 2006 6:54 am
Contact:

need help about accessing sevices of LINUX by PHP

Post by tapas_bahirbag »

i have faced a problem. the problem is following:
i can execute 'ls' by PHP in LINUX. But i can't access any service function since i am root useer by PHP. Can i access service functions of LINUX by PHP??? if i can, then how???
- tapas_bahirbag
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: need help about accessing sevices of LINUX by PHP

Post by Chris Corbyn »

tapas_bahirbag wrote:i have faced a problem. the problem is following:
i can execute 'ls' by PHP in LINUX. But i can't access any service function since i am root useer by PHP. Can i access service functions of LINUX by PHP??? if i can, then how???
- tapas_bahirbag
If this is your own server then you can set PHP to run as the root user. If it's not your own server then we should not be helping you with this anyway :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why was this in Suggestions?
tapas_bahirbag
Forum Newbie
Posts: 14
Joined: Sun Aug 06, 2006 6:54 am
Contact:

Re: need help about accessing sevices of LINUX by PHP

Post by tapas_bahirbag »

d11wtq wrote:
tapas_bahirbag wrote:i have faced a problem. the problem is following:
i can execute 'ls' by PHP in LINUX. But i can't access any service function since i am root useer by PHP. Can i access service functions of LINUX by PHP??? if i can, then how???
- tapas_bahirbag
If this is your own server then you can set PHP to run as the root user. If it's not your own server then we should not be helping you with this anyway :)
yes. this is my server.
tapas_bahirbag
Forum Newbie
Posts: 14
Joined: Sun Aug 06, 2006 6:54 am
Contact:

Post by tapas_bahirbag »

feyd wrote:Why was this in Suggestions?
sorry. i am a new user of this forum. after posting my problem i found that this is not correct place to post any problem.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Imho, executing PHP scripts as root is dangerous and usually plain overkill... Just make sure that the user that will execute the script has sufficient rights... (But not any more rights...)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You can use PHP CGI with the apache suexec module to force PHP to run as root on a per-directory basis. Like timvw says it's a big risk though...
Post Reply