473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP files coming up as files to download

Hi everyone.

I have migrated my site from Apache 1.3 web server to Apache2 and now when i open php files, they pop up in a download window instead of executing.

I searched all around but no solution found. Someone please help.

Thank you in advance
Jan 22 '09 #1
4 3158
Atli
5,058 Expert 4TB
Hi.

This usually happens because you have not told Apache to handle .php files as PHP code.
So, when you open a .php file, Apache, not knowing what to do with it, will send it as a PHP file, which the browser doesn't know how to handle.

You need to add the following to your Apache configuration:
Expand|Select|Wrap|Line Numbers
  1. AddType application/x-httpd-php .php .phtml .php3
  2. AddType application/x-httpd-php-source .phps
Note, you can add file extensions to that list if you want Apache to handle them as PHP as well.
Jan 29 '09 #2
Thanks Atli.

This really helped
Jan 29 '09 #3
Ok, I am completely new to all this stuff. Apache, php, mysql etc. I am reading a book and trying to take my basic knowledge up a notch. I have installed Apache, php and mysql onto my system via XXAMP, and everything seems to be working apart from getting php files to open in the browser [I get the option to save the file]. I can access localhost, Myphpadmin, and create databases etc.

I have searched numerous forums, and they all seem to give an answer similar to the answer provided in this thread - the problem is, being completely new to this, I don't know how to tell Apache to do it. I see the code examples given to add to the apache configuration - but how do I do that?

Thanks in advance for any help - being new to this, it probably seems very simple to a lot of people, but I really don't know where to go to make this change to the configuration.
Mar 23 '09 #4
Atli
5,058 Expert 4TB
Hi, nannajul.

You need to alter the Apache configuration file, "my.cnf". (Or "my.ini" on Windoze)
It is usually located in the Apache installation directory, although if you installed this as a part of some package it may be located somewhere else.

In any case, you just need to find that file, open it in a text editor and add the lines I posted to it.

I don't recommend using Notepad to open it... Notepad has problems with Unix style line-breaks.
Apr 8 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Astra | last post by:
Hi All The following ASP routine allows me to force a PDF file to download rather than show up in IE: Response.ContentType = "application/asp-unknown" ' arbitrary Response.AddHeader...
4
by: Carolyn Marenger | last post by:
Hey everyone, I am looking for your thoughts and opinions. Is it preferable to have one css file containing all the style information or break it up into multiple imported files for different...
3
by: Jeff Sanders | last post by:
I am running an ASP file that returns image buttons back to the client. The download on the client side is slow (about 19 small images on the page). I am running on Windows XP SP1 behind ISA...
0
by: Bert Verhees | last post by:
Hi, I am creating an XMI-interpreter which must be able to use XMI-files from as many as MDA-tools as possible. For this purpose I need XMI-files for testing purposes. If someone can help me...
4
by: Himanshu | last post by:
hi, Can anybody tell me that thru asp.net using c#, how can we upload and download physical files in any table of SQL Server Database. the uploading part is running successfully but the...
6
by: Shawn | last post by:
Hi. How can I download a file and store it on the web server. I have a complete URL to the file, but I never know what kind of file it is. It can be pdf, jpg, tif, doc, xls etc. Thanks, Shawn
13
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
7
by: eventuranza | last post by:
For my application, there users can upload and download files to the a webserver. Straightforward enough. However, when they upload a PDF file then try to download it, the file seems to be...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.