I created a virtual host in apache2 (LAMP) as shown below and the php files are downloaded by the browser instead of processed by apache. I created an HTML file and it worked.
/var/www/myvirtualhost.com/public_html
ServerAdmin webmaster@localhost.com
DocumentRoot /var/www/myvirtualhost/public_html/
ServerName myvistualhost