LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-08-2011, 04:41 AM   #1
Spuddy
Member
 
Registered: Jul 2010
Posts: 83

Rep: Reputation: 15
Question server offers PHP file for download on HTTP but is fine on HTTPS.


Hi Guys,

I wonder if you can help. I have a debian box running Apache2 and PHP5.2.6 lenny.

When a request is made via https, php displays the content fine. If the request is made over HTTP the file is offered for download, rather than displaying it.

I know its probably something trivial but I've never seen this issue.

Any ideas? Thanks.

EDIT: The plot thickens, I can display PHP over HTTP in some directories but not others (which offer the file for download)?

Last edited by Spuddy; 03-08-2011 at 05:49 AM. Reason: More information.
 
Old 03-08-2011, 05:52 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi

Search for:
Quote:
php_flag engine off
in a .htaccess in those directories, or in apache2.conf

Regards
 
Old 03-08-2011, 06:03 AM   #3
Spuddy
Member
 
Registered: Jul 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
Hi

Search for:
in a .htaccess in those directories, or in apache2.conf

Regards
Hi,

Thanks for the response, there are no .htaccess files and the php_flag command can't be found in apache2.conf
 
Old 03-08-2011, 06:17 AM   #4
Spuddy
Member
 
Registered: Jul 2010
Posts: 83

Original Poster
Rep: Reputation: 15
for example

http://1.2.3.4/a.php - does not work, offers a.php for download.
https://1.2.3.4/a.php - displays php info

http://1.2.3.4/a/a.php - displays php info
https://1.2.3.4/a/a.php - displays php info

http://1.2.3.4/utils/test.php - does not work, offers a.php for download.
https://1.2.3.4/utils/test.php - displays php info

Last edited by Spuddy; 03-08-2011 at 06:18 AM.
 
Old 03-08-2011, 06:27 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Are you sure it's not your browser cache?
This behavior is common if you miss
Quote:
AddType application/x-httpd-php .php
, but I guess here is not the case as it works sort of.

Anyway, you can create a .htaccess in the DocumentRoot (/var/www) containing:
Code:
php_flag engine on
as a workaround

Last edited by bathory; 03-08-2011 at 07:12 AM.
 
Old 03-08-2011, 06:39 AM   #6
Spuddy
Member
 
Registered: Jul 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
Are you sure it's not your browser cache?
This behavior is common if you miss
, but I guess here is not the case as it works sort of.

Anyway, you can create a .htaccess in the DocumentRoot (/var/www) containing:
Code:
php_flag engine on
as a workaround
Hi,

Created .htaccess file with just

Code:
php_flag engine on
within, restarted apache and same outcome. Browser cache is clear and using multiple browsers to check.

Thanks,
 
Old 03-08-2011, 07:11 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
There is no need to restart apache after editing .htaccess.
Could be that apache does not read .htaccess files. You can /etc/apache2/sites-available/default (or whatever is the vhost file you're using) and make sure you have
Quote:
AllowOverride All
 
Old 03-08-2011, 08:31 AM   #8
Spuddy
Member
 
Registered: Jul 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
There is no need to restart apache after editing .htaccess.
Could be that apache does not read .htaccess files. You can /etc/apache2/sites-available/default (or whatever is the vhost file you're using) and make sure you have
Hello AllowOverride All is present in /etc/apache2/sites-available/default.
 
Old 03-08-2011, 09:09 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
May I ask why you marked the thread Solved?
 
Old 03-08-2011, 10:10 AM   #10
Spuddy
Member
 
Registered: Jul 2010
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
May I ask why you marked the thread Solved?
Hi, sorry I meant to post the resolve but was side-tracked.

We found a device further down in the line in our network was web-caching on port 80, we disabled this and everything worked.

Thanks.
 
  


Reply

Tags
apache2, php5



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP FILE MANAGER (ftp,http download) - suggestions dlugasx Linux - Software 1 10-20-2010 11:38 PM
php readfile http VS https blizunt7 Programming 3 04-28-2009 11:18 PM
php https wrapper giving Segmentation fault but not http imraven Linux - Software 2 03-27-2009 02:20 AM
HTTPS and HTTP on same server Jake_B Linux - Software 2 11-28-2005 04:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration