OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 26 Jun 2004 22:51:50 -0000 Issue 2843

php-general-digest-helplists.php.net
Date: Sat Jun 26 2004 - 17:51:50 CDT


php-general Digest 26 Jun 2004 22:51:50 -0000 Issue 2843

Topics (messages 189069 through 189106):

image upload woes
        189069 by: Edward Peloke
        189072 by: Jay Blanchard
        189101 by: Curt Zirzow

Re: string function that adds before and after
        189070 by: Matt M.
        189073 by: Gabe
        189077 by: Philip Olson
        189078 by: Gabe
        189090 by: Richard Harb
        189100 by: Curt Zirzow

Re: mail sent but not received?!
        189071 by: Josh Close
        189098 by: Curt Zirzow

Re: a stupid question
        189074 by: Randy C Boland
        189075 by: Philip Olson
        189079 by: Blake Schroeder

socket_set_block undefined
        189076 by: Josh Close
        189080 by: Philip Olson
        189081 by: Josh Close
        189082 by: Josh Close
        189083 by: Philip Olson
        189084 by: Josh Close
        189102 by: Curt Zirzow

imagecopyresampled, GD
        189085 by: Chris
        189088 by: Marek Kilimajer
        189089 by: Chris
        189105 by: Curt Zirzow

word count on record insertion
        189086 by: Chris
        189087 by: Matt M.
        189091 by: Geethanandh Kandasamy

Re: MYSQL Query results in pages
        189092 by: Geethanandh Kandasamy

Handling Code Continuation
        189093 by: gohaku
        189094 by: Greg Donald
        189095 by: Marek Kilimajer
        189103 by: Curt Zirzow

Re: malloc() failure - single function document
        189096 by: Curt Zirzow

Re: Understanding behavior of 'directories below files'
        189097 by: Curt Zirzow
        189106 by: Marek Kilimajer

Re: How to force mod_php to load php.ini ?
        189099 by: Curt Zirzow

Re: TIFF images
        189104 by: Curt Zirzow

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


I have code which attempts to upload some files and create thumbnails. The
same code on one server works ok, the same code on another server throws an
error everytime I hit submit that says "The document contains no data"...it
appears to be a javascript error. It is not an error that I am throwing.
Has anyone ever had this problem?

Thanks,
Eddie

 WARNING: The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed. This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law. It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing. You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this
communication in error, please notify HIPAAechoman.com by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.

attached mail follows:


[snip]
I have code which attempts to upload some files and create thumbnails.
The same code on one server works ok, the same code on another server
throws an error everytime I hit submit that says "The document contains
no data"...it
appears to be a javascript error. It is not an error that I am
throwing. Has anyone ever had this problem?
[/snip]

I am sure that someone has had a problem like this, but if you believe
it to be a JavaScript problem why would you not ask a JavaScript list?

attached mail follows:


* Thus wrote Edward Peloke:
> I have code which attempts to upload some files and create thumbnails. The
> same code on one server works ok, the same code on another server throws an
> error everytime I hit submit that says "The document contains no data"...it
> appears to be a javascript error. It is not an error that I am throwing.
> Has anyone ever had this problem?

diff -u otherserver:/usr/local/lib/php.ini /usr/local/lib/php.ini

> WARNING: The information contained in this message and any attachments is
> intended only for the use of the individual or entity to which it is

for some reason I'm always tempted to make some sort of comment
here.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


> There's a number of functions in PHP that will give me the position of
> the *first* instance of the matched string, but it doesn't look like the
> function would keep searching after the first match. Anyway, am I
> overlooking a function that already has the functionality that I'm
> searching for? Or does anyone have any ideas how I can accomplish this
> efficiently since my search strings can be quite long?

try this

preg_replace('/(weather)/i', "<strong>$1</strong>", 'This is the worst
weather ever. Weather around
here is terrible. ')

attached mail follows:


Matt M. wrote:

>>There's a number of functions in PHP that will give me the position of
>>the *first* instance of the matched string, but it doesn't look like the
>>function would keep searching after the first match. Anyway, am I
>>overlooking a function that already has the functionality that I'm
>>searching for? Or does anyone have any ideas how I can accomplish this
>>efficiently since my search strings can be quite long?
>
>
> try this
>
> preg_replace('/(weather)/i', "<strong>$1</strong>", 'This is the worst
> weather ever. Weather around
> here is terrible. ')

Thanks Matt. I think that will do the trick. Let me see if I
understand it correctly. the "i" will make the search case-INsensitive,
and the parenthesis around "weather" will store what it finds in the
variable $1? Is that right?

Thanks again, that was a big help.

attached mail follows:


> >>There's a number of functions in PHP that will give me the position of
> >>the *first* instance of the matched string, but it doesn't look like the
> >>function would keep searching after the first match. Anyway, am I
> >>overlooking a function that already has the functionality that I'm
> >>searching for? Or does anyone have any ideas how I can accomplish this
> >>efficiently since my search strings can be quite long?
> >
> >
> > try this
> >
> > preg_replace('/(weather)/i', "<strong>$1</strong>", 'This is the worst
> > weather ever. Weather around
> > here is terrible. ')
>
> Thanks Matt. I think that will do the trick. Let me see if I
> understand it correctly. the "i" will make the search case-INsensitive,
> and the parenthesis around "weather" will store what it finds in the
> variable $1? Is that right?

Also consider str_replace() as it's faster albeit case
sensitive. str_ireplace() exists in PHP 5. Just another
option, I'm surprised you didn't find it when looking
around strpos() and friends.

Your assumptions above are correct, sorry Matt for stepping
in! :) I prefer cold weather.

Regards,
Philip

attached mail follows:


Philip Olson wrote:

>>>>There's a number of functions in PHP that will give me the position of
>>>>the *first* instance of the matched string, but it doesn't look like the
>>>>function would keep searching after the first match. Anyway, am I
>>>>overlooking a function that already has the functionality that I'm
>>>>searching for? Or does anyone have any ideas how I can accomplish this
>>>>efficiently since my search strings can be quite long?
>>>
>>>
>>>try this
>>>
>>>preg_replace('/(weather)/i', "<strong>$1</strong>", 'This is the worst
>>>weather ever. Weather around
>>>here is terrible. ')
>>
>>Thanks Matt. I think that will do the trick. Let me see if I
>>understand it correctly. the "i" will make the search case-INsensitive,
>>and the parenthesis around "weather" will store what it finds in the
>>variable $1? Is that right?
>
>
> Also consider str_replace() as it's faster albeit case
> sensitive. str_ireplace() exists in PHP 5. Just another
> option, I'm surprised you didn't find it when looking
> around strpos() and friends.
>
> Your assumptions above are correct, sorry Matt for stepping
> in! :) I prefer cold weather.
>
> Regards,
> Philip

Thanks Philip. I did notice str_replace() but it didn't look like I
could use it without it actually replacing what it found instead of just
adding strings before and after it. Am I wrong?

attached mail follows:


-----Original Message-----
From: Gabe
Sent: Friday, June 25, 2004, 9:06:15 PM
> Philip Olson wrote:

>>>>>There's a number of functions in PHP that will give me the position of
>>>>>the *first* instance of the matched string, but it doesn't look like the
>>>>>function would keep searching after the first match. Anyway, am I
>>>>>overlooking a function that already has the functionality that I'm
>>>>>searching for? Or does anyone have any ideas how I can accomplish this
>>>>>efficiently since my search strings can be quite long?
>>>>
>>>>
>>>>try this
>>>>
>>>>preg_replace('/(weather)/i', "<strong>$1</strong>", 'This is the worst
>>>>weather ever. Weather around
>>>>here is terrible. ')
>>>
>>>Thanks Matt. I think that will do the trick. Let me see if I
>>>understand it correctly. the "i" will make the search case-INsensitive,
>>>and the parenthesis around "weather" will store what it finds in the
>>>variable $1? Is that right?
>>
>>
>> Also consider str_replace() as it's faster albeit case
>> sensitive. str_ireplace() exists in PHP 5. Just another
>> option, I'm surprised you didn't find it when looking
>> around strpos() and friends.
>>
>> Your assumptions above are correct, sorry Matt for stepping
>> in! :) I prefer cold weather.
>>
>> Regards,
>> Philip

> Thanks Philip. I did notice str_replace() but it didn't look like I
> could use it without it actually replacing what it found instead of just
> adding strings before and after it. Am I wrong?

I'd say it will do the job just fine if case sensitivity is not an
issue:

$word = 'weather';
$new = str_replace($word, "<strong>$word</strong>", $phrase);

... speaks for itself ;)

/rh

attached mail follows:


* Thus wrote Richard Harb:
> -----Original Message-----
> From: Gabe
> Sent: Friday, June 25, 2004, 9:06:15 PM
> > Philip Olson wrote:
>
> <lots of> ...
>
> I'd say it will do the job just fine if case sensitivity is not an
> issue:
>
> $word = 'weather';
> $new = str_replace($word, "<strong>$word</strong>", $phrase);
>
> ... speaks for itself ;)

I'm thinking to myself at this moment...

<style>
&weather { font-weight: bold }
</style>

It simply just would make the world a whole lot nicer :)

Do note, this is not a valid css tag, just a simple dream of mine.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Your message could have bounced or been rejected for some other reason, in
which case you wouldn't have recieved it, but it'll look like it's sent
fine.

-Josh

> -----Original Message-----
> From: Bing Du [mailto:bduiastate.edu]
> Sent: Friday, June 25, 2004 11:08 AM
> To: php-generallists.php.net
> Subject: [PHP] mail sent but not received?!
>
>
> Hi,
>
> I've been pulling my hair out over this problem for a while...
>
> ----------------
> <?php
> $msg = "Hi, this is a test";
> $to = "memy.edu";
> $sbj = "test message from my.edu";
>
> $rev = mail($to,$sbj,$msg);
>
> echo "mail from my.edu result is $rev";
> ?>
> --------------
>
> Since the result of the mail() returned is 1, the message
> should have been
> delivered fine. but I did not get anything. Where can I
> look for more
> clues of what the problem might be, like possible log, or turn on some
> debug level in php? I've also tried mail($to,$sbj,$msg, "-f
> memy.edu"),
> no workie either.
>
> Any help would be greatly appreciated!
>
> Bing
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


* Thus wrote Bing Du:
>
> $rev = mail($to,$sbj,$msg);
>
> echo "mail from my.edu result is $rev";
> ?>
> --------------
>
> Since the result of the mail() returned is 1, the message should have been
> delivered fine. but I did not get anything. Where can I look for more

Negative! $rev will simply let you know that your MTA (mail
transfer agent) accepted your message. The MTA will attempt to deliver
the message at its own will.

> clues of what the problem might be, like possible log, or turn on some
> debug level in php? I've also tried mail($to,$sbj,$msg, "-f memy.edu"),
> no workie either.

if the mail was unsucessfully delivered, and memy.edu is a valid
email then the email will get returned to memy.edu.

it gets more complicated than that but thats the jest of it.

>
> Any help would be greatly appreciated!

If you have access to you're maillog's then view those.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


That would work if aFunction was a variable - more less. It would
display the inner single quotes, so you'd really want:
echo "some text $aFunction some more text";

However, aFunction is, ironically, a function, so it needs to be a
function call.
echo "some text" . aFunction() . "some more text";

On Fri, 25 Jun 2004 10:09:42 -0500, Alicia Riggs
<alicia.riggsfedexkinkos.com> wrote:
>
> Your problem is the paren's
>
> echo "'some text' $aFunction 'some more text'";
>
> You need double quotes for the entire string, but single quotes around
> the text so it knows it is text.

attached mail follows:


>> I cant figureout the syntax please help
>>
>> echo "Some text".aFunction()."some more text";
>>
>> The function is not working.
>
> Your problem is the paren's
>
> echo "'some text' $aFunction 'some more text'";
>
> You need double quotes for the entire string, but single
> quotes around the text so it knows it is text.

This is very much incorrect, not sure where to begin
but please ignore this advice. A string is a string
is a string is a string:

  http://www.php.net/types.string

I'm 99% sure the problem is aFunction() is echoing
a value as opposed to returning one, this is a
common question answered here:

  http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order

If that doesn't answer your question then please
post the code.

Regarding the subject of this thread you should consider
asking smart questions by reading the following in its
entirety:

  http://www.catb.org/~esr/faqs/smart-questions.html

Very useful for all parties involved! :)

Regards,
Philip

attached mail follows:


Everyone

Thank you for all the great feedback. Since my function doesnt return
data it just echos it to the browser.

When I use this format it does not display correctly

echo "some text" . aFunction() . "some more text";

If I use the orginal code it displays fine.
echo "Some text";
aFunction();
echo "More text";

Thanks for all the help.

-B

Philip Olson wrote:

>>>I cant figureout the syntax please help
>>>
>>>echo "Some text".aFunction()."some more text";
>>>
>>>The function is not working.
>>>
>>>
>>Your problem is the paren's
>>
>>echo "'some text' $aFunction 'some more text'";
>>
>>You need double quotes for the entire string, but single
>>quotes around the text so it knows it is text.
>>
>>
>
>This is very much incorrect, not sure where to begin
>but please ignore this advice. A string is a string
>is a string is a string:
>
> http://www.php.net/types.string
>
>I'm 99% sure the problem is aFunction() is echoing
>a value as opposed to returning one, this is a
>common question answered here:
>
> http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order
>
>If that doesn't answer your question then please
>post the code.
>
>Regarding the subject of this thread you should consider
>asking smart questions by reading the following in its
>entirety:
>
> http://www.catb.org/~esr/faqs/smart-questions.html
>
>Very useful for all parties involved! :)
>
>Regards,
>Philip
>
>
>

attached mail follows:


I'm trying to use socket_set_block and php.net says (php4 >= 4.2, php5).

I'm using version 4.3.1 but I get this error

Fatal error: Call to undefined function: socket_set_block() in .....

Any idea why this is? Has the name changed or been something else?

socket_set_nonblock() work fine.

-Josh

attached mail follows:


> I'm trying to use socket_set_block and php.net says (php4 >= 4.2, php5).
>
> I'm using version 4.3.1 but I get this error
>
> Fatal error: Call to undefined function: socket_set_block() in .....
>
> Any idea why this is? Has the name changed or been something else?
>
> socket_set_nonblock() work fine.

Strange as the name has not changed and the function
requires nothing special (no IF block around it), here's
the source:

 http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715

Since socket_set_nonblock() exists you must have
the socket extension available so this is odd.
Are you sure this problem exists and it's not
something silly? Seems like an impossible problem
assuming your php source wasn't modified :)

Regards,
Philip

attached mail follows:


Well, here's the code i'm using. Let me know if I'm doing something silly.

if(!socket_set_nonblock($this->socket)){
        if($this->logging){ syslog(LOG_ERR, "Could not set socket to nonblock."); }
        exit();
}

//connection part goes here

