LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   server offers PHP file for download on HTTP but is fine on HTTPS. (http://www.linuxquestions.org/questions/linux-server-73/server-offers-php-file-for-download-on-http-but-is-fine-on-https-867162/)

Spuddy 03-08-2011 04:41 AM

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)?

bathory 03-08-2011 05:52 AM

Hi

Search for:
Quote:

php_flag engine off
in a .htaccess in those directories, or in apache2.conf

Regards

Spuddy 03-08-2011 06:03 AM

Quote:

Originally Posted by bathory (Post 4282609)
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

Spuddy 03-08-2011 06:17 AM

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

bathory 03-08-2011 06:27 AM

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

Spuddy 03-08-2011 06:39 AM

Quote:

Originally Posted by bathory (Post 4282641)
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,

bathory 03-08-2011 07:11 AM

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

Spuddy 03-08-2011 08:31 AM

Quote:

Originally Posted by bathory (Post 4282678)
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.

bathory 03-08-2011 09:09 AM

May I ask why you marked the thread Solved?

Spuddy 03-08-2011 10:10 AM

Quote:

Originally Posted by bathory (Post 4282811)
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.


All times are GMT -5. The time now is 12:21 AM.