操作系统: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"
已启用站点的一些虚拟主机:
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>
但是当我执行 nano /home/user/web/id.php 并粘贴时
<?php
system('id');
?>
其中,我得到的结果是:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
不知道该怎么办,所以我希望社区能够提供帮助
太。
答案1
唯一让我印象深刻的是文档表示该suPHP_UserGroup user user
声明仅在内部有效<Directory> ... </Directory>
。
编辑-我已设置好并且它正在工作-这就是我所做的
我创建了/etc/apache2/mods-available/suphp.conf
包含
<IfModule mod_suphp.c>
AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-suphp
</IfModule>
并/etc/apache2/mods-available/suphp.load
包含
LoadModule suphp_module /usr/lib/apache2/modules/mod_suphp.so
我跑了
sudo a2enmod suphp
sudo a2dismod php5
启用suphp
和禁用php
我的虚拟主机已启用站点
<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
归user:user
My所有/etc/suphp/suphp.conf
,功能上与你的相同。操作系统是 Ubuntu 10.04