I have recently learned how to use transfer wp sites to a new host, and also learned how to modify the hosts file so that I can look at any site transfers to the new host in my browser to check everything is working fine before make the DNS change. I have done several of these successfully, but I am having problems with my latest transfer.

Having modified the hosts file, (I use these instructions http://www.webhostinghub.com/support/domain-names/dns-nameserver-changes/modfiying-your-hosts-file successfully for the past few transfers) when I type the domain name into firefox I get this message http://i1079.photobucket.com/albums/w517/darrenhaynes1/mozilla-hostsfile_zps0188bf73.jpg

When I type the domain into chrome, a file automatically downloads, but the website does not show.

Anyone know what is going on here?

Oh - and I am using windows 7 64bit

  • 1
    It seems to me the host server is not configured to handle php files. Which web server and platform is the host on ? – Praveen Oct 20 '12 at 13:09

It's not your hosts file - the new webserver is not configured to process PHP files, so it's just sending them to you, instead of processing them. If this is shared hosting, and you don't have shell access, enter a support ticket.

If you do have shell access follow the steps here from step 11. Or better yet, google something like 'install PHP on [your linux distro]' to get more specific instructions. In the general case, what you need to do, for apache, is:

1) If you don't have PHP installed on the system, you'll need to do that.
2) If you do, you'll need to edit apache's config files (every flavor of linux is a tad different) to include lines like

LoadModule php5_module  modules/libphp5.so
AddHandler php5-script  .php 

DirectoryIndex index.html index.php

AddType text/html   .php

3) Restart the server, and try accessing a minimal PHP script to make sure PHP itself is working, like:

<?php phpinfo(); ?>

4) If that works, but the rest of the application does not - you may be missing some PHP modules (like MySQL) or your application's configuration needs updating (new database username/password). The error you get should give you a hint at that.

| improve this answer | |
  • Hi Tom, The server I am transferring to is a hostgator reseller account. Here is the thing - I transferred a different website yesterday to this hostgator account, and the hosts file modifcation worked fine. I just also transferred another website again to the hostgator account, just to do another test, and this one works fine with the hosts file modification. So, there must be something up with the site I transferred in the OP. Also, I don't know any php, so your advice above was a little above my understanding :-) – Darren Haynes Oct 20 '12 at 14:25
  • Here is a screecast of the files on my server screencast-o-matic.com/watch/cl6Y2vR8F site transfer is a new process to me so I don't what half those files do, but thought I would show them here in case anything should stick out as off. Another piece of information is that the site have transferred from my bluehost account. The website that is have problems with the hosts file is the primary site on that bluehost account, the other 2 sites that have worked fine with the hosts file modification, were actually addon domains to the primary domains. So not sure if that makes any difference – Darren Haynes Oct 20 '12 at 14:32

Got this one resolved. Thanks for your answers.

I am still new to code and web hosting issues, so I had the amazing brainwave to contact my web host (yep I know, why didn't I think of that first)

The web host said there was an error in the host file and changed that and all is good. Sorry for the late reply, but I haven't logged in here until now!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.