How do I get php to be processed through a userdir location?

I’ve enabled userdir because my server only has my client sites on it and I need easy access to them before the domains are set up.

The userdir location works fine for html.

It initially returned the text contents for a php file so I modified the directory to add the handlers as follows:

    <Directory /home/*/public_html/>
        Options	-Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
        AllowOverride All
        Order deny,allow
        Allow from all
        AddHandler fcgid-script .php
        AddHandler fcgid-script .php5
        FCGIWrapper /home/paulwhippconsulting/fcgi-bin/php5.fcgi .php
        FCGIWrapper /home/paulwhippconsulting/fcgi-bin/php5.fcgi .php5
    </Directory>

Now it gives a 500 server error.
In the error log I see:

[warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function

and in the httpd/logs/error_log I see:

mod_fcgid: call /home/paulwhippconsulting/public_html/index.php with wrapper /home/paulwhippconsulting/fcgi-bin/php5.fcgi

The site functions fine with php when referenced using its domain name.

Does anyone know why php is not working here?

When I tried the same thing on a server not using Virtualmin/Webmin it worked without problems.

Howdy,

My suggestion is to solve that using something that’s not userdir :slight_smile:

Using userdir prevents the CGI and FCGID modes from working properly.

There’s other ways to handle what you’re after though – check out the section named “How do I make domains available before the DNS changes are made at the registrar?” in this document:

https://www.virtualmin.com/documentation/web/faq

In particular – I’d suggest setting up the aliases, or the Preview Website option.

If you want to use userdir. I believe that would only work if you’re setup with mod_php. However, check out that document, and let us know if that does the trick :slight_smile:

-Eric

Thanks Eric,

The preview website option is really handy and works fine but its inconvenient for clients and remote testing.

The userdir security issue is not a problem for me because I can easily exclude the few administration user accounts on the server from userdir access.

The alias facility would be good but:
“You can do that by going into System Settings -> Server Templates -> Default Template -> Virtual Server Creation, and adding your primary domain in “Automatically create alias domain”.”

  • There is no “Virtual Server Creation” option anywhere under the default template setting in my version (3.82.gpl)

  • Even if there was the necessary option present to make the creation of an alias the default action, I need to make aliases for existing folders (which I might be able to work out by looking at the configs after making a test alias using the template but as I can’t do that anyway…)

Finally, using the FAQ and following the exact instructions for enabling userdir just gave me 404 not found errors for the url whether pointing at html files or php files which lead me to trying to roll my own solution as above… which almost works (at least it gets at the html).

So I am afraid I am still stuck with this. My workaround at present is to keep a spare IP handy and point it at whichever site I’m testing but that is not good for a host of reasons.

Yeah, that alias feature was recently added to Virtualmin, I don’t believe it’s in 3.82.

However, it’s not doing anything particularly unusual – you could just manually create an alias for any Virtual Servers you have that you want to be able to access.

-Eric

Updated to 3.83 (latest updates) and the option is still not there.

I’m not sure how to manually create an alias that will work for me. I tried following http://www.virtualmin.com/documentation/tutorial/how-to-create-virtual-server-alias but I’m not sure how to achieve what I need.

I’ve used the alias feature for alternate domain names but here I’m trying to do something a bit different:

I need the alias for the domain to be a simple url using the existing host. For example:

I might have mybiz.com as the main server (and default site) and I need an alias for an upcoming site that will one day be newsite.com. newsite.com dns cannot be set up yet (e.g. because there is an existing site that is going to be migrated to the new one) but its added as a virtual server and now I and my client needs to test it with a convenient URL.

I need a URL like mybiz.com/newsite or newsite.mybiz.com to point to the public_html document root of newsite.com so I can test and verify it before migrating the real site.

How do I get that to work?

Feel free to tell me to RTFM so long as you point me to the right M :wink: