[PHP] 4.3.10 failure

2004-12-26 Thread PaulWB

There is nothing on the website about the failed release of 4.3.10,  I 
don't know how many of us have had to back out from this update but it is 
creating problems out in the wild.

The problems with 4.3.10 need to be identified and resolved, there is a 
critical bug in 4.3.10 that consumes large amounts of system resources.

My advise to everyone is not to install this version,  the problems is 
creates are worse than the ones it fixed,  a website with a few security 
wholes is better than no website.

read(6, \1\0\0\r, 4)  = 4
read(6, \376, 1)  = 1
--- SIGPROF (Profiling timer expired) @ 0 (0) ---
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={120, 0}}, NULL) = 0
rt_sigaction(SIGPROF, {0xb7708830, [PROF], SA_RESTART}, {0xb7708830, 
[PROF], SA_RESTART}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, 
-1, 0) = 0xb7249000
munmap(0xb7249000, 749568)  = 0
munmap(0xb740, 299008)  = 0
mprotect(0xb730, 135168, PROT_READ|PROT_WRITE) = 0
open(/local/logs/php, O_WRONLY|O_APPEND|O_CREAT, 0666) = 7
fstat64(7, {st_mode=S_IFREG|0777, st_size=58066806, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0xb7448000
fstat64(7, {st_mode=S_IFREG|0777, st_size=58066806, ...}) = 0
_llseek(7, 58066806, [58066806], SEEK_SET) = 0
time([1103877334])  = 1103877334
write(7, [24-Dec-2004 19:35:34] PHP Fatal..., 142) = 142
close(7)= 0
munmap(0xb7448000, 4096)= 0
chdir(/)  = 0
futex(0xb7e76620, FUTEX_WAIT, 2, NULL unfinished ...

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


[PHP] 4.3.7 array serialize problem

2004-12-26 Thread pf

Hi!
Have PHP 4.3.7, magic_quotes_gpc = On
Have a multidimensional array made from values from a POST form.
It addslashes() every field of the form as expected, like (') = (\'),
etc.
When I searialize the array to put it into a mysql db it seems to fail
to describe the string lenght of values with the (') character, like
this:
$arr['PestName']=a'cqua, it results the following in the serialized
string stored in the db:
a:1:{i:1;a:5:{s:8:PestName;s:7:a'cqua
note that a'cqua is not 7 chars lenght, but 6.
The problem is when I try to recover the array with unserialize(), it
fails, returning false. It is obvious that php is counting the (\)
character when serializing the string, but it stores it without it in
the db, so when it tries to recover the array, it fails.
Is this a known bug? Are there any workarounds you know?

Thanks a lot in advance.

Hernan

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



Re: [PHP] 4.3.7 array serialize problem

2004-12-26 Thread Jason Wong
On Sunday 26 December 2004 16:41, [EMAIL PROTECTED] wrote:

 Have PHP 4.3.7, magic_quotes_gpc = On
 Have a multidimensional array made from values from a POST form.
 It addslashes() every field of the form as expected, like (') = (\'),
 etc.
 When I searialize the array to put it into a mysql db it seems to fail
 to describe the string lenght of values with the (') character, like
 this:
 $arr['PestName']=a'cqua, it results the following in the serialized
 string stored in the db:
 a:1:{i:1;a:5:{s:8:PestName;s:7:a'cqua
 note that a'cqua is not 7 chars lenght, but 6.
 The problem is when I try to recover the array with unserialize(), it
 fails, returning false. It is obvious that php is counting the (\)
 character when serializing the string, but it stores it without it in
 the db, so when it tries to recover the array, it fails.
 Is this a known bug? Are there any workarounds you know?

addslashes() is supposed to be applied to the value of the column (field). In 
this case the value is the finished serialized array. In other words 
serialize() then addslashes(). Also you ought to be using 
mysql_real_escape_string() rather than addslashes().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Lonesome?

Like a change?
Like a new job?
Like excitement?
Like to meet new and interesting people?

JUST SCREW-UP ONE MORE TIME!!!
*/

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



[PHP] Using PHP to send file through a http pipe?

2004-12-26 Thread Jack
I was wondering if I could get some help on a minor problem I have.
Here's the deal I have set up on my system.

http://ftp.brajah.com/ 

I created this simple little interface to list files and directories in the
public ftp folder. The only problem is, I had to move the whole directory to
my web site just to allow people to download the file. (ie:
(site)/ftp/atcommand.txt )

What I want to do is have a file (like get.php) which will read the file on
the drive, and then transfer it through to the client on the browser. (ie:
get.php?file=/atcommand.txt )

Is there a simple way to do this while reducing security concerns? (Ie:
reading ../../../../../etc/passwd )

--Jack

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



[PHP] snmp nodes

2004-12-26 Thread arun parajuli
I am trying to get object data from a cisco AS5300 universal gateway
through snmp.
 i am using the getsnmp,walsnmp etc functions of php.
my proble is.
  i want to get cisco data using node address 1.3.6.1.4.1.9( when we
start from the root of the tree)  but php starts  to look from the
MIB node and hence says  no object with the specified id exixts.

please suggest me a way to make php start from the root of the tree,
not theMIB node.

arun

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



Re: [PHP] getting home directory path

2004-12-26 Thread Greg Donald
On Sat, 25 Dec 2004 15:36:05 -0500, Sebastian
[EMAIL PROTECTED] wrote:
 how do i get the path to my home directory..
 
 eg, /usr/home/

$_SERVER['home']


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] Interfaces and Access Levels

2004-12-26 Thread Gerard Samuel
I would like bar::do_something_internal() to have an access level of 
*private*
But this would fail, as the interface can only have *public* methods.
Is there a way to get bar::do_something_internal() to be private?
Or am I SOL, and it has be public?
Thanks

interface foo
{
function do_something_internal();
}
class bar implements foo
{
   private function do_something_internal()
   {
   // I would like this to be private
   }
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [PHP-DB] what is wrong with my code.. please help

2004-12-26 Thread S Kumar


Dear group, 
 I am trying to query my db and print the results. 

 when i execute my script, i am not getting any
result
 except a blank page. can any one please help me what
 is going wrong with my script. 
 
 Script:
 
 $conn = pg_connect(user = $user dbname = $dbname
 host
 = $host password = $pass);
 if (!$conn)
 {
 echo('could not establish connection with
 database br');
 exit;
 }
 $sql = select * from experiment;
 $sth = pg_exec($connect,$sql)
 if (! $sth){
 die(Can't execute query.pg_errormessage());
 }
 
 for($i = 0,$j = pg_numrows($sth);$i  $j;$i++){
 $ar = pg_fetch_row($sth,$i);
 foreach($ar as $col){
 print $col ;
 }
 print \n;
 }
 
 ?
 
 thank you in advance

 kumar




__ 
Do you Yahoo!? 
Send holiday email and support a worthy cause. Do good. 
http://celebrity.mail.yahoo.com

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



Re: [PHP] Using PHP to send file through a http pipe?

2004-12-26 Thread Curt Zirzow
* Thus wrote Jack:
 
 What I want to do is have a file (like get.php) which will read the file on
 the drive, and then transfer it through to the client on the browser. (ie:
 get.php?file=/atcommand.txt )
 
 Is there a simple way to do this while reducing security concerns? (Ie:
 reading ../../../../../etc/passwd )

This will do the trick:

  http://php.net/realpath


$file = $_GET['file']; /* ../../../etc/passwd */

/* make sure its absolute. */
if ($file{0} != '/') {
  $file = '/' . $file; /* /../../../etc/passwd */
}

$file = realpath($file);   /* /etc/passwd */

/* just to be safe make it relative */
$file = substr($file, 1);  /* etc/passwd */


/* and prefix your ftp path: */
$thefile = '/path/to/ftp/root/' . $file;


Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] handling large files w/readfile

2004-12-26 Thread Sebastian
i'm working on a app which output files with readfile() and some headers..
i read a comment in the manual that says if your outputting a file php will
use the same amount of memory as the size of the file. so, if the file is
100MB php will use 100MB of memory.. is this true?

if it is, how can i work around this?

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



Re: [PHP] A serious bug? or operator gives out diffferent results depending on order of operands

2004-12-26 Thread Rory Browne
I think what Jose is trying to say, is that because 'or' has a lower
precidence than =, you are interpreting the expression wrong.

$b1 = is_null($x) or ($y  5);

is the same as 
($b1 = is_null($x)) or ($y  5)
This assigns the value of is_null($x) to $b1, regardless of the result
of ($y  5). It's shorthand for

if( !($b1 = is_null($x)) ){
($y  5);
} 

similarly 

$b2 = ($y  5) or is_null($x);

assigns $b2 to ($y  5), or in this case true(since $y == 10). If ($y
 5) returned false, ie if $i = 5, then it would call the function
is_null($x). In this case calling the function is_null() is pointless,
since you aren't using the result.

What I think you are looking for is either
$b2 = (($y  5) or is_null($x)); // whole thing right of = enclosed in brackets

or 

$b2 = ($y  5) || is_null($x); // '||' has higher precidence than 'or'



On Fri, 24 Dec 2004 16:47:42 -0300, Jose M.Herrera
[EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Bogdan Ribic wrote:
 | Here's a little test script:
 |
 | 
 | $x = 2;
 | $y = 10;
 |
 | $b1 = is_null($x) or ($y  5);
 | $b2 = ($y  5) or is_null($x);
 
 Yes, of course.
 Your code or example, is just like:
 
 ( $b1 = is_null($x) )  or ( $y  5  ) ;
 ( $b2 =  ($y  5)   )  or  is_null($x) ;
 
 The  has more precedence than =, or it has a very low precedence.
 Then, $b1 = false and $b2 = True... that's ok! :P
 
 You example, must have been:
 
 $b1 = (   ( is_null($x) )  or ( $y  5  ) );
 $b2 = (   ( $y  5  )  or ( is_null($x) ) );
 
 I this example the value of $b1 is all between the parenthesis (explicitly).
 
 Bye!
 
 - --
 Jose Miguel Herrera M.  -  User #246070 counter.li.org
 Est.Ing.Civil Informatica - UTFSM
 Valparaiso, Chile -  http://www.inf.utfsm.cl/~jherrera
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.2.4 (GNU/Linux)
 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
 iD8DBQFBzHJdl/j2VHFHn8wRArZdAKCJbv8W54vlpeinK1hMF3xEttjuiACeIIUs
 63OX2bn+h9zLUDHhSvSTr/M=
 =3vfi
 -END PGP SIGNATURE-
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] handling large files w/readfile

2004-12-26 Thread Heilig \(Cece\) Szabolcs
Hello!

 i'm working on a app which output files with readfile() and some headers..
 i read a comment in the manual that says if your outputting a file php
 will
 use the same amount of memory as the size of the file. so, if the file is
 100MB php will use 100MB of memory.. is this true?

 if it is, how can i work around this?

Do not use readfile() or file_get_contents() to read
the full file in one step. Read file in smaller chunks
to a buffer variable whith fread() and output that
immediately in the cycle. And again and again...
You can read terrabytes of data and utput them, the
amount of memory needed is based on your buffer size.

-- 
=
Heilig (Cece) Szabolcs - [EMAIL PROTECTED] - http://www.phphost.hu
=

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



Re: [PHP] handling large files w/readfile

2004-12-26 Thread Raditha Dissanayake
Sebastian wrote:
i'm working on a app which output files with readfile() and some headers..
i read a comment in the manual that says if your outputting a file php will
use the same amount of memory as the size of the file. so, if the file is
100MB php will use 100MB of memory.. is this true?
 

I did a comparision study of readfile() and related functions you will 
see that results at http://www.raditha.com/wiki/Readfile_vs_include
What I discovered was that require,include() and file_get_contents() 
would consume more memory than the file size. Not so with readfile or 
fpasstru


if it is, how can i work around this?
 

go ahead and use readfile.

--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] MP3s

2004-12-26 Thread Richard Lynch
GH wrote:
 I am working on a PHP based website and would like to offer media to
 my visitors... I have the Audio in WMA and MP3 formats... I would like
 to know how I could get them to Stream? inline... using PHP any
 advice would be greatfully appreciated

Having done this (a lot) I'll add some notes to the fine answers already
provided.

#1. It's .m3u not .m3a :-)

#2. I have NO IDEA if putting WMA files in .m3u playlists works, and don't
care, because .wma files suck acoustically. :-) You're on your own for the
whole WMA thing, though most of what was said probably applies to the WMA
files and their corresponding streaming mechanism, because MS probably
just stole the ideas from MP3/M3U anyway.

#3. You can also put MULTIPLE .mp3 URLs in a single .m3u file to generate
a playlist. Way cool.

#4. As always, some browsers (IE) suck worse than others with rich media,
and you will want to force your URL to end in .m3u in the link you provide
so they will do the right thing with your PHP-generated M3U playlist. 
Something like http://example.com/playlist.php/bogus.m3u should do the
trick.  I go even farther, and use .htaccess with ForceType to get Apache
to treat 'playlist.m3u' as a PHP file, so my URL looks like
http://example.com/playlist.m3u so there is NO CHANCE of allowing the
stupid browser to screw up.

#5. Your web server must be configured to know the correct mime-type of
.m3u files.  In the old days, if you (or your host) had altered their
mime-type list in any way, the fresh install of Apache wouldn't update it,
and then they'd maybe have this really old icky list of mime-types which
did not include .m3u.  Fortunately, you could use http://php.net/header to
force the Content-type to be audio/mpeg-url which most browsers know is
MP3 playlist.

#6. You can also include #EXTM3U entries with the playlist for some MP3
players to know the artist/album from which the music came.  See URLs
below for example output.

#7. If you want to, you can also use the pretty cool PHP ID3 library to
dynamically pre-pend ID3v2 tags to your MP3s to include copyright, artist
info, and even thumbnail images to go with your MP3s.  I've done that at
http://uncommonground.com with mixed results -- Most players ignore the
extra data, a few display it.  At least none of them seem to choke on
it...  Google for ID3v2 PHP and it should turn up.

If anybody has read this far and wants to give me feedback OFF-LIST on the
efficacy of the ID3v2 parts working or not in your player/platform, I'd
sure appreciate it:
http://uncommonground.com
has Hi-Fi and Lo-Fi for your listening pleasure.

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



Re: [PHP] A serious bug? or operator gives out diffferent results depending on order of operands

2004-12-26 Thread Richard Lynch
Bogdan Ribic wrote:
 $b1 = is_null($x) or ($y  5);
 $b2 = ($y  5) or is_null($x);

To add to what has been posted already:

If 'or' isn't what you want '||' probably *IS* what you want.

Watch out though -- Sometimes even the precedence of '||' isn't as
high/low as I hoped, and if in doubt, use parentheses to force things to
happen in the order you want.

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



Re: [PHP] How do I underline a string using php and fonts?

2004-12-26 Thread Richard Lynch
Brent Clements wrote:
 I have always wondered this and maybe you guys can help.

 How do I underline a bit of text using True Type Fonts?

 Right now, I am creating imagelines but I don't think that's the most
 efficient way of doing it.

 Anybody know how to do underlines but using the font itself?

I believe the User Contributed Notes in the on-line manual include some
references to additional arguments in the various font/text drawing
functions that will do things of this nature.

I don't promise that underlining is there, or that it will work.

You're going to have to end up reading the documentation not only of PHP,
but also of the underlying TrueType library.

NOTE:  It may be that TrueType won't do it, but FreeType or PostScript
will, and that switching is an option for you. Or not.

NOTE:  If you are happy with the look and code readability you have, I
seriously doubt that imageline is that much slower than some 'underline'
feature of the TrueType library, unless you are calling imageline a *LOT*
of times...  So you may want to focus your efforts elsewhere unless you're
just bored or the code is unreadable.

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



Re: [PHP] Any bright solution for my problem?

2004-12-26 Thread Richard Lynch
QT wrote:
 I have a database with thousands records. And every minutes I am selecting
 50 rows from that database and send some data to another web url according
 sellected 50 rows.

 Whenever, my script finish job in one minute, I have no problem. Because
 after each transaction, I am uptading one of the rows field as a uesd.

If you actually have MySQL transactions, you should be able to wrap the
entire process in a single transaction, and it should work -- assuming
MySQL transactions pass the whole ACID test...  You'll have to read the
MySQL manual and understand ACID, which I only grok as I read it, not at
all times, or I'd just tell you what you need to know.  Sorry.

 BUT! if my script can not finish sending data to another url due to low
 speed connection or such a problem. On the next minute, same script runs
 automaticlay and sellecting another 50 rows which are not marked by
 used.

 In this case, some times these two running acripts are sellecting same
 rows
 due to, old one haven't marked as a used for sellected rows.

 Is there any way, to put flag or something like that, when sellecting rows
 with php and mysql?

Ah.

Given the problem you are facing, of a slow connection, you probably don't
want to tie up the whole table while running your script with a
transaction in the first place -- MySQL still does a table-level lock,
right?...  Maybe not.  Again, you'd have to read the MySQL docs carefully,
and be sure your version of MySQL matches, to see if they do row-level
locking.

Without row-level locking, your other scripts will wait for the slow
connection to release the whole table from its locked state.

That would probably be bad for most applications.

Here is what I would try if I were you:

//Possibly START a MySQL transaction HERE:
$query = select table_id from your_table where not status = 'used' limit
50;
$selected = @mysql_query($query, $connection) or
trigger_error(@mysql_error($connection) .  $query, E_USER_ERROR);
$selected_ids = array();
while (list($id) = @mysql_fetch_row($selected)){
  $selected_ids[] = $id;
}
$selected_ids_sql = implode(', ', $selected_ids);
$query = update your_table set status = 'used' where table_id in
($selected_ids_sql);
$used = @mysql_query($query, $connection) or
trigger_error(@mysql_error($connection) .  $query, E_USER_ERROR);
//END the transaction started above here.

//*NOW* go ahead and get the stuff you want from your selected records
//and send them off to that slow connection:
$query = select fields, you, really, want from your_table where table_id
in ($selected_ids_sql) ;
$data = @mysql_query($query, $connection) or
trigger_error(@mysql_error($connection) .  $query, E_USER_ERROR);
while (list($fields, $you, $really, $want) = @mysql_fetch_row($data)){
  //Send this row to the slow connection
}

By dealing with *ALL* the rows at once when you first SELECT them, and
then doing an UPDATE on *ALL* the rows at once right away, you can keep
the other scripts from getting confused about which records are 'used'.

If you wrap just that part of the code in a MySQL transaction, you make it
virtually 100% safe [*] for the other scripts.

Most importantly, by pulling the SELECT and UPDATE out, you can handle the
'used' attribute in a transaction *quickly* without bogging down your
application waiting for that slow connection or even just getting all the
data from MySQL to PHP.  You really only care about the ID field (assuming
you have one) and the 'used' status in terms of speed and in terms of
tracking which records were 'sent' probably.

This all assumes that you don't care if the slow connection gets its
records *AFTER some other fast connection gets the next 50 records...  If
that's not what your application needs, DON'T DO THIS. :-)

[*] NOTE:
The transaction is 100% safe, but if your slow connection dies, you've got
a bunch of records marked 'used' that were *NOT* really 'used' because the
script died after you marked them 'used'

Hopefully, that's a fairly rare occurence, right?

Since it is rare, if you can write your code to DETECT that the slow
connection died, and the records you tried to send didn't really get sent,
in that last loop, you can update a single record's 'used' setting to put
it back to 'unused' (or whatever you call it) if it fails to be sent.

So the basic algorithm is:

BEGIN TRANSACTION
  SELECT 50 ids
  UPDATE those 50 ids as 'used' in ONE query
END TRANSACTION
[the above should happen about as fast as PHP/MySQL can go]
SELECT actual data for selected 50 ids
send data to client
if a record fails to send, re-set status to not be 'used' so it can get
sent in a later batch.

The down-side is that faster connections will get records out of
sequence while the slower connection is still chugging away trying to
process the records that are earlier in your sequence.  In most
applications of this nature, that's okay.

If that's not okay, this is entirely the wrong algorithm to use, and you
need to wrap the whole thing in a TRANSACTION 

[PHP] Re: negative numbers

2004-12-26 Thread Richard Lynch
I've managed to delete the original post, so apologies in advance if I got
the Subject wrong and/or am missing the threading headers.

Plus, this post isn't even strictly necessary, and could be construed as
pedantic.  Oh well.

To change -40 to 40, http://php.net/abs is probably the best answer from a
code maintenance point of view.

If, however, you need to do this in a very tight loop, and performance is
an issue, and if you are certain that the number *IS* negative, you could
also do:

$x = - $x;

which would be faster than the abs() function.

This performance difference would be moot in *MOST* cases, but could be
important to the original poster, I suppose.

If you want to mimic the behaviour of abs (allowing for positive numbers)
and performance was an issue, that:
$x = ($x  0) ? - $x : $x;

is most likely faster than abs()

Don't do this just to be faster because faster is better though.  Code
maintenance and abs() win over faster except in really dire straits on
this one.

YMMV. NAIAA. IANAL. TANSTAAFL.

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



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

2004-12-26 Thread Richard Lynch
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



Re: [PHP] Help with code

2004-12-26 Thread Burhan Khalid
karl james wrote:
 
I have since updated it.
And I am having issues with a function I suppose.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in
/home/virtual/site38/fst/var/www/html/php/wrox_php/movie_details.php on line
119
http://www.theufl.com/php/wrox_php/movie_details.php
This error (obviously) means that there is a problem with your query, 
which is why mysql_query() did not return a result resource.

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


Re: [PHP] Re: [PHP-DB] what is wrong with my code.. please help

2004-12-26 Thread Burhan Khalid
S Kumar wrote:
Dear group, 
 I am trying to query my db and print the results. 

 when i execute my script, i am not getting any
result
 except a blank page. can any one please help me what
 is going wrong with my script. 
 
 Script:
 
 $conn = pg_connect(user = $user dbname = $dbname
 host
 = $host password = $pass);
 if (!$conn)
 {
 echo('could not establish connection with
 database br');
 exit;
 }
 $sql = select * from experiment;
 $sth = pg_exec($connect,$sql)
You are missing ; after the above two lines.
Please use a php syntax aware editor to avoid these problems.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] emailing files...

2004-12-26 Thread Gregory Machin
Hi 
I would like to email some log files as attachments, all the examples
use an html page with a file input box, how can i do it without the
file input box.

Many Thanks 

-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
+27 72 524 8096

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