Apache serves PHP files without parsing them

Bug #525041 reported by Takyoji
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: libapache2-mod-php5

Installed Apache and PHP by just installing the "php5" package in Synaptic Package Manager. Apache, PHP, and the Apache PHP module were all installed, and are enabled, yet any request for a PHP file just returns the source code of the PHP file. There are no error messages in the Apache logs.

Process:
1. sudo apt-get install php5
2. Place any *.php file in /var/www
3. Browse to http://localhost/(name of PHP file)

What is expected: The PHP file gets parsed by the PHP interpreter and result is returned to Apache and then served to the requesting web browser.

What happens: The PHP file doesn't get parsed, and is just read by Apache directly and sent to the requesting browser.

ProblemType: Bug
Architecture: amd64
CheckboxSubmission: ef4cb2e02f8820e3456f679c8a5c77fe
CheckboxSystem: edda5d4f616ca792bf437989cb597002
Date: Sat Feb 20 14:27:18 2010
DistroRelease: Ubuntu 10.04
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Alpha amd64 (20100203.1)
NonfreeKernelModules: nvidia
Package: libapache2-mod-php5 5.2.12.dfsg.1-2ubuntu2
ProcEnviron:
 LANG=en_CA.utf8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-14.20-generic
SourcePackage: php5
Uname: Linux 2.6.32-14-generic x86_64

Revision history for this message
Takyoji (takyoji) wrote :
Revision history for this message
Andreas Olsson (andol) wrote :

Does it help if you restart apache2?

  $ sudo /etc/init.d/apache2 restart

When I try your recipe I do receive unparsed php code until I restart apach

Wondering if bug #403599 is still haunting us, or if this is a new issue.

Revision history for this message
Delan Azabani (azabani) wrote :

Add the following line to the start of /etc/apache2/apache2.conf

AddType application/x-httpd-php .php

Tip: if you want magic quotes to be turned off as well (deprecated 'feature'), add this line:

php_flag magic_quotes_gpc Off

Revision history for this message
Andreas Olsson (andol) wrote :

@Delan: No, that is not the way the Debian/Ubuntu apache2 configuration is normally handled. The configuration needed is available in /etc/apache2/mods-{available,enabled}/php5.conf, which in turn is included from /etc/apache2/apache2.conf.

Revision history for this message
Delan Azabani (azabani) wrote :

Then I guess I'm actually affected too. Ever since I can remember, PHP files weren't parsed by default and I had to add that directive to apache2.conf.

Revision history for this message
Takyoji (takyoji) wrote :

Seems functional now; may have just been as simple as a reboot... However I believe I tried restarting the Apache daemon with no changes. Yet in the Apache configuration there was a listing for associating php, php3, and phtml with the PHP interpreter. At least it seems to be functioning now (didn't need to tweak the configuration or anything).

Revision history for this message
Chuck Short (zulcss) wrote :

This bug report is being closed due to your last comment regarding this being fixed with an update. For future reference you can manage the status of your own bugs by clicking on the current status in the yellow line and then choosing a new status in the revealed drop down box. You can learn more about bug statuses at https://wiki.ubuntu.com/Bugs/Status. Thank you again for taking the time to report this bug and helping to make Ubuntu better. Please submit any future bugs you may find.

Changed in php5 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.