Apache showing contents of file not downloading






















To do this, open a terminal window and issue the command:. To do this, go back to your terminal window and issue the command:.

You're ready to restart Apache 2. To restart Apache, go back to the terminal window and issue the command:. You should now be able to point a browser to a PHP file and watch it execute properly, as opposed to saving to your local drive or displaying code in your browser. I warned you this would be a simple fix. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. How to configure Apache2 to download files directly? Ask Question. Asked 6 years, 7 months ago. Active 6 years, 7 months ago.

Viewed 29k times. In the file, I had this string: This is a test file. Improve this question. Who owns this outage? Building intelligent escalation chains for modern SRE.

Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Recommend Deletion option in Late Answers review queue does nothing - please Please stop posting half answers and dumb advice as comments. Linked 2. Related 0. Hot Network Questions. Question feed. Ask Ubuntu works best with JavaScript enabled. Another possible cause of this problem could be that you are trying to run the script in a "user directory" from the the UserDir module.

Running PHP scripts in user directories is disabled by default. You must comment or delete the tag block at the bottom that reads. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Apache is downloading php files instead of displaying them Ask Question. Asked 8 years, 3 months ago. Active 1 year ago.

Viewed k times. OS and server information: CentOS 6. Thank you. EDIT: I have these lines in the php. Anthony Gainor. Anthony Gainor Anthony Gainor 1, 2 2 gold badges 9 9 silver badges 9 9 bronze badges.

Well, how did you install it? Which SAPI? Your php module is not running. I edited the questions. The modules do exits and they are being loaded apparently — Anthony Gainor. Did you restart apache after installation? Show 6 more comments. Active Oldest Votes. Mihkel Mihkel 6 6 silver badges 2 2 bronze badges. Could you add some info where to put these lines? For people looking for where to put these lines.

In my case , on Apache This works, adding d part to x-http-php like on your post works! I've configured php from source — Liso. Add a comment. So I hope there is somebody among you that can help me with this annoying problem as I'm quite desperate Edit: Now Opera also wants to download files whether index. I use a command line tool called curl to check headers on a website.

You can generally control the Content-Type through. I see that you are already doing this for. You may have to do the same for other extensions such as. This is then the default type for files with those extensions, but if they are backed by a web application, the code that runs that web application usually has the ability to override them.

Most web application frameworks have some sort of setHeader directive that can be used to set both Content-Type and Content-Disposition.

In addition to checking your. Sign up to join this community. The best answers are voted up and rise to the top.



0コメント

  • 1000 / 1000