PHP as CGI with Apache SUEXEC

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Sun May 04, 2003 4:33 am

Has anyone ever configured PHP as CGI and used SUEXEC to make PHP act like a different user? (not the apache-user by default). This is a great issue if you have linux-based systems and running quotas per linux-user and also it is the right way for the user to upload/create files and not be owned by the apache-user (eg user: nobody).
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Tue May 06, 2003 6:10 am

see manual about Apache..... you may create in each folder file like .access where you may set two user one adm second nobody..... but i'm not recommend use this name use for exaqmple nouser and each may have a personal password
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Tue May 06, 2003 6:34 am

I have read the manual over 20 times. I have installed PHP as CGI and works fine... also have successfully made alla php works without the #!/usr/local/bin/php comment. On the other side su-exec work fine on apache but... PHP cannot work with a different user even if is configured as CGI :(
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Thu May 08, 2003 3:44 am

What it say?
try what:
#!/usr/local/bin/php -q (it's like force)
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Fri May 09, 2003 2:35 am

No no... this works fine. If you are logged in as "someone" on SSH and run a php script this will be a proccess of "someone". When you try the same thing from web (through apache) the same php script will be a proccess of "apache" and not "someone".

Imagine that you have a file-manager and you upload eg. 5 files . All these files are owned by "apache" (usually nobody if you have installed apache 1.3.2x). To modify these files you either use the file-manager (user: nobody) or you chmod them with 777 so the "someone" user can modify them too!

Result: you have half files owned by you and half files owned by apache... :P To solve this you must compile php as CGI and use Suexec of apache to change the user of every virtualserver you have in your httpd.conf.

...looking for the answer over 1 year now... nothing yet :(
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Fri May 16, 2003 2:34 am

as i understand you want what any user may upload, for example, or something else do under rights other peaple?
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Sat May 17, 2003 5:56 am

I want to make PHP works like PERL on apache. If the user upload something (file.txt) through eg. copy() function the owner of that file will be "apache". But I need the owner to be "user"...
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Fri May 23, 2003 6:08 pm

PHP finally worked with CGI Gateway and user-executed by SUEXEC!! ... after 8 months with lots of recompiles...
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Mon May 26, 2003 3:13 am

mike wrote:PHP finally worked with CGI Gateway and user-executed by SUEXEC!! ... after 8 months with lots of recompiles...

you may create unix batch file and convert permission of uploaded file
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Thu May 29, 2003 2:08 pm

Yeap... but this is not what I was looking for. Thanks :)
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest