Print this page

suPHP

Since quite some time BlueOnyx supports an alternate method of running PHP scripts. A method called "suPHP". This guide explains how to run sites with suPHP enabled.

Differences between PHP implementations:

Regular PHP:

When you enable "PHP" on a virtual site, this will run scripts through the Apache "mod_php" module. All scripts will be executed as user "apache", which quickly creates problems if your scripts need to create files or folders, or when you try to upload files through PHP scripts.

suPHP:

suPHP follows a different approach: Scripts are executed with the user ID of the owner of the respective script. So if a script is owned by user "joe", then it will run with the UID of user "joe" and has access to all files and folders that are owned by user "joe". This eleminates all the typical read and write access problems that regular PHP causes. Additionally suPHP enabled sites on BlueOnyx use their own php.ini file, which resides in the document root of the respective site.

How to enable suPHP:

This guide explains all the required steps to set a site up to use suPHP.

First make sure that the site in question has at least one siteAdmin present. If you want to upload files by FTP regularely to your webspace, this siteAdmin should also be the user that you use to make your FTP uploads:

Then go to "Services" / "Web" and tick the checkbox for suPHP:

That will set the site up to use suPHP. It will also create the separate php.ini file that resides in the document root of the site in question. That is one level above the /web directory and therefore not accessible through HTTP. This php.ini is also protected with "chattrib", so not even user "root" of the server can edit this file. Modifications to this php.ini should only be made through the GUI.

Please note:

When suPHP is enabled for virtual sites, the feature "user owned webs" is no longer available. This means the separate /web directories of individual site users (usually available through http://www.site.com/~username/) are no longer working or available.

The final step:

There is one more thing to do before suPHP will start to work on this virtual site. Go to "Services" / "Web Ownership" on this virtual site and from the pulldown menu "SiteAdmin that owns /web" select the user you want to be owner of /web. This should be the siteAdmin that you want to use for FTP uploads:

Once you have selected the desired siteAdmin, save the changes. As soon as that is done, the site will start to work using suPHP.

IMPORTANT: A site with suPHP enabled will only work if a siteAdmin owns the /web directory of the site.

This pulldown also allows to change the ownership to "nobody" or to "apache". Which you can use to revert a site back from suPHP to regular PHP.


Previous page: Web Alias Redirects
Next page: fuse-sshfs