After completing an installation using http://localhost/mydrupalsite you are unable to see the site. Instead, you are presented with a dialog box. If you are using Firefox, the box is called "Opening" which reads "You have chosen to open [blank space] which is a: PHTML file from http://localhost. What should Firefox do with this file?" etc.

The problem is caused by a misconfiguration of apache's php file handling. In your apache configuration file you should have something like:

<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
</IfModule>

or (the following is the /etc/apache2/php5.conf from a custom Ubuntu LAMP set up):

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
#    <IfModule mod_userdir.c>
#        <Directory /home/*/public_html>
#            php_admin_value engine Off
#        </Directory>
#    </IfModule>
</IfModule>

If you are indeed on an UBUNTU system and the problem appears only if you try to access http://localhost/~userdir/ then most likely in the above file the part:

    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>

has not been commented out! Commenting this part out and restarting apache (sudo /etc/init.d/apache2 restart) should solve the problem.

If still the problem persists then try opening your site using the local IP address http://127.0.0.1/mydrupalsite or http://127.0.0.1/~userdir/.

Sometimes you may have fixed the problem but you still need to clear your browser cache (or use another browser) before the site displays properly.