miketfp Posted June 6, 2010 Share Posted June 6, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 6, 2010 Share Posted June 6, 2010 All the php code is being sent to the browser as text. Post an example of some of your code. Post the php opening tag you are using. Quote Link to comment https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/#findComment-1068440 Share on other sites More sharing options...
miketfp Posted June 6, 2010 Author Share Posted June 6, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/#findComment-1068621 Share on other sites More sharing options...
PFMaBiSmAd Posted June 6, 2010 Share Posted June 6, 2010 Below is how my index.html You would either need to configure the web server to parse .html files as php or use .php Quote Link to comment https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/#findComment-1068628 Share on other sites More sharing options...
miketfp Posted June 6, 2010 Author Share Posted June 6, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/#findComment-1068634 Share on other sites More sharing options...
PFMaBiSmAd Posted June 6, 2010 Share Posted June 6, 2010 AddType application/x-httpd-php .php .html Quote Link to comment https://forums.phpfreaks.com/topic/203997-php-on-localhost-not-working/#findComment-1068702 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.