Re: Firefox/IE (sometimes) wants to download .php files from my Apache2 server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rinke Hoekstra wrote:
> I have a rather odd problem. Since a few days, my otherwise perfect SuSe
> 9.0 Apache2 server started to do some funny stuff.
> In general, php works fine, and I can do anything I want... after a
> little while Firefox/IE starts asking me whether I want to download/run
> the php file instead of rendering it in the browser.

When this does happen, do you get your PHP source if you download it, or
does PHP actually get invoked, and you get the HTML output?

Try it several times, as there may be timing issues, and you may get
different results based on weird browser behaviour with respect to asking
for a URL *twice* when prompting for a download.

EG: browser asks for URL, triggers bug, asks you if you want to download,
asks for URL again but doesn't trigger bug and gets output you expect.

> Sometimes even this doesn't happen, and I just get a regular Apache2
> page stating 'Object not found' (with accompanying lines in my server's
> error_log). A few minutes later, everything works fine again.
> (restarting apache also tends to help)

Sounds like something is killing the PHP Module (or is it CGI?) in your
server...

> I think the biggest problem is that it is intermittent: sometimes it
> works, and sometimes it doesn't... no way for me to diagnose it.
> weird.

Try throwing Apache Benchmark (ab) at it, or some other load-inducing
software.

My hypotheses is that it's happening under load because...

Your OS has a limit on the number of processes that can run, and Apache is
going okay, but PHP as CGI is hitting that wall.  If you are running PHP
as Module, and not CGI, this hypothesis is obviously bogus.

Some module in PHP is not thread-safe, and your PHP Module is dying out,
but Apache is managing to sort of stagger along...  Seems unlikely,
however...

It's also possible that some third piece of software is somehow killing
PHP threads or something, but that would be tough to do...

You might also be hitting some other sort of limit and some bad coding. 
For example, if your Apache/MySQL/PHP setup limits the number of MySQL
connections (see /etc/my.cnf) to *FEWER* than the number of Apache
children (see httpd.conf) and if you PHP code just sort of dies with no
output when MySQL can't be connected to (find your mysql_connect code in
PHP) then you could maybe get this kind of behaviour from some browsers
when they get nothing back from the web server because your code sent
nothing out.  MySQL should have *more* connections available than you have
Apache children.  Just a few more, so you can use the 'mysql' monitor
program even if every Apache child is using a MySQL connection.  This is
most obvious when you use mysql_pconnect, since at that point, each Apache
child ends up with its own MySQL connection, for all intents and purposes.

You may also want to be more specific in your versions of Apache and PHP
if you re-post after more testing.

Hopefully you've got a Development Server you can test this all on...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux