[PLUG] Resolved: Working with suPHP on Apache 2

Richard C. Steffens rsteff at comcast.net
Fri Nov 4 18:17:36 UTC 2011


On 11/04/2011 06:50 AM, David Bridges wrote:
> Sorry, I don't have a link for you but a few simple tips might help you.
>
> When using suphp ownership of files is very import.  I'm not sure what
> kind of defaults Ubuntu ships with but looking in /etc/suphp/suphp.conf
> will more than likely help you understand things a bit better.

Indeed. Details below.

> A couple of points:
>
> The docroot directive specifies which directories should use suphp.
> This is very handy if you want to use suphp for some directories but not
> for others.  Some web applications install stuff in say /usr/share and
> that stuff usually does not work well under suphp unless you change
> ownership of all files.

One recommendation Googling showed me was to change the location of 
DocumentRoot to a directory in my home directory. I created a directory 
www in my /home/rsteff and changed the entry in 
/etc/apache2/sites-available from

DocumentRoot /var/www

to

DocumentRoot /home/rsteff/www

After restarting Apache it now looks at the new directory.

> There are also directives named min_uid and min_gid, these restrict who
> can run php scripts under the docroot directory.
>
> More than likely since you are getting 500 errors this is due to the
> user/group of the web pages being lower that what is allowed.
>
> Checking /var/log/suphp/suphp.log might prove to be a valuable resource.

That error went away but a new one came up. I added an href to a php 
file that simply calls phpinfo. When I click on that link I get this 
error message:

[Fri Nov 04 10:51:15 2011] [warn] Script "/home/rsteff/www/phpinfo.php" 
resolving to "/home/rsteff/www/phpinfo.php" not within configured docroot


I changed the entry in /etc/suphp/suphp.conf from

;Path all scripts have to be in
docroot=/var/www:${HOME}/public_html

to

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

Now the href runs phpinfo as expected.

> Hope this helps

Very much. Thanks.

I am curious about the form of the docroot line I changed in suphp.conf.
What is the significance of ":${HOME}" in that line?

-- 
Regards,

Dick Steffens





More information about the PLUG mailing list