Hi,
I used to have the converse problem, my browser only
showed the PHP code when connecting to the web server, or else it tried to download it as a php file. This is with MacOSX PPC, XAMPP v1.0.1, referencing a simple test URL
http://localhost/phpinfo.php containing:
- Code: Select all
<?php
phpinfo();
?>
I use the older XAMPP version because I'm working with Drupal which only supports php 5.2 at this time. The problem started a few days ago when I tried to install Drupal Aegir which adds dedicated apache configuration settings at the end of httpd.conf, which still needs "some" (??) of the original XAMPP settings.
Interestingly, after removing the Aegir include in httpd.conf and restarting Apache, both FireFox and Safari still tried to download the phpinfo.php file via the test URL, which
did work correctly before my Aegir tests. The Aegir installation does not modify my original httpd.conf, all changes are manually made by me.
When this problem first appeared, I experimented with httpd.conf handlers and types, but to no avail:
- Code: Select all
# JDB: php handler instead of type?
##-JDB-## AddType application/x-httpd-php .php .php3 .php4
AddType application/x-httpd-php .php
##-JDB-##
##-JDB-## AddHandler application/x-httpd-php .php .php3 .php4
##-JDB-## AddHandler x-httpd-php .php .php3 .php4
##-JDB-## AddHandler php-script php
Also:
- I have 'short_open_tag = On' in php.ini.
- Firefox / Live HTTP headers showed 'Content-Type: application/x-httpd-php' coming my way.
- I cleared the browser cache & cookes, restarted firefox, rebooted the Mac, restarted Apache, etc.
- I deleted the local php sess_* cache files.
- php.ini cache controls have mostly default values.
- Other php sites (like this page) continue to work normally.
- I didn't have this problem with the MAMP stack, or MacPorts AMP..
Fix:The php module wasn't enabled after my Aegir tests. (BTW, what means 'JUSTTOMAKEAPXSHAPPY' ??)
Unconditionally loading the module fixes the problem.
- Code: Select all
##-JDB-## <IfDefine PHP5>
LoadModule php5_module modules/libphp5.so
##-JDB-## </IfDefine>
$ apachectl -t -D DUMP_MODULES 2>&1 | grep php
php5_module (shared)
Root cause:XAMPP Apache is normally started by the "GUI widget" or
- Code: Select all
/Applications/XAMPP/xamppfiles/xampp startapache
These methods check for an available PHP version and pass the appropriate DEFINE's to httpd. However, Aegir wants to control Apache restarts itself (sudo apachectl), and since I began using this method myself, PHP5 was no longer defined to httpd nor rendered by the Browser.