if(!socket_set_block($this->socket)){
        if($this->logging){ syslog(LOG_ERR, "Could not set socket to block."); }
        exit();
}
if($this->loggging){ syslog(LOG_INFO, "Socket set to block."); }

.... and here's the error

Fatal error: Call to undefined function: socket_set_block()

-Josh

> -----Original Message-----
> From: Philip Olson [mailto:philipcornado.com]
> Sent: Friday, June 25, 2004 2:11 PM
> To: Josh Close
> Cc: PHP (E-mail)
> Subject: Re: [PHP] socket_set_block undefined
>
>
>
> > I'm trying to use socket_set_block and php.net says (php4
> >= 4.2, php5).
> >
> > I'm using version 4.3.1 but I get this error
> >
> > Fatal error: Call to undefined function:
> socket_set_block() in .....
> >
> > Any idea why this is? Has the name changed or been something else?
> >
> > socket_set_nonblock() work fine.
>
> Strange as the name has not changed and the function
> requires nothing special (no IF block around it), here's
> the source:
>
> http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715
>
> Since socket_set_nonblock() exists you must have
> the socket extension available so this is odd.
> Are you sure this problem exists and it's not
> something silly? Seems like an impossible problem
> assuming your php source wasn't modified :)
>
> Regards,
> Philip
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


also, i know socket_set_option() used to be socket_setopt(), that's why i
ask

-Josh

> -----Original Message-----
> From: Philip Olson [mailto:philipcornado.com]
> Sent: Friday, June 25, 2004 2:11 PM
> To: Josh Close
> Cc: PHP (E-mail)
> Subject: Re: [PHP] socket_set_block undefined
>
>
>
> > I'm trying to use socket_set_block and php.net says (php4
> >= 4.2, php5).
> >
> > I'm using version 4.3.1 but I get this error
> >
> > Fatal error: Call to undefined function:
> socket_set_block() in .....
> >
> > Any idea why this is? Has the name changed or been something else?
> >
> > socket_set_nonblock() work fine.
>
> Strange as the name has not changed and the function
> requires nothing special (no IF block around it), here's
> the source:
>
> http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715
>
> Since socket_set_nonblock() exists you must have
> the socket extension available so this is odd.
> Are you sure this problem exists and it's not
> something silly? Seems like an impossible problem
> assuming your php source wasn't modified :)
>
> Regards,
> Philip
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


Perhaps you have multiple PHP versions on your system? Like
an old CLI or CGI laying around somewhere? Maybe try checking
the PHP version in the code as well. If it's not that then
I have no idea.

Regards,
Philip

On Fri, 25 Jun 2004, Josh Close wrote:

> Well, here's the code i'm using. Let me know if I'm doing something silly.
>
> if(!socket_set_nonblock($this->socket)){
> if($this->logging){ syslog(LOG_ERR, "Could not set socket to nonblock."); }
> exit();
> }
>
> //connection part goes here
>
> if(!socket_set_block($this->socket)){
> if($this->logging){ syslog(LOG_ERR, "Could not set socket to block."); }
> exit();
> }
> if($this->loggging){ syslog(LOG_INFO, "Socket set to block."); }
>
>
>
> .... and here's the error
>
> Fatal error: Call to undefined function: socket_set_block()
>
> -Josh
>
> > -----Original Message-----
> > From: Philip Olson [mailto:philipcornado.com]
> > Sent: Friday, June 25, 2004 2:11 PM
> > To: Josh Close
> > Cc: PHP (E-mail)
> > Subject: Re: [PHP] socket_set_block undefined
> >
> >
> >
> > > I'm trying to use socket_set_block and php.net says (php4
> > >= 4.2, php5).
> > >
> > > I'm using version 4.3.1 but I get this error
> > >
> > > Fatal error: Call to undefined function:
> > socket_set_block() in .....
> > >
> > > Any idea why this is? Has the name changed or been something else?
> > >
> > > socket_set_nonblock() work fine.
> >
> > Strange as the name has not changed and the function
> > requires nothing special (no IF block around it), here's
> > the source:
> >
> > http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715
> >
> > Since socket_set_nonblock() exists you must have
> > the socket extension available so this is odd.
> > Are you sure this problem exists and it's not
> > something silly? Seems like an impossible problem
> > assuming your php source wasn't modified :)
> >
> > Regards,
> > Philip
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>

attached mail follows:


I want to get rid of the version on php in /urs/local, how do I do this?

There is no src to do a "make uninstall" from. I deleted some
file/directories, but when I do "php -v" it's still looking for the version
in /usr/local/bin instead of /usr/bin.

-Josh

