Forum Moderators: coopster

Message Too Old, No Replies

Probably a dumb question...

.php won't open in browser, wants to d/l

         

BasicJim

1:29 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



For some reason, when I try to open my index.php on my server (a new host for me), mozilla and ie both won't open it, the try to download it. Mozilla asks me what I want to do with the file and IE opens it in DreamWeaver. What do I have screwed up?

BasicJim

1:34 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



Mozilla says:
The file "index.php" is of type application/x-httpd-php, and Mozilla does not know how to handle this file.

Then it ask what I want to do with the file, save, open with default app, etc...

coopster

1:35 pm on Aug 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, BasicJim!

Sounds to me like an installation [php.net] issue, you aren't parsing PHP yet on the server. If you are running your own server, you need to add a couple of lines to let the server know how to handle php files.

BasicJim

1:39 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



Nope.. a professional web hosting service that does php support. Plesk says I have it on...

One thing that might be wrong... I am trying to set up an s9y php blog... it says I need ".htaccess support allowing overrides for DirectoryIndex."

Would NOT having that cause these issues?

coopster

2:16 pm on Aug 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I doubt it, but I suppose there could be a possibility. But it depends on what all is wrapped up in that .htaccess file. DirectoryIndex [httpd.apache.org] sets the list of resources to look for when the client requests an index of the directory by specifying a / at the end of the a directory name. For example, if I go to www.example.com, without specifying any particular file, most servers are set to find "index.html" and return that page from that directory.

I think you should make sure your server is parsing php files first. What I would do is make sure I don't have any per-directory override files (.htaccess) in my root directory. Next, create a simple php script:

<?php 
phpinfo();
?>
Save it with a .php extension, something like mytest.php and upload it to the root directory. Open a browser window and request that script..
http://www.example.com/mytest.php

and see if you get a nicely formatted PHP information page. If so, your server is parsing php pages correctly (well, I should say your server is configured to parse pages stored with a .php extension as PHP). If not, you need to find out from your hosting provider how php pages are parsed on that server.

TheBlueEyz

10:37 am on Aug 10, 2004 (gmt 0)

10+ Year Member



Ummm...

Using the application/x-httpd-php header in your PHP installation is optional. What it SHOULD be returning is text/html.

In fact, it does that by default so I'm wondering why your installation is set up to use application/x-httpd-php at all.

The modification is made in php.ini and is called "default_mimetype". It can be changed using ini_set:

ini_set('default_mimetype', 'text/html');

Try using that and see if you still get it.