vhost created by virtualmin run php as plain text/blank page

i’ve ubuntu server with virtualmin installed, i set up a vhost for my website, but when i access

http://intranetip/~test1/phpinfo.php , it print out

<? echo phpinfo ?>

and another site print blank page and view source code you can see <? echo phpinfo ?>

but when i put it in /var/www/html , it can print the phpinfo

After searched in google and tried several answer, still not work.

here is my vhost config

SuexecUserGroup “#1002” “#1002
ServerName test1.mydomain.com
ServerAlias www.test1.mydomain.com
ServerAlias webmail.test1.mydomain.com
ServerAlias admin.test1.mydomain.com
DocumentRoot /home/test1/public_html
ErrorLog /var/log/virtualmin/test1.mydomain.com_error_log
CustomLog /var/log/virtualmin/test1.mydomain.com_access_log combined
ScriptAlias /cgi-bin/ /home/test1/cgi-bin/
ScriptAlias /awstats/ /home/test1/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/test1/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddHandler fcgid-script .php
AddHandler fcgid-script .php5

FCGIWrapper /home/test1/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/test1/fcgi-bin/php5.fcgi .php5

allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.test1.mydomain.com RewriteRule ^(.*) https://test1.mydomain.com:20000/ [R] RewriteCond %{HTTP_HOST} =admin.test1.mydomain.com RewriteRule ^(.*) https://test1.mydomain.com:10000/ [R] RemoveHandler .php RemoveHandler .php5 php_admin_value engine Off IPCCommTimeout 31 FcgidMaxRequestLen 1073741824 AuthName "test1.mydomain.com statistics" AuthType Basic AuthUserFile /home/test1/.awstats-htpasswd require valid-user

anyone can find out the problems? i’also uncomment the php related line in /etc/mime.types, it also not work

Howdy,

Hmm, using the “userdir” method of accessing your site may be causing the issue you’re seeing.

What if you access it using “test1.mydomain.com/phpinfo.php”, does it work in that case?

-Eric

it seems when userdir mod is enabled, the php run as plain text , i follow this instruction but not work

http://devplant.net/2010/05/04/linux-php-not-working-in-userdir-public_html/

Howdy,

Well, there are a few ways to access it, but just for starters, you may want to try using the Services -> Preview Website option within Virtualmin. That would be the simplest to start with.

-Eric