Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

<?php
// Stop PHP from killing itself
set_time_limit(0);

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

...etc.

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
</FilesMatch>

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?

share|improve this question
    
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

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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