Index.php downloading instead of opening in browser

Status
Not open for further replies.

realjv3

New Member
Messages
10
Reaction score
0
Points
1
Hello,
when I browse to my web site, www.realjv3.com, instead of rendering index.php in the browser, it starts downloading. This is also happening for other files in the public_html directory, like about.php.

My .htaccess file in web root looks like this:
AddType application/x-httpd-php .html .htm .php
DirectoryIndex index.php
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff

Any ideas?
Thank you.
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Try removing the line here:
AddType application/x-httpd-php .html .htm .php

Also, if you are wanting index.html and index.htm to be the default thing as well then I would add their file extensions to the DirectoryIndex list.
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi realjv3,

Just to add on to what @caftpx10 said, the AddType you have already can work if you use -lsphp instead, as below. :)
AddType application/x-httpd-lsphp .html .htm .php

I've fixed this for you. :)

Thank you,
 

realjv3

New Member
Messages
10
Reaction score
0
Points
1
Thanks for both of your inputs, really appreciate it. I tried both suggestions.
Removing the AddType application/x-httpd-php line or adding the "-ls" stops the downloading of index.php, the page loads in browser but the php isn't executed, resulting in blank page.
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
There is a problem with your domain so I cannot look at the issue myself (apparently it is to do with MX).
 

realjv3

New Member
Messages
10
Reaction score
0
Points
1
I'd be happy to post my domain's DNS records if that helps. Are you referring to DNS mx records or x10.mx top level domain?
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
when I browse to my web site, www.realjv3.com, instead of rendering index.php in the browser, it starts downloading.
[ www.realjv3.com ] throws a 'Not Found' error -:- [ realjv3.com ] starts a 'downlod' of a file named "download"
that file shows you are trying to use ( $_SERVER['DOCUMENT_ROOT'] ) - which has a issue on your x10hosting's free-hosting server [ xo1 ]
see --> [ http://status.x10hosting.com/ ]

here is the file downloaded at [ realjv3.com ]...
PHP:
<?php
include $_SERVER['DOCUMENT_ROOT'] . '/includes/init.php';
include $_SERVER['DOCUMENT_ROOT'] . '/overall/head.php';
include $_SERVER['DOCUMENT_ROOT'] . '/overall/header.php';
?>

<div class="content">

    <?php
        include $_SERVER['DOCUMENT_ROOT'] . '/overall/nav.php';
    ?>

    <div class="subnav">
        <?php
            if (isset($_SESSION['errors'])) {
                output_error();
            }
            $suffix = get_last_blurb_page_suffix();
           
            if ($suffix > 0) {                                        //puts a link to older blurbs on page if older blurbs exist
                echo "<a href='/overall/blurb_archive/blurbs$suffix.php'><div class='older'></div></a>";   
            }
           
        ?>
    </div>

    <?php
    include $_SERVER['DOCUMENT_ROOT'] . '/overall/blurb_archive/blurbs.php';
    ?>

<?php
    include $_SERVER['DOCUMENT_ROOT'] . '/overall/footer.php';
?>
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
I'd be happy to post my domain's DNS records if that helps. Are you referring to DNS mx records or x10.mx top level domain?
DNS MX Records.
However, it seems that bdistler has managed to end up downloading a file which is strange.
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi,

The unexpected download is occurring due to an incorrect AddType, as I mentioned earlier. Changing "-php" to "-lsphp" will stop the download issue. However, it seems that the DOCUMENT_ROOT issue on your server is currently preventing the PHP file from executing correctly, which is why you are seeing the blank page. :)

We're working on resolving the issue regarding the PHP superglobals. :)

Thank you,
 
Status
Not open for further replies.
Top