Browser downloads a file instead of displaying Gallery

tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 05:11

Is there any reason why this is happening? I type my address in and Firefox wants to download a file. It is a randomly named.

In IE, it loads it but it has issues correctly displaying the page and once even crashed my browser. (mshtml.dll was what crashed)

Any ideas? I could just reinstall Apache2 and PHP 4; but that would be something I would rather avoid.

Cheers,
JR

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Mon, 2004-08-30 05:24

Sounds like perhaps apache isn't properly configured to serve php files? Since you didn't really post any information about the system that apache2 and php are on... there isn't much I can say besides make sure php is actually working :)

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 05:31

I guess that might be the problem, I'll check it right now and post back

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Mon, 2004-08-30 05:32

Sounds like a plan, stan :)

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 06:07

well it is stillacting up, fresh install of php..

If I type my domain then /main.php all works well

but if I just type the domain, it doesnt automatically load the index.php

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 06:10

here is what is in the file it downloads...

<?php
/*
* $RCSfile: index.php,v $
*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2003 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* @version $Revision: 1.5 $ $Date: 2003/04/26 09:27:36 $
* @package Gallery
* @author Bharat Mediratta <bharat@menalto.com>
*/

header('Location: main.php');
?>

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Mon, 2004-08-30 14:50

It would still help a ton if you could post stuff about your system eh?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2004-08-30 15:28

Look for the DirectoryIndex line in your httpd.conf and add index.php in the list.

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 15:40

SOrry,

It is Apache 2.0.50 on Win2k3.
PHP 4.3.8, MySQL 4.0.20d
AMD Athlon 2200+, 768MB PC2100 RAM

Gallery 1 ran great but 2 (which I love) just craws or times out. I need to restart the Apache service to get it going again.

Everything was working great but I was having an issue with gallery2 just deciding to stop working every so often. A shutdown then Start of the Apache service wolk fix it, but it was DREADFULY slow. I thought that PHP might have something to do with it (just guessing) so I uninstalled and reinstalled and now my server can process PHP scripts but it isnt reading the index file.

ANd yes index.php is in the conf

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2004-08-30 17:03
tehJR wrote:
well it is stillacting up, fresh install of php..

If I type my domain then /main.php all works well

but if I just type the domain, it doesnt automatically load the index.php

I had the same problem, your request motivated me to find a solution.

set following setting in your apache2 conf:
UseCanonicalName Off

or

set the ServerName to a valid domain name or to the valid ip of the server, i.e.
ServerName 192.168.123.123

related config comments:

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make 
# redirections work in a sensible way.
#
#ServerName www.example.com:80

#
# UseCanonicalName: (new for 1.3) Determines how Apache constructs self-referencing 
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off
 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 17:46

Everything looked good there but I changed it to my ip then back and now I am getting the "Test Page for Apache" page, and again,
If I type index.php in or main.php it works.

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Mon, 2004-08-30 17:47

also, sometimes gallery2 doesnt display the layout properly when you load the page. Sometimes a refresh will fix this and it the loads the layout right.

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Tue, 2004-08-31 08:46

just an update,

Apache still makes firefox download that random file EVEN with nothing in the htdocs folder.

 
tehJR

Joined: 2004-06-14
Posts: 12
Posted: Tue, 2004-08-31 14:28

*bump

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Thu, 2004-09-02 05:43

This sounds like a pure Apache configuration issue. What's the url to your server? We can probably sort it out a lot quicker if we can see it happening directly.

 
fubari
fubari's picture

Joined: 2007-04-02
Posts: 2
Posted: Mon, 2007-04-02 18:11

I'm having a similar issue.
You can see it here: http://www.bluroom.com/pix/gallery2/

While it could be apache or PHP I find this odd because:
1. Apache is properly serving PHP pages from the ~/gallery2/install/ subdirectory.
2. Apache is properly serving PHP pages from my gallery1x directory, which is adjacent to the gallery2 directory in the document root and has the same permissions.
3. hello.php (php config page) runs ok from the same directory. http://www.bluroom.com/pix/gallery2/hello.php
4. Apache DirectoryIndex directive is set, and PHP memory is up at 32mb.
5. CanocialName is OFF

Any suggestions?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2007-04-03 18:08

any errors in your apache error log?

 
MntlyNSane

Joined: 2005-06-08
Posts: 4
Posted: Fri, 2007-04-06 13:00

I am having a very similar issue. However my problem happens when I attempt to add images to an album.

I can create albums all day long, but when actually trying to add images (from local server, from web page, etc) it tries to save main.php instead of opening it.

Apache 1.3.37 (Unix)
PHP: 5.1.6
MySQL: 4.1.21
Host: Siteground

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2007-04-06 16:52

MntlyNSane

Please create a new forum topic in the support -> troubleshooting forum and include as much detail about your case as possible.
Thanks.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
fubari
fubari's picture

Joined: 2007-04-02
Posts: 2
Posted: Sat, 2007-04-07 19:26

My apache logs are of no use. I tried retrieving the page via curl and get an empty response. This is consistent with the fact the main.php file the browser tries to download is blank. It seems apache doesn't like this PHP file...whereas other php pages in the same directory are executed ok.

curl -v bluroom.com/pix/gallery2/main.php
* About to connect() to bluroom.com:80
* Connected to bluroom.com (207.97.197.206) port 80
> GET /pix/gallery2/main.php HTTP/1.1
User-Agent: curl/7.10.6 (i386-redhat-linux-gnu) libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.3
Host: bluroom.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

* Empty reply from server
* Connection #0 left intact
curl: (52) Empty reply from server
* Closing connection #0