> -----Original Message-----
> From: Philip Olson [mailto:philipcornado.com]
> Sent: Friday, June 25, 2004 3:21 PM
> To: Josh Close
> Subject: RE: [PHP] socket_set_block undefined
>
>
>
> That sounds about right :) After sending my first
> reply I realized it was the most likely reason, I
> can see why you went down the "name could have
> changed" track... I knew it wasn't the case as in
> PHP names were only changed to give proper names
> like socket_set_block as opposed to setsocketblock
> or whatever. Good luck :)
>
> Regards,
> Philip
>
>
>
>
> On Fri, 25 Jun 2004, Josh Close wrote:
>
> > I'm installing a new version right now. I found there was
> two cli versions,
> > when i typed
> >
> > /usr/bin/php -v
> >
> > i got version 4.1.2 so i'm reinstalling a new version.
> There was actually 3
> > versions of php on this box. how annoying.
> >
> > -Josh
> >
> >
> >
> > > -----Original Message-----
> > > From: Philip Olson [mailto:philipcornado.com]
> > > Sent: Friday, June 25, 2004 2:39 PM
> > > To: Josh Close
> > > Cc: PHP (E-mail)
> > > Subject: RE: [PHP] socket_set_block undefined
> > >
> > >
> > >
> > > Perhaps you have multiple PHP versions on your system? Like
> > > an old CLI or CGI laying around somewhere? Maybe try checking
> > > the PHP version in the code as well. If it's not that then
> > > I have no idea.
> > >
> > > Regards,
> > > Philip
> > >
> > > On Fri, 25 Jun 2004, Josh Close wrote:
> > >
> > > > Well, here's the code i'm using. Let me know if I'm doing
> > > something silly.
> > > >
> > > > if(!socket_set_nonblock($this->socket)){
> > > > if($this->logging){ syslog(LOG_ERR, "Could not set
> > > socket to nonblock."); }
> > > > exit();
> > > > }
> > > >
> > > > //connection part goes here
> > > >
> > > > if(!socket_set_block($this->socket)){
> > > > if($this->logging){ syslog(LOG_ERR, "Could not set
> > > socket to block."); }
> > > > exit();
> > > > }
> > > > if($this->loggging){ syslog(LOG_INFO, "Socket set to block."); }
> > > >
> > > >
> > > >
> > > > .... and here's the error
> > > >
> > > > Fatal error: Call to undefined function: socket_set_block()
> > > >
> > > > -Josh
> > > >
> > > > > -----Original Message-----
> > > > > From: Philip Olson [mailto:philipcornado.com]
> > > > > Sent: Friday, June 25, 2004 2:11 PM
> > > > > To: Josh Close
> > > > > Cc: PHP (E-mail)
> > > > > Subject: Re: [PHP] socket_set_block undefined
> > > > >
> > > > >
> > > > >
> > > > > > I'm trying to use socket_set_block and php.net says (php4
> > > > > >= 4.2, php5).
> > > > > >
> > > > > > I'm using version 4.3.1 but I get this error
> > > > > >
> > > > > > Fatal error: Call to undefined function:
> > > > > socket_set_block() in .....
> > > > > >
> > > > > > Any idea why this is? Has the name changed or been
> > > something else?
> > > > > >
> > > > > > socket_set_nonblock() work fine.
> > > > >
> > > > > Strange as the name has not changed and the function
> > > > > requires nothing special (no IF block around it), here's
> > > > > the source:
> > > > >
> > > > > http://lxr.php.net/source/php-src/ext/sockets/sockets.c#715
> > > > >
> > > > > Since socket_set_nonblock() exists you must have
> > > > > the socket extension available so this is odd.
> > > > > Are you sure this problem exists and it's not
> > > > > something silly? Seems like an impossible problem
> > > > > assuming your php source wasn't modified :)
> > > > >
> > > > > Regards,
> > > > > Philip
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>

attached mail follows:


* Thus wrote Josh Close:
> I want to get rid of the version on php in /urs/local, how do I do this?

This can be a long story.. but basically in normal conditions if
php is compiled with --prefix=/usr/local (by default) then you'll
find the php binary in /usr/local/bin/php and stuff in
/usr/local/lib/php*

And then depending on what and how you compiled you're webserver,
an extra library can be anywhere, usually decided by you're
webserver's configuration

>
> There is no src to do a "make uninstall" from. I deleted some
> file/directories, but when I do "php -v" it's still looking for the version
> in /usr/local/bin instead of /usr/bin.

php's installation can get complicated and if you're not in a
controlled environment (aka a system package) you're going to have
to uninstall php manually.

You're 'php -v' issue can be easily solved by modifying your $PATH
environment.

look at `echo $PATH`

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Hi there, I've looked in many places but have not found any clues on how
to work around this problem.

I'm using imagecopyresampled to resize an image and crop part of it at
the same time. The area I need to crop, unfortunately, is sometimes a
float, which leads to my problem. imagecopyresampled does not accept
float values, and interpolate the images. (Well, technically it accepts
them, but just converts them to an integer internally)

The source image is 63x63 pixels ($rImg1). The destination image is
100x100 pixels ($rImg2).

I want to resize $rImg1 to 100.611x100.611, and place the center 100x100
square in $rImg2. The theoretical imagecopyresampled call is below.

imagecopyresampled($rImg2, $rImg1, -0.3055, -0.3055, 0, 0, 100.611,
100.611, 63, 63);

I realize the above code is incorrect, but it seemed the best way to
illustrate what I'm attempting to accomplish.

Any help would be greatly appreciated, thanks!

Chris

attached mail follows:


Chris wrote --- napísal::
> Hi there, I've looked in many places but have not found any clues on how
> to work around this problem.
>
> I'm using imagecopyresampled to resize an image and crop part of it at
> the same time. The area I need to crop, unfortunately, is sometimes a
> float, which leads to my problem. imagecopyresampled does not accept
> float values, and interpolate the images. (Well, technically it accepts
> them, but just converts them to an integer internally)
>
> The source image is 63x63 pixels ($rImg1). The destination image is
> 100x100 pixels ($rImg2).
>
> I want to resize $rImg1 to 100.611x100.611, and place the center 100x100
> square in $rImg2. The theoretical imagecopyresampled call is below.
>
> imagecopyresampled($rImg2, $rImg1, -0.3055, -0.3055, 0, 0, 100.611,
> 100.611, 63, 63);
>
> I realize the above code is incorrect, but it seemed the best way to
> illustrate what I'm attempting to accomplish.
>
> Any help would be greatly appreciated, thanks!
>
> Chris
>

One pixel is the smallest value in images. How do you want your
resulting image to look like? You can resize the image to higher
resolution, but you will need to create 100611x100611 pixel image, and
that's one hell a lot of memory :)

So, what are you trying to achieve?

attached mail follows:


Marek Kilimajer wrote:

> Chris wrote --- napísal::
>
>> Hi there, I've looked in many places but have not found any clues on
>> how to work around this problem.
>>
>> I'm using imagecopyresampled to resize an image and crop part of it
>> at the same time. The area I need to crop, unfortunately, is
>> sometimes a float, which leads to my problem. imagecopyresampled does
>> not accept float values, and interpolate the images. (Well,
>> technically it accepts them, but just converts them to an integer
>> internally)
>>
>> The source image is 63x63 pixels ($rImg1). The destination image is
>> 100x100 pixels ($rImg2).
>>
>> I want to resize $rImg1 to 100.611x100.611, and place the center
>> 100x100 square in $rImg2. The theoretical imagecopyresampled call is
>> below.
>>
>> imagecopyresampled($rImg2, $rImg1, -0.3055, -0.3055, 0, 0, 100.611,
>> 100.611, 63, 63);
>>
>> I realize the above code is incorrect, but it seemed the best way to
>> illustrate what I'm attempting to accomplish.
>>
>> Any help would be greatly appreciated, thanks!
>>
>> Chris
>>
>
> One pixel is the smallest value in images. How do you want your
> resulting image to look like? You can resize the image to higher
> resolution, but you will need to create 100611x100611 pixel image, and
> that's one hell a lot of memory :)
>
> So, what are you trying to achieve?
>
If I resized the image to 100,611x100,611, cropped it to 100,000, and
then resized it to 100x100 it would achieve the effect I want. It's very
difficult for me to explain, but I'll try.

It's very similar to the interpolation done on the inner pixels. It's
taking the values of all pixels that 'touch' the new pixel, and meshing
them together, basically, shifting the pixels 0.3055 to the right would
overlap old and new pixels partially. I'll try a grayscale example (it's
a bit simpler).

If a black pixel overlapped onto a white pixel, I would get the
percentage of the white pixel it's covering, then combine that with the
percentage of the white pixel not covered by the black pixel). So, if
the black pixel was shifter over 0.4 pixels (40%) onto a white pixel I
would calculate the new color : $iGrey = ($iBlack*0.40) + ($iWhite*0.60);

If $iBlack and $iWhite contained the brightess value of a color it would
look liek this:

$iGrey = (0 * 0.40) + (255 * 0.60);
$iGrey = 0 + 153;
$iGrey = 153;

If I was overlapping a White on to a black by 0.4 pixels:
$iGrey = (255 * 0.40) + (0 * 0.60);
$iGrey = 102 + 0;
$iGrey = 102;

or two differing shades of grey pixels:
$iGrey = (18 * 0.40) + (97 * 0.60);
$iGrey = 7.2 + 58.2;
$iGrey = 65.4;
$iGrey = 65;

imagecopyresampled is already doing something similar when it's
resampling an image to a size that is not a multiple of the old size.

I know there are no fractional pixels in images, but when interpolating
between two images, fractions of pixels must be taken into account.

I hope I cleared things up...

Chris

attached mail follows:


* Thus wrote Chris:
> Marek Kilimajer wrote:
>
> >Chris wrote --- napísal::
> >
> >>Hi there, I've looked in many places but have not found any clues on
> >>how to work around this problem.
> >>
> >>I'm using imagecopyresampled to resize an image and crop part of it
> >>at the same time. The area I need to crop, unfortunately, is
> >>sometimes a float, which leads to my problem. imagecopyresampled does
> >>not accept float values, and interpolate the images. (Well,
> >>technically it accepts them, but just converts them to an integer
> >>internally)
> >>
> >>The source image is 63x63 pixels ($rImg1). The destination image is
> >>100x100 pixels ($rImg2).
> >>
> ...
> >
> >So, what are you trying to achieve?
> >
> If I resized the image to 100,611x100,611, cropped it to 100,000, and
> then resized it to 100x100 it would achieve the effect I want. It's very
> difficult for me to explain, but I'll try.
>
> It's very similar to the interpolation done on the inner pixels. It's
> taking the values of all pixels that 'touch' the new pixel, and meshing
> them together, basically, shifting the pixels 0.3055 to the right would
> overlap old and new pixels partially. I'll try a grayscale example (it's
> a bit simpler).

