Apache downloads instead of displaying php and html

Asked by Jim Fieser on 2011-01-29

Apache was working fine until I upgraded with webmin. Among the patches it removed Suhosin.
Was Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.12 with Suhosin-Patch configured
Now Apache/2.2.8 (Ubuntu) configured

The AddType seems to be missing for the root /www/var and it's real subdirs. It sends me the unprocessed php code as a download. Sends html also as a download. As a download I can't tell what the mime type is, but clearly not text/html.

http://10.1.1.5/phpmyadmin/ is a soft link and Apache works just fine there!
 phpmyadmin -> /usr/share/phpmyadmin
Another soft link does not reproduce that effect.

LAM is configured in a different directory and it has the problem as well.

Can I put Suhosin back on?

Here's my config: /etc/apache2/sites-available/default

NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apache2 Edit question
Assignee:
No assignee Edit question
Solved by:
Jim Fieser
Solved:
2011-01-30
Last query:
2011-01-30
Last reply:
2011-01-29

Better to configure the /etc/apache2/sites-enabled/000-default

Jim Fieser (jfieser) said : #2

It's a link to the same file.

ls -la /etc/apache2/sites-enabled
total 8
drwxr-xr-x 2 root root 4096 2010-06-02 23:31 .
drwxr-xr-x 7 root root 4096 2011-01-29 04:57 ..
lrwxrwxrwx 1 root root 36 2010-06-02 23:31 000-default -> /etc/apache2/sites-available/default

That file is not making changes to my config. That's a clue! The /etc/apache2/httpd.conf was only 6 months old and empty so I used:
ln -s /etc/apache2/sites-available/default /etc/apache2/httpd.conf
to create a link but now it complains:
[warn] NameVirtualHost *:0 has no VirtualHosts

But webmin shows 2 /var/www Virtual hosts configured. I delete one, they both disappear, create 1, they both re-appear.

Jim Fieser (jfieser) said : #3

I had to create soft links in /etc/apache2/mods-enabled for ../mods-available/php5.load and ../mods-available/php5.conf.

I had to add my types into apache2.conf
AddType application/x-httpd-php .php

And I commented out the virtual host configurations in apache2.conf
# Include /etc/apache2/sites-enabled/

I also took out the references to Virtual Hosts from httpd.conf because I don't need them.

I did learn that any modern browser has to have the cache cleared for any test of the system to function when the problem is the application data type.