Oh FFS! Has anyone had a problem with Apache2 and PHP4 on Debian Sarge/Testing? I have a stock install of it with nothing unusual AFAICT but Firefox keeps trying to download and save php files instead of processing them. All the config files seem to be correctly set up. Files in mods-enabled/ are fine.
Why am I upset? I added the wp-newblog.php to WPMU SVN tonight, imported a chunk of code from install.php so it’s a one-step process, but I can’t test this thing to see if it works! It’s here as a WPMU snapshot but it won’t work out of the box. It needs an entry in .htaccess first, and bug fixing.
I’m off to relax, it’s been a long day.. zzzz
Much Later… I finally got it working again. I tried dpkg-reconfigure phpmyadmin
but it didn’t update the config file with this error:
Not replacing deleted config file /etc/apache2/conf.d/phpmyadmin.conf
Following the clues from here I did the following:
apt-get remove –purge libapache2-mod-php4
apt-get remove –purge apache2
apt-get install libapache2-mod-php4 phpmyadmin
PHPMyAdmin now works fine, and hopefully wpmu will too!
Did you check out the AddHandler line to make sure PHP is parsing the files, and the AddType to make sure that they’re being sent as the right type. Also check the LoadModule statements for PHP. If you’re lost, its all in the apache httpd.conf, and there are hundreds of tutorials on google for setting it all up.
Sarge with libapache2-mod-php4 works fine for me. Does the server process the php files (and Firefox tries to download the output) or does it just send out the source code?
Make sure you have all the following lines somewhere in your httpd.conf (or in your conf.d/php.conf):
LoadModule php4_module modules/libphp4.so
# Cause the PHP interpreter to handle files with a .php extension.
AddType application/x-httpd-php .php
# Add index.php to the list of files that will be served as directory
DirectoryIndex index.php
Hope that helps.
There was this problem with WP after an upgrade to 1.5 where if you had not run wp-admin/upgrade.php … don’t suppose that could be it?
I have the Apache 2 config files correctly setup, and they worked fine for ages until a few weeks ago when I did an apt-get upgrade. If I can’t get Apache 2 to work, I’ll try Apache 1.3, there’s not real reason to use Apache 2 except that it was the default AFAIR.
Hrm,
I’ve only ever seen the ‘download’ for WP occurring once on my home testing server (which was Debian testing + apache2). This actually occurred after going from testing to unstable for me.
It’s usually due to either missing libapache2-mod-php4, a php4 package missing due to a conflict resolution during the upgrade, or an Apache conf file that has been overwritten by dkpg/ apt-get. I now have a Ubuntu Hoary box that acts as my linux workstation and server..
Firing up aptitude, and doing a search against “php” will cycle through the various php packages. It’s quite possible during the upgrade, something got broken (due to conflict resolution), so it is worth checking you have all the required packages.
Simply replacing Apache 2 with 1.3 won’t fix the issue (by itself) as you will also need to install all the apache 1.3 associated php packages as well.
# dpkg-reconfigure libapache2-mod-php4
This should solve your problem on Sarge.
You may have encountered same “entertaining” caching behaviour of the browser that I just did.
It’s 5:18AM here. I just spent four hours trying to get similar setup going, just to find out that I’ve been getting the initial application/x-httpd-php file from disk cache instead of server itself. It got cached when I first tried to load the page, and there indeed was a configuration problem. After that every subsequent refresh just gave the php file from disk cache and asked if I’d like to save it. In total frustration I tried http://host/file.php instead of just http://host/ – and of course it worked. Five hours of solving a problem that was not.
“You may have encountered same “entertaining†caching behaviour of the browser that I just did”
YES! OMG! Cache caused this problem for me! I went absolutely CRAZY! Until I tried clearing my cache.
DAMN CACHE! AHHHH!
Had a similar error, solved it using:
When you upgrade Apache you have to install libapache2-mod-php4
Apache 2 doesn’t always automatically update the php.ini files so that the related packages can be used with Apache The solution to this is to reconfigure the php4-pgsql and php4-mysql packages with:
dpkg-reconfigure php4-pgsql php4-mysql
with a smile
/prifre
erno: you’ve just saved me several hours of witch-hunting. Thank You.
Keywords for google: apache2 directory index php4 debian sarge download x-httpd-php.
Darn cache, thanks erno!
Well dude i also have a similar error with that. Maybe i need more tutorials to do this lols.
Same problem here… I’ve tried everything to get PHP 4 or 5 to work. No luck 🙁
Thanks for this post I got mine working following your direction. I can’t make php5 run however.
I’m using php5 and I finally got it to load a page rather than the download manager – but it’s loading 404 page not found . . . Still, a change in error msg is as good as a rest. Thanks for getting me this far!
Thanks, erno! I just spent a half hour fighting with the configuration only to discover that it was, indeed, your entertaining caching issue. Cheers!
Thanks mate, this helped me! 🙂
Thanks so much for posting this information out there. I just tried to do a side-by-side install of PHP4 and PHP5 unintentionally and it blew up my install. The comments here saved my hide! Props
I battled php5 apache2 mysql, and finally I found that
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
was not added to apache2.conf automatically by the
apt-get install libapache2-mod-php5
procedure. Maybe this is a trivial fact that everyone but me would know beforehand? Anyway, adding the LoadModule line above fixed my problems.
Also, that web browser caching deal sounds like a nasty little way to obfuscate any headway that someone might be making while trying to get this all working.
Thanks Donncha!
dpkg-reconfigure phpmyadmin actually worked out for me without a single error… Fortunatelly. I´ve had this problem since yesterday but now everything seems ok.