I have an apache httpd 2.2 installation on windows 8 (using the installer, installed to C:/Program Files (x86)/Apache Software Foundation/Apache2.2) and a php 5.2 installation (using the .zip, installed to C:/php). None my php files are parsing - they just show up as plain text.

// Stop PHP from killing itself

// Log error messages
ini_set('display_errors', 'On');
ini_set('log_errors', 'true');
ini_set('error_log', 'error_log');


My httpd.conf has all the necessary lines (I think)

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

(and at the bottom:)

PHPIniDir "C:/php"
LoadModule php5_module "C:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
<FilesMatch \.php$>
      SetHandler application/x-httpd-php

And just to be safe, this is in mime.types:

application/x-httpd-php php
application/x-httpd-php-source phps 

I've also edited the php.ini (Only the extension_dir though) properly (I think). What am I missing?

  • Might be a silly suggestion but did you reload the configuration file? – MitziMeow Dec 24 '12 at 23:00
  • @MitziMeow Yes, every time I edited it. I'd restart apache and also stop it and start it. Nothing. – JXPheonix Dec 25 '12 at 1:14
  • Where is your localhost root folder. I highly doubt that C:\ is it. If your code is not in the webservers folder, then it will be parsed as a plain old text file. This may be confusing with .html files since they are loaded by the browser anyway and look at though the webserver is working correctly. – frustratedtech Dec 27 '12 at 6:36

You might need explicitly add the php version you are trying to handle by appending it to x-httpd-php

AddHandler application/x-httpd-php5 .php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.