Woah.. that way to much math for my brain at the moment :)

If I understand the situation properly you need to take a smaller
image and make it the boundary for the larger image?? I might
suggest looking at imagick, it is a bit more friendlier with image
manipulation:

  http://pecl.php.net/package/imagick

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Hi There,

I'm trying to develop a band listing site and was just wondering if there is
a php function that could limit the amount of words added into a text area.
I'm aware that this can be done in javascript but the only one I found
doesn't work properly if you try and paste in text to the text box. This was
the script I was looking at:
http://javascript.internet.com/forms/word-counter.html

I want to have something similar to this but as mentioned above want
something more reliable so does anyone know a php function to do this or
have a better option?

attached mail follows:


> I want to have something similar to this but as mentioned above want
> something more reliable so does anyone know a php function to do this or
> have a better option?

http://us3.php.net/manual/en/function.str-word-count.php, also some
good suggestions in the user comments

attached mail follows:


Did you try calling the word counter function in the onChange event of
textbox and truncate the characters/words

attached mail follows:


No other way. Use one query to count the total record and then another
query for limiting

attached mail follows:


Hi everyone,
I would like to know how to handle code breaks or code blocks
that takes up more than two lines.
For readability, I would like to know if there is something like the
following:
function input($type,$size,$name,$value)
{
        return "<input type=\"$type\" size=\"$size\" value=\"$value\" >>>
                        name=\"$name\">";
}

