Jump to content

Recommended Posts

I'm having a problem where I am prompted to download or open a .php file on my localhost, instead of displaying in the browser.  The .php files all work properly on the live server, but not on any of my localhosts, which I have three.  I have downloaded and installed Wamp Server 2.0i, but have also tried with IIS and Xampp and have the same issue. 

 

I've tested everything possible and it's showing php and Apache are running properly.  I've added the following lines to the httpd, php and confd .ini files, but still no luck. 

 

AddHandler application/x-httpd-php .php .phtml

AddHandler x-httpd-php .php .phtml

 

The localhost displays all .html pages and style sheet links, but not .php pages.  I also have some PHP SS Includes and they are not displaying properly.  All the php code is being sent to the browser as text.  It appears as though the php is not being parsed.

 

Can anyone please help me with this problem?  I would greatly appreciate it.

 

Link to comment
https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/
Share on other sites

I am using the <?PHP opening tag and not just the <? tag.  Below is how my index.html page begins and ends:

 

<?php

$meta_page = 'home';

$pagetitle = 'xxxxxxxxx';

include('include/header.php');

?>

 

.<HTML> HTML code here.

.

.

.

.

 

 

<?php include('include/footer.php'); ?>

 

The php code is being sent to the browser as text and is not being parsed by the localhost.  This is working on the production server, just not on the localhost.  That makes me think the code is correct, but it's something with the PHP or Apache settings on the localhost. 

 

I've tried everything I could think of and research, but just have not been able to find an answer on how to resolve. 

Can you tell me how to configure my local webserver to parse .html files as .php?  I have Wamp 2.0 and php 5.3.0.  I have been checking all the settings and just can't seem to find where I can configure it. 

 

Some pages are .html and it displays the html properly, but does not parse the php code.  And the php pages will not display at all when I go directly to them in a browser.  It just prompts me to download or open the page.

 

Thank you very much for all of you help.  I really appreciate it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.