I have a web application written in PHP, html and JavaScript.

On my PC, I have installed the EasyPHP program which has Apache and everything installed.

I wanted to put this web app on my server and I have installed Apache 2.0, but my php files are displayed as text or downloaded automatically.

I have tried several things, one of which is to add the below to my conf file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

But it's still not working.

What else can I do?

  • Did you restart your apache server after changing the configuration? Also, it will be more helpful to post your apache config. – Khaled Sep 19 '12 at 7:48
  • yes I have restared. But funny thing is that I have 2 config files one is config.default and other one is config. I have tried to change each of it and still same thing. You mean to post everything in here? I think that would be too much code. Basically I didn't change anything else except this lines that I have wrote and path of my folder which doesn't change anything – user123_456 Sep 19 '12 at 7:51
  • Have you actually installed PHP on the server, e.g. mod_php? I know that seems like an obvious step, but you mention installing it on your PC and don't mention installing it on the server. – pjmorse Sep 29 '12 at 0:47

Don't use XP as a server operating system, because it's not one.

If it's gotta be that generation of Windows OSes (also a really bad idea), at least put Server 2003 R2 on there. It shouldn't be too hard to find a legit copy on the cheap; I personally use the Server 2003 discs as coasters. A much better idea would be to get an appropriate edition of Server 2008 R2 or 2012, but that would be more expensive than an OS that's largely abandoned or being abandoned rapidly.

As to actually correcting the problem, you haven't given enough information to really troubleshoot this, but the .php files being downloaded or displayed instead of executed is a browser setting (that can be influenced by a number of other things, which you haven't given enough information about). Look into how to change how your browser handles .php files and/or try your luck with a different browser and see if it just works after installing a new one.

  • Sorry my fault it is a windows server 2003 – user123_456 Sep 21 '12 at 8:25

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.