Thanks.
-gohaku

attached mail follows:


On Fri, 25 Jun 2004 22:13:03 -0400, gohaku <gohakuearthlink.net> wrote:
>
> Hi everyone,
> I would like to know how to handle code breaks or code blocks
> that takes up more than two lines.
> For readability, I would like to know if there is something like the
> following:
> function input($type,$size,$name,$value)
> {
> return "<input type=\"$type\" size=\"$size\" value=\"$value\" >>>
> name=\"$name\">";
> }

function input($type,$size,$name,$value)
{
return <<<EOF
<input type="$type" size="$size" value="$value" name="$name">
EOF;
}

--
Greg Donald
http://destiney.com/

attached mail follows:


gohaku wrote --- napísal::
> Hi everyone,
> I would like to know how to handle code breaks or code blocks
> that takes up more than two lines.
> For readability, I would like to know if there is something like the
> following:
> function input($type,$size,$name,$value)
> {
> return "<input type=\"$type\" size=\"$size\" value=\"$value\" >>>
> name=\"$name\">";
> }
>
> Thanks.
> -gohaku
>

function input($type,$size,$name,$value)
{
     return "<input type=\"$type\" size=\"$size\" value=\"$value\" " .
             "name=\"$name\">";
}

attached mail follows:


* Thus wrote gohaku:
> Hi everyone,
> I would like to know how to handle code breaks or code blocks
> that takes up more than two lines.

you just might start a war of the gods here....

> For readability, I would like to know if there is something like the
> following:

> function input($type,$size,$name,$value)
> {
> return "<input type=\"$type\" size=\"$size\" value=\"$value\" >>>
> name=\"$name\">";
> }

In general practice, and depending on how much html you're
outputing:

function input($type,$size,$name,$value) {
<?php
<input type="<php echo $type?>" size="<?php echo $size?>"
    value="<?php echo $value?>" name="<?php echo $name?>>
}

But on the other hand a different approach:

$field = array(
  'type' => $type,
  'size' => $size,
  'value' => $value,
  'name' => $type,
  'id' => $id, /* forgot this one :) */
  );

echo '<input >';
foreach($field as $name => $value ) {
  echo "$name=\"$value\"
}
echo '>';

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


* Thus wrote Joe Lewis:
> The script works perfectly from the command line. It turns out to be
> related directly to Apache 2.0 and the handling of buckets.

yeah, I was afraid of that, and I'm really at a loss with any
suggestions as is, except for:

Ideal solution:
  use apache 1.x

Alternate solution:

remove the package you have for php and compile it from the latest
source (4.3.7). if the problem persists then enable the
--enable-debug compile option in php's configure and submit a bug
report at bugs.php.net.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Just to re-enforce Michael Sims, post...

* Thus wrote KEVIN ZEMBOWER:
> I'm a system administrator who's dabbled a bit in PHP, but am not very experienced in it. My PHP developer came to me with a behavior which neither of us can understand.
>
> If you go to this URL, you'll get a broken version of the main home page on our site: http://www.hcpartnership.org/index.php/search . We can't understand this, because 'index.php' is a file, not a directory. (The correct web page is just at http://www.hcpartnership.org/index.php.)

This behaviour has been around (cept for iis & php) since way back
in the CERN httpd days. traditionally this behaviour was only known
within your cgi-bin directory. But since php is ran in your
document root, the behaviour has changed.

The original behaviour was to issue something like:
  /cgi-bin/script.cgi/path/to/some/random/thing

And the CGI script would be passed two extra environment variables:
  PATH_INFO
  PATH_TRANSLATED

PATH_INFO would contain the string after the name of the cgi being
executed

PATH_TRANSLATED would be DOCUMENT_ROOT/PATH_INFO.

If you followed all that I said so far, the cgi application, with
super ease, could check and read a file that actually existed in the
normal html document tree. Which made writing C programs a lot more
easier :)

>
> Here's another example:
> http://www.hcpartnership.org/path_test.php/search : does not generate a 404 error
> http://www.hcpartnership.org/path_test.html/search : generates a 404 error

Apache is smart enough to determain the difference between a .html
and php script. PHP simply inherits the traditional CGI
environment, and an html simplyy can't do anything with PATH_INFO,
so apache just decides to say 404.

> Can anyone explain to me why this is happening? Is this a danger? Can this be turned off? Is this controlled in the .php code, in the php.ini file or in the Apache configuration, or elsewhere?

One quick fix, i could suggest but not recomend is to add an
auto_prepend_file in php that checks for $_SERVER['PATH_INFO'] and
will redirect to $_SERVER['PHP_SELF'].

A better solution, on the other hand, would be just to make sure
your html output behaves properly, aka not define a link that goes
to /index.php/search.

And the best solution, depending on how active and complex your
site is, is to use the quick fix and have it alert you in some way,
ie using error_log(), as to let you know that you need to fix some html
somewhere.

>
> We didn't even know how to describe this problem well, so our searches of the archives of this mailing list and Google weren't successful. Let me know if we overlooked something.
>

> Thanks so much for your suggestions and thoughts.

I just hope my thoughts and suggestions were clear enough :) And
that I didn't go overboard.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


This behavior is used to make "search engine friendly" urls. If you
don't want the broken images, add this to the <head> section:

<base href="http://www.hcpartnership.org/">

KEVIN ZEMBOWER wrote --- napísal::
> I'm a system administrator who's dabbled a bit in PHP, but am not very experienced in it. My PHP developer came to me with a behavior which neither of us can understand.
>
> If you go to this URL, you'll get a broken version of the main home page on our site: http://www.hcpartnership.org/index.php/search . We can't understand this, because 'index.php' is a file, not a directory. (The correct web page is just at http://www.hcpartnership.org/index.php.)
>
> Here's another example:
> http://www.hcpartnership.org/path_test.php/search : does not generate a 404 error
> http://www.hcpartnership.org/path_test.html/search : generates a 404 error
> This is despite the fact that both of these two files are empty:
> www:/var/www/hcpartnership/htdocs# ls -l path*
> -rw-r--r-- 1 rmcpeak wwwadmin 0 Jun 25 10:09 path_test.html
> -rw-r--r-- 1 rmcpeak wwwadmin 0 Jun 25 10:10 path_test.php
> www:/var/www/hcpartnership/htdocs#
>
> Can anyone explain to me why this is happening? Is this a danger? Can this be turned off? Is this controlled in the .php code, in the php.ini file or in the Apache configuration, or elsewhere?
>
> We didn't even know how to describe this problem well, so our searches of the archives of this mailing list and Google weren't successful. Let me know if we overlooked something.
>
> Thanks so much for your suggestions and thoughts.
>
> -Kevin Zembower

attached mail follows:


* Thus wrote Nico Sabbi:
>
> Hi,
> is there a way configure mod_php4 (for apache) so as to be *absolutely* sure
> that it will always load all definitions in php.ini when apache starts up?
> Maybe with some directive in http.conf ?

As far as I know, there isn't a php directive in apache to tell it
which ini to load.

>
> Almost every time I reboot my pc apache and php start, but php is not
> running with /etc/php.ini, so I have to execute

The php loading goes as follows:
  apache starts
  apche request from php to load
  php gets loaded using its compile path to locate php.ini (see
  output from phpinfo())

>
> /etc/init.d/httpd restart

You might want to evaluate your startup procedures to make sure it
starting apache correctly.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


* Thus wrote Dan Joseph:
> ...
>
> I was using ImageMagick, however it took a multipage tiff and turned it
> into:
>
> 1.TIFF
>
> 1.JPG.0
> 1.JPG.1
> 1.JPG.2
> 1.JPG.3
>
> Sometimes they are 1.JPG, sometimes only 2 pages, sometimes 10 pages. We've
> decided to go with a TIFF viewer plug-in, and just use those. I am using
> the follow PHP script to handle this:
>
> <?
> <code ok>...
> ?>
>
> If the TIFF is a single pager, it works fine. If it's a multipager, I get
> an invalid file format error. I'm really at a loss as what to do. I'm
> willing to explore other solutions to display the TIFF images also.
>
> Can anyone please help?

I'm not familiar with TIFF (nor ie plugin) and these paging things
in .jpg, but the first question that comes to mind is, what exactly
is telling you that its an invalid format?

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!