Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have DirectAdmin installed on my dedicated host.

What I'm trying to achieve is set up a subdomain on domain "C.com", which belongs to user "C", so that its document root is a directory in another user's (P) directory tree

|*if SUB="mysubdomain"|
|?DOCROOT=/home/P/domains/mysubdomain.somedomainname|
|*endif|

This works as long as I try to view flat HTML files, i.e.

C.com/index.html
// Hello World!

Whenever I try to view a PHP file, I get a 500 error, i.e.

C.com/index.php
// Internal Server Error

The index.php is simple and should not throw any errors, right?

<?php
?>

I can't view the log files for reasons that would take too much space to describe. Also I'm not that familiar with DirectAdmin, but I have managed to set up other subdomains in C.com that have DocumentRoot within user C's directory tree and that run PHP exactly as I would expect them to.

Main question:

Am I right that the problem is pointing the DocumentRoot to some other user's directory tree?

Secondary question:

Are there any simple configuration tweaks available to make this work as intended?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I guess you're running PHP with suPHP instead of mod_php. That means that PHP scripts are executed under the user which owns the domain (in this case, user C). But if the PHP files are owned by a different user (in this case, user P), suPHP will throw an error (which should be logged on your subdomain's error log) and return a 500 HTTP error.

What you would need to do is change the configuration of the SuexecUserGroup variable in the virtual host of that subdomain. For that you can try the following (in Custom HTTPD configuration of Directadmin):

|*if SUB="mysubdomain"|
|?DOCROOT=/home/P/domains/mysubdomain.somedomainname|
|?USER=P|
|?GROUP=P|
|*endif|

That should work if your virtual host template has a line like this:

SuexecUserGroup |USER| |GROUP|

I have never tried this, but in theory it should work. Also note that PHP files should have its permissions set to 0644 and the folders which contain PHP script should be set to 0755 (or 0711). If you have broader permissions suPHP will throw another error and return a 500 HTTP status.

share|improve this answer
    
I've switched jobs since the question was posted, so can't verify the solution works, but will mark this as accepted answer in the hope that if it's incorrect, someone will let me know. Thanks! –  bububaba Dec 21 '12 at 21:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.