Board index   FAQ   Search  
Register  Login
Board index PHP PHP Installation

PHP as CGI with Apache SUEXEC

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

PHP as CGI with Apache SUEXEC

Postby mike » 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).
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Re: PHP as CGI with Apache SUEXEC

Postby WiZARD » 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
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby mike » 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 :(
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Postby WiZARD » Thu May 08, 2003 3:44 am

What it say?
try what:
#!/usr/local/bin/php -q (it's like force)
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby mike » 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 :(
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Postby WiZARD » 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?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby mike » 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"...
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Postby mike » 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...
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Postby WiZARD » 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
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby mike » Thu May 29, 2003 2:08 pm

Yeap... but this is not what I was looking for. Thanks :)
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens


Return to PHP Installation

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron