Viewing PHP pages

Since upgrading to Tiger I've run into a strange problem. When trying to preview web pages I'm working on in Dreamweaver in Safari I get the source code in the main browser window instead of the actual rendered page. The extension of the file is .php. This only seems to occur with a local file. For example:

file:///Users/scottfeiner/Sites/Pandeiro/site/index.php

But when a .php page is viewed from a web server there's no problem.

Anyone have any ideas? This is driving me nuts!

Posted on Jun 14, 2005 11:57 AM

Reply
44 replies

Sep 27, 2005 12:29 PM in response to Ben Schmidt

hi ben, i followed your steps, making sure to have the latest browsers. other than safari, which shows the source code, all the browsers download the file to be opened by dreamweaver. The only way the file renders is if i fire up classic and use an old browser!

Could dreamweaver be the problem? Does it take over any php file by default, somehow? perhaps tiger gives it more importance and assigns the file type to that app, over the web browser's ownership?

Sep 27, 2005 12:48 PM in response to Web Girl

for waht it is worth, i called tech support, and they said an engineer from the safari team said they are working on a fix, and that it is an issue with tiger, and not safari. and how tiger "Sees" a php file.

my guess is that is is typed as a "script" file, which matell tiger that is has some other intelligents/structure other than a text or html file...

but again, i ain't no real programmer...

Sep 28, 2005 6:41 AM in response to Web Girl

Hi Web Girl,

It's certainly possible that there's an interaction problem with
b Dreamweaver,
at some stage, but with respect to just verifying which OS X browsers will process
b HTML
tags, in a file with a
b .PHP
suffix, for me:

b 1)
FireFox 1.0.7 & 1.5b1, Netscape 7.2, Mozilla 1.7.12 and iCab 3.0b352
b all
would open the .PHP file and process the HTML tags.

b 2)
Safari 2.0.1, OmniWeb 5.1.2b1 and Shiira 1.1 would
b not.

As a footnote to
b 1)
Camino 1.0a1 would only open a local
b .PHP
file,
b if
I dragged it into a Camino browser window, or used a URL: file:///Users/bschmidt/Desktop/test.php. Camino's "Open File..." menu item would
b not
let me Choose a .PHP file, showing it as greyed-out.

So what happens when you test your non-Safari browsers as far as opening a .PHP file which contains HTML tags,
b without
involving Dreamweaver?

best of luck,
...ben

Sep 28, 2005 7:51 AM in response to Ben Schmidt

I changed in the get info window which app to open php files with, from dreamweaver to safari.

any browser other than safari now just downloads the file i drag to it (or try to open through the menu) as if it was a file the browser can't display. it gets saved to my downloads folder and not processed at all. it's not about html tags being processed but php ones not. i know that php only gets processed when the file is on a web server that runs php.

I think you repeated your previous post in this last one. Believe me, the results are the same each time. for some reason most people that upgraded to tiger are having this prob. i think chris converse's post is on point. We just have to wait for a patch.

Nov 7, 2005 3:22 PM in response to Web Girl

This problem is still not fixed (November 7). I just installed Tiger (10.4.3) on my G5, and I can't display html tags in a php file (with extension .php, containing html and php tags) correctly (when opened LOCALLY) in Safari (2.0.2), Firefox 1.0.7, Netscape 7.2, Omniweb 5.1.2 and Shiira 1.1. Opera 8.5 and IE 5.2.3 are displaying them fine....

Apache and PHP are running on my machine

Dec 5, 2005 8:25 AM in response to Scott F.

Firefox and other browsers can be fixed to show the local .php file by:
rebuilding launchservice database, deleting internetconfigprefs, setting type/creator, and maybe rebuilding classic desktop... Now firefox at least shows (renders) the html tags inside .php files

Even the next simple html, save it as like 'test.php'...
it doesn't show up in safari (only shows the source-code),
but (now hold your seahorses) if you drop the test.php
on TextEdit.app... behold.... it shows the rendered html ????

<pre><html>
<body>
<b>Hello bold</b>
<i>Hello italics</i>
</body>
</html></pre>

definatly a safari/tiger bug and this needs to be adressed
as soon as possible because it is now impossible to develop
templates for php sites because you can't even review them
in safari...

Powerbook G4 and a Quicksilver

Dec 11, 2005 11:04 PM in response to Ben Schmidt

Safari is actually displaying the behaviour I would expect in Tiger. Files of type .php are surely not regarded as MIME type html internally in Tiger. W3C standards require browsers to use the MIME type provided in the http header to determine what to do with a file when served.

So when a .php file is served from a web server, it is being served as type text/html, so all browsers treat it as html to be rendered. However if it is being opened from a local file, then Tiger is presumably reporting that it is not text/html. So the correct response for a browser would be to either display it as text, or to offer to download it. I gather this is what is happening.

The solution would be to enable web serving as you suggest, and to ensure that Apache is serving files with the .php extension as MIME type text/html This may be the default with Apache, or you may have to do things with .htaccess files.

I can understand Apple not making immediate ease of use changes, as doing so may open security problems. Plus the worst example in this area is the way this sort of error has stalled use of XHTML past 1.0. W3C standards say XHTML 1.1 must be served as application/xhtml+xml. However if Internet Explorer receives XHTML correctly as application/xhtml+xml, it simply offers to download it, instead of rendering it with its XML parser. Hence so many people using XHTML 1.0 and serving it as text/html (the standard says it should be served as application/xhtml+xml but may be served as text/html).

Dec 12, 2005 1:48 PM in response to Eric Lindsay

This is not true Eric, browsers should open "local!!!" text/html files regardless of extension and should look at first bytes for html headings etc. OR should work according to internetconfigprefs (local mimetype database), this worked OK before. I explicitly added .php text/html but safari ignores it. [Web]developers need this feature to look at local html-files quickly when developing layouts locally.

Current option is to use another browser for now until this gets fixed by apple or rename to .html temporarily. If firefox also acts strange then try: rebuilding launchservice database, deleting internetconfigprefs, deleting safariprefs, setting type/creator.

Dec 15, 2005 4:44 PM in response to Tr909

This is not true Eric, browsers should open
"local!!!" text/html files regardless of extension
and should look at first bytes for html headings etc.
OR should work according to internetconfigprefs
(local mimetype database), this worked OK before. I
explicitly added .php text/html but safari ignores
it.


If they are actually seen as text/html. However it appears that .php is being seen as text/plain

I just realised I still wasn't clear on whether your test .php files are in an arbitrary portion of your file structure (like mine). Or are they actually in the location Apache expects, your personal Sites folder? Or in Library/WebServer/Documents? I wonder what is the scope of changes to internetconfigprefs?

I am certainly glad I am doing my testing (and my web pages) a different way, given the obvious complications you have encountered.

Mar 2, 2006 2:35 PM in response to Scott F.

I'm with you on this too...

Here is my contribution to another post. I put it there too, just in case... :
---
I'm (not only) a web developper.

When I worked with Safari in Panther, I always could see an ".php" page rendered. It worked also fine with Explorer or Firefox.
Now, I'm on Tiger, and the ".php" pages are not rendered anymore in Safari, unless I change ".php" by ".html". It still works fine with Explorer.
Now, concerning Firefox : it used to work fine on Tiger, but as soon I installed the Dreamweaver 8 software, now Firefox opens a dialog box and offers to save the ".php" document or to "open it with..."

This is quite clear (no doubt about what I did) that installing Dreamweaver changed the way Firefox handles the ".php" document.
So, maybe ther is some kind of document somewhere in the system which describes what should happen with which application...

Hopping it can help someone to help us...
looking for a solution and NOT a workaround
🙂

For example, maybe a software exists that could change the "preferences" of how the system should handle the different document types...

Mar 10, 2006 4:27 PM in response to Yves Gigon

Yes, I'm sure I use the lastest versions of Dreamweaver and Firefox.
Maybe if I re-install Firefox (so after Dreamweaver is already installed) it could restore the "good" behaviour for Firefox.
I'll try it when I'll have time.
And maybe if you try to re-install Dreamweaver once Firefox is there, you may have the "wrong" behaviour on Firefox... try it, or maybe don't !
Thanks.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Viewing PHP pages

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.