php running as "nobody" giving me problems

fuzzymonkey

Well-Known Member
Jun 11, 2004
61
0
156
There are 2 problems that I'm experiencing that I think are derived from the fact that php scripts run as the user "nobody" on my server.

1. Mail sent from php scripts does not count toward the user's bandwidth usage or show up in the mail statistics.
2. Files uploaded from php scripts are owned by "nobody," so they aren't counted in the user's quota. Today I found a user with 4 Gigs on his 100 meg account because of this.

Right now I have the php mail function disabled to get around #2. How can I configure php such that users can still send email without getting around their bandwidth limitations and also so that I can keep an eye out for possible spammers? I'd love to get php scripts to run as the system user in question. It seems this would solve all my problems.
 
Last edited:

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,221
4
193
Minneapolis, MN
fuzzymonkey said:
I'd love to get php scripts to run as the system user in question. It seems this would solve all my problems.
You need to recompile Apache with Phpsuexec.
 

electric

Well-Known Member
Nov 5, 2001
780
8
318
AndyReed said:
You need to recompile Apache with Phpsuexec.
... and then welcome to the world of a whole set of new/different problems. ;)
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,466
30
473
Go on, have a guess
Indeed, but it does get rid of the worst of the poor php implementation in apache and makes things more secure and, importantly, traceable.
 

fuzzymonkey

Well-Known Member
Jun 11, 2004
61
0
156
Sounds fantastic! What problems does this bring about though?

Also, I'm reading something about a patch to suexec that is needed to support php? what is this and where do I get it? Is there a how-to somewhere?
 
Last edited:

verdon

Well-Known Member
Nov 1, 2003
923
11
168
Northern Ontario, Canada
cPanel Access Level
Root Administrator
fuzzymonkey said:
Sounds fantastic! What problems does this bring about though?

Also, I'm reading something about a patch to suexec that is needed to support php? what is this and where do I get it? Is there a how-to somewhere?
AFAIK, just the ownership and perms of user's scripts gets a bit more important, and any images/files uploaded via php script while running as nobody, will have to be chowned to the actual user now, so that they can be deleted/edited by scripts now running as user and not nobody...

I'd love to hear from someone with more knowledge than me on this though, as it's a move I've been a little afraid to take, until I have the free time to sort out any problems switching to Phpsuexec might rasie.
 

beetleman

Registered
Nov 13, 2005
1
0
151
Funny, cause the files aren't owned by nobody, they are owned by the the system.

The system is considered somebody in this instance and the system can manipulate the files and directories that it owns.

Just thought I'd throw my 2 cents in.

beetleman
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,466
30
473
Go on, have a guess
I'm not sure I understand your post.nobody is a real unix user and the one under which apache runs. In unix context there's no such thing as "being owned by the system", files are owned by unix accounts that appear (usually) in /etc/passwd, one of which is the account and group called nobody.
 

SubZero

Well-Known Member
Apr 21, 2005
100
0
166
Balmumcu, Istanbul, TR
Hi,

I need to use one site with mod_php and the rest (others) with phpsuexec. How do I make this configuration to work? Any details?

I have one site that spikes the hosts load to 40~50's with PHPSuExec but the rest of them are just simple stuff. Any deas?
 

neo4242002

Well-Known Member
Jun 28, 2005
119
0
166
If I enable PHPSuExec in my server will I require to change all my php files by adding #!/usr/local/bin/php or something similar.. just cant remember who told me that :confused:
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,466
30
473
Go on, have a guess
SubZero said:
I need to use one site with mod_php and the rest (others) with phpsuexec. How do I make this configuration to work? Any details?
AFAIK, you cannot do that, it's either one or the other, though I could well be wrong.

If I enable PHPSuExec in my server will I require to change all my php files by adding #!/usr/local/bin/php or something similar
No.
 

neo4242002

Well-Known Member
Jun 28, 2005
119
0
166
php as CGI

What about “php as CGI” is it a different story? How do find whether my php build as a CGI or Apache module
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,221
4
193
Minneapolis, MN
neo4242002 said:
as per that I need to use #!/usr/bin/php with PHP CGI. Hummm …Phpsuexec as you explain.

But according to you I do not need to use #!/usr/bin/php with my php file when Phpsuexec enable
When Phpsuexec enabled, you don't need to modify your Php scripts, not even using #!/usr/bin/php syntax. You also need to know that you can't change the permission on any of your scripts and/or directories to 777.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,466
30
473
Go on, have a guess
Indeed. That page is talking about php shell scripts, which is when you should put the shebang line in to the interpreter.