1

OS: Ubuntu 10.04 etc/suphp/suphp.conf:

        [global]
    ;Path to logfile
    logfile=/var/log/suphp/suphp.log

    ;Loglevel
    loglevel=info

    ;User Apache is running as
    webserver_user=www-data

    ;Path all scripts have to be in
    docroot=/home

    ;Path to chroot() to before executing script
    ;chroot=/mychroot

    ; Security options
    allow_file_group_writeable=false
    allow_file_others_writeable=false
    allow_directory_group_writeable=false
    allow_directory_others_writeable=false

    ;Check wheter script is within DOCUMENT_ROOT
    check_vhost_docroot=true

    ;Send minor error messages to browser
    errors_to_browser=false

    ;PATH environment variable
    env_path=/bin:/usr/bin

    ;Umask to set, specify in octal notation
    umask=0077

; Minimum UID
min_uid=100


; Minimum GID
min_gid=100


[handlers]
;Handler for php-scripts
application/x-httpd-suphp="php:/usr/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

some vhost in sites-enabled:

NameVirtualHost *:8080

<VirtualHost *:8080>
ServerAdmin ...
ServerName ...
ServerAlias ...
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
suPHP_Engine on
suPHP_UserGroup user  user
suPHP_ConfigPath "/home/user/etc"
suPHP_PHPPath /usr/bin
DocumentRoot /home/user/web/site.com/
ErrorLog /var/log/apache2/site.com-error_log
CustomLog /var/log/apache2/site.com-access_log common
<Directory /home/user/web/site.com/>
Order Deny,Allow
Allow from all
Options +Indexes
</Directory>
</VirtualHost>

But when I did nano /home/user/web/id.php and paste

<?php
system('id');
?>

in it, result I get is:

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Have no idea what to do so I was hoping comunity could help

ty.

amarc
  • 163
  • 3
  • 8
  • What is the owner and group of the id.php file and what did you expect to happen ? – user9517 Dec 12 '10 at 20:04
  • It looks something like this: -rw-r--r-- 1 haruns haruns 23 2010-12-12 19:25 id.php So I was expecting to have user running php files not www-data which is apache – amarc Dec 12 '10 at 20:18

1 Answers1

1

The only thing that leaps out at me is that the documentation says the suPHP_UserGroup user user statement is only valid inside <Directory> ... </Directory>.

EDIT - I set this up and it's working - this is what I did

I created /etc/apache2/mods-available/suphp.conf containing

<IfModule mod_suphp.c>
AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-suphp
</IfModule>

and /etc/apache2/mods-available/suphp.load containing

LoadModule suphp_module /usr/lib/apache2/modules/mod_suphp.so

I ran

sudo a2enmod suphp
sudo a2dismod php5

to enable suphp and disable php

my vhost in sites-enabled

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        suPHP_Engine on
        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
                suPHP_UserGroup user user
        </Directory>
        .
        . other stuff
        .
</VirtualHost>

/var/www is owned by user:user My /etc/suphp/suphp.conf is functoinally the same as your's. OS is Ubuntu 10.04

user9517
  • 114,104
  • 20
  • 206
  • 289