Local Host only showing source code...

Joined
Dec 5, 2009
Messages
5
Reaction score
0
Points
1
I've got the files in the right location --Library/WebServer/Documents/...

they're coded correctly (I do this for a living), they're just plain ole HTML files, nothing dynamic, no javascript, just html and css...

I load them to the remote server and they work fine but when I go to view them locally I can only see the source code...

What gives...?
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
And you are viewing these HTML files with?

Regards
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
What extension are you using for your files?
 
OP
R
Joined
Dec 5, 2009
Messages
5
Reaction score
0
Points
1
Files:

Are PHP files, I'm viewing them in FF 3.0.11

The file name is index.php

Here's the path to the parent folder:

http://localhost/knowink/mao/

This should show me the index.php page, I get a directory listing instead.

http://localhost/knowink/mao/index.php

This is the path to the index page, it should definately show me the index page...I get the source code instead. This is a direct copy and paste from my browser window, not from the source code listing - if you had clicked Command-U in FF.

I'm hoping not to come off arrogant here but I do this for a living, I build Mac apps and web based apps for a publishing company, in PHP using MySQL for a back end, heavy on AJAX and CSS, just started tinkering with HTML 5 (the geolocation stuff). I'm also pretty confident that this is probably user error (me :D):

<html>
<head>
<title>MAO 2009 Design 2</title>

<script languag="javascript" src="js/mao.js"></script>
<link rel="stylesheet" type="text/css" href="css/mao.css">
</head>
<body>


<div id="header"><img src="images/maologo.png" border="0" class="logo" width="300"><img src="images/headergraphics.png" class="headerleft"></div>
<div id="nav">
<div id="navlinks">
<ul>
<li><a href="javascript:void(0);" onmousedown="showsubnav('mojobox');">Mojos</a></li>
<li><a href="javascript:void(0);" onmousedown="showsubnav('mojos');">Spotlights</a></li>
<li><a href="javascript:void(0);" onmousedown="showsubnav('mojos');">Destinations</a></li>
<li><a href="javascript:void(0);" onmousedown="showsubnav('mojos');">The Campsite</a></li>
</ul>
</div>

<div id="mojobox" style="display: none;" id="navbox">
<ul>
<li class="navbox_li">Ride</li>
<li class="navbox_li">Camp</li>
<li class="navbox_li">Hike</li>
<li class="navbox_li">Snow</li>
<li class="navbox_li">Water</li>
</ul>
</div>
</div>

<div id="content">
<img src="images/1109/mao_1109_b_001.png">
</div>
</body>
</html>
 
Joined
Jun 18, 2006
Messages
191
Reaction score
5
Points
18
Location
Minneapolis
Your Mac's Specs
MacBook Pro
By default php is not enabled in webserver.
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
You initially said plain ole HTML files and now PHP..which is anything but plain ole HTML..:)

Either way, as @wheelguy said, PHP support is available in Apache, but isn't enabled..so follow this guide and enable it.

Regards
 
Joined
Dec 10, 2009
Messages
17
Reaction score
0
Points
1
Location
Canton, Ohio
Your Mac's Specs
Various Mac Minis, Mac Mini Servers
You can also configure Apache to render *.PHP files as *.HTML, but I think enabling PHP would be the best solution.

in httpd.conf
AddType text/html .php

Once you have PHP installed it should read like this.

AddType application/x-httpd-php .php

Again, I would just enable PHP, but this is technical possible.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top