php-general Digest 29 Nov 2003 18:27:30 -0000 Issue 2444

Topics (messages 171340 through 171363):

Re: DAMN
        171340 by: RT
        171343 by: John Nichel
        171349 by: Gerard Samuel
        171350 by: Bronislav Klucka
        171354 by: Gerard Samuel

Re: php as cgi script
        171341 by: Ivone Uribe

Re: help with Log() function
        171342 by: Jason Wong

Re: Static Array vs MySQL query
        171344 by: John Nichel

File upload issue
        171345 by: Binay
        171346 by: Robert Cummings
        171347 by: Bronislav Klucka
        171348 by: Binay

Test
        171351 by: César Aracena
        171352 by: Eric

Problem loading fonts in gd()
        171353 by: Eric

what's the story with html_entity_decode?
        171355 by: Per Jessen

Checking if a host is online
        171356 by: Jason Giangrande
        171357 by: Adam Maas
        171358 by: Jason Giangrande
        171359 by: Adam Maas
        171361 by: David T-G

Suggestions for optimization?
        171360 by: Galen

EOR (Was: [PHP] DAMN)
        171362 by: Chris Shiflett

speed conection ???
        171363 by: tony

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Fri, 2003-11-28 at 23:55, Bronislav Klucka wrote:
> I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt this
> problem by setting the Reply To header correctly? to be able to reply PHP
> conf. directly using Reply button?!!!
> 
> Brona
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

I believe we just discussed this for the past 2 or 3 days....I have an
ingenious idea. Read the mailing lists archive. 
http://www.phparch.com/mailinglists/msg.php?a=734755&s=Reply-to+header&p=0&g=

Starts at the link above
-- 
"I have a photographic memory. I just forgot the film" --Unknown
=============================
Ryan Thompson
[EMAIL PROTECTED]
http://osgw.sourceforge.net

--- End Message ---
--- Begin Message --- - Edwin - wrote:


On 2003/11/29, at 14:17, John Nichel wrote:

Bronislav Klucka wrote:

I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt this
problem by setting the Reply To header correctly? to be able to reply PHP
conf. directly using Reply button?!!!
Brona


How many times is someone going to start this flame war this month?


Hmm... A *better* question would be "How many people does NOT start it?" ;)

--

- E -

Well, I did my part, and stayed out of the first one....but I did bite my tongue quite a bit. ;)

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--- End Message ---
--- Begin Message ---
On Saturday 29 November 2003 12:54 am, Bronislav Klucka wrote:
> because we know that this bug
> has easy solution...

[jumps in]
Yes ->
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
[jumps out]

--- End Message ---
--- Begin Message ---
what does it mean?

> -----Original Message-----
> From: Gerard Samuel [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 29, 2003 8:50 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] DAMN
> 
> 
> On Saturday 29 November 2003 12:54 am, Bronislav Klucka wrote:
> > because we know that this bug
> > has easy solution...
> 
> [jumps in]
> Yes ->
> X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
> [jumps out]
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Saturday 29 November 2003 03:20 am, Bronislav Klucka wrote:
> what does it mean?
>

I don't want to get into this debate too much, but from what little I read 
when it was going on earlier this past week, people who seemed to complain 
the most are the ones using Outlook.  Seems like Outlook isn't mailing list 
friendly.
To get more/accurate info, look at the archives from earlier this past week...

> >
> > On Saturday 29 November 2003 12:54 am, Bronislav Klucka wrote:
> > > because we know that this bug
> > > has easy solution...
> >
> > [jumps in]
> > Yes ->
> > X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
> > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
> > [jumps out]

--- End Message ---
--- Begin Message ---
Thanks very much to all,

Ok, I understand now.. so I need to install php as a
cgi oppose to the module apache.

Do you have some good page that can help me to
configure and compile correctly the php as cgi?

Thanks in advance,
Kisses,
Ivone
--- Kelly Hallman <[EMAIL PROTECTED]> wrote:
> On Fri, 28 Nov 2003, Nicole Lallande wrote:
> > Ivone --
> > You are using a PERL invocation for php.  PHP
> scripts begin <?php
> 
> #! is not a perl invocation, it is a Unix convention
> to tell the shell 
> which program should be used to process the file
> contents. If you are 
> running PHP as a CGI from a webserver, chances are
> good you do want
> #!/path/to/php as the first line, and <?php on the
> next line.
> 
> I don't think you can pass a flag like
> #!/usr/bin/php -q though, and I
> doubt you would want to, since you still need to
> send the headers upon
> first output. If you did not send headers and just
> started outputting, the 
> server would return a 500 Internal Server Error.
> 
> The directory you're running it from needs to have
> ExecCGI permission
> (i.e. /cgi-bin/) and assuming no special setup has
> been done, you probably
> want to start the file off with that #! line as
> mentioned above. Also, you
> may want to try naming the file .cgi
> 
> > the # sign is a comment in PERL - not in PHP.
> 
> # also denotes a comment in PHP. Though #! is not a
> comment, per se.  
> (However, if you feed the file directly to some
> interpreter like perl, it
> does have the benefit of being ignored as a
> comment.)
> 
> > To run php as cgi you need to install the php cgi
> version (as opposed to
> > the apache modular installation.)  That will allow
> you to run cgi
> > scripts on the command line.
> 
> CGI stands for common gateway interface, which is
> the interface between a
> web server/request and some external program, so it
> has little to do with
> the command line. However, to run PHP from the
> command line, you do need
> to run it with the "CGI version" of PHP. The
> question did not specify 
> needing to run PHP from the command line, but as a
> CGI by the webserver.
> 
> --
> Kelly Hallman
> // Ultrafancy
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

--- End Message ---
--- Begin Message ---
On Saturday 29 November 2003 06:03, Jon King wrote:

> I'm having trouble getting a log formula to work.  This forumla is supposed
> to return the number of payment required zero out a loan balance.

> print -(log(1-($B/$m)*($r/$q)))/log(1+($r/$q));

> It keeps returning a NaN.  I've checked the syntax over and over, but to no
> avail.

Breakup your calculation into little steps to see where your error lies. Have 
to tried entering the above calculation into a real calculator? I believe 
your problem is that you cannot log() a negative number.

-- 
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
------------------------------------------
/*
Algol-60 surely must be regarded as the most important programming language
yet developed.
                -- T. Cheatham
*/


--- End Message ---
--- Begin Message --- - Edwin - wrote:

Hi,

On 2003/11/29, at 8:10, John Nichel wrote:

Hi,

I'm designing my site to use drop down menus, and am having php generate the content of the main manus, as well as the sub-menus. What I'm wondering is what the performance hit will be with putting all the menu variables into an array in a config file vs storing the info in a MySQL table, and retriving the data from there.


...[snipped]...

Instead of "generating" the menu(s) each time, why not create a static [HTML] file which you can "call" by using file_get_contents() or something and just "insert" it where it's needed?

Just an idea...

And a better idea it is. That's what I get for thinking I have to 'program' everything. Thanks!

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--- End Message ---
--- Begin Message ---
Hi all,

In my php.ini file, file_uploads value is set to OFF. Hence stopping HTTP_UPLOAD 
functionlaity. 

But in my script i am turning it On using ini_set("file_uploads","1") but still it 
doesn't upload the file.

I don have access to modify the php.ini file hence trying to play with script only.

Though manual says u can't set the value of file_uploads in the script, but its 
getting set (looked in phpinfo()).

Why this is happening ... and if it is getting set why HTTP_UPLOAD doesn't work.

Thanks in advance

Binay

--- End Message ---
--- Begin Message ---
On Sat, 2003-11-29 at 02:36, Binay wrote:
> Hi all,
> 
> In my php.ini file, file_uploads value is set to OFF. Hence stopping HTTP_UPLOAD 
> functionlaity. 
> 
> But in my script i am turning it On using ini_set("file_uploads","1") but still it 
> doesn't upload the file.
> 
> I don have access to modify the php.ini file hence trying to play with script only.
> 
> Though manual says u can't set the value of file_uploads in the script, but its 
> getting set (looked in phpinfo()).
> 
> Why this is happening ... and if it is getting set why HTTP_UPLOAD doesn't work.

If the docs say it doesn't work then it probably doesn't work. Chances
are it's being set in the PHP code when you use ini_set() but not in
PHP's core where it counts.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Are u working in safe mode? What does the ini_set function return? did u try
ini_get then to see what is current value?


Brona

> Hi all,
>
> In my php.ini file, file_uploads value is set to OFF. Hence
> stopping HTTP_UPLOAD functionlaity.
>
> But in my script i am turning it On using
> ini_set("file_uploads","1") but still it doesn't upload the file.
>
> I don have access to modify the php.ini file hence trying to play
> with script only.
>
> Though manual says u can't set the value of file_uploads in the
> script, but its getting set (looked in phpinfo()).
>
> Why this is happening ... and if it is getting set why
> HTTP_UPLOAD doesn't work.
>
> Thanks in advance
>
> Binay
>

--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Bronislav Klucka" <[EMAIL PROTECTED]>
To: "PHP Konference" <[EMAIL PROTECTED]>; "Binay"
<[EMAIL PROTECTED]>
Sent: Saturday, November 29, 2003 1:08 PM
Subject: RE: [PHP] File upload issue


> Are u working in safe mode?
----------------
safe_mode is OFF
----------------
>What does the ini_set function return? did u try
> ini_get then to see what is current value?
>
------------------------
returns 1.
------------------------
>
> Brona
>
> > Hi all,
> >
> > In my php.ini file, file_uploads value is set to OFF. Hence
> > stopping HTTP_UPLOAD functionlaity.
> >
> > But in my script i am turning it On using
> > ini_set("file_uploads","1") but still it doesn't upload the file.
> >
> > I don have access to modify the php.ini file hence trying to play
> > with script only.
> >
> > Though manual says u can't set the value of file_uploads in the
> > script, but its getting set (looked in phpinfo()).
> >
> > Why this is happening ... and if it is getting set why
> > HTTP_UPLOAD doesn't work.
> >
> > Thanks in advance
> >
> > Binay
> >

--- End Message ---
--- Begin Message ---
Send test :)

--- End Message ---
--- Begin Message ---
why do you test here at the honored PHP General mailing list?

"César aracena" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Send test :)

--- End Message ---
--- Begin Message ---
Hello all PHP gurus

I have a small problem about loading fonts with imageloadfont()

I have copyed fonts with the extension .fon or .ttf to the same directory as
my script, and i give them the font as an argument:

$font = imageloadfont('arial.ttf');

But i just keep getting the message:
Warning: imageloadfont(): Error reading font in c:\program files\apache
group\apache\htdocs\gd_test.php on line 35

Does anyone know how to properly load fonts into gd, without getting this
error message?

Eric

--- End Message ---
--- Begin Message ---
According to the manual it appears to support UTF-8, but it complains loudly
about not supporting MBCS when invoked? 

"Warning: cannot yet handle MBCS in html_entity_decode()! " ....


Will html_entity_decode produce output in UTF-8 when e.g. invoked like this:

$a="Z&uuml;rich, \"klonk\" &aelig; '&aring;' ";
$b=html_entity_decode( $a, ENT_QUOTES, "UTF-8" );

It seems to default to ISO-8859-1?  


thanks
/Per

-- 
Per Jessen, Zurich
http://timian.jessen.ch - an analog report formatter using XSLT.
http://jessen.ch/dansk-listen - for alle danskere i udlandet!

--- End Message ---
--- Begin Message ---
I'm creating an application for an Intranet that, among other things, is
supposed to check to see if particular hosts are online, and if so, what
their IP address is.  Anyone know how I can accomplish this?  I tried
using exec("host $host"); (where $host is the hostname) and while this
gets the IP it gets the IP address sometimes even if the host is not
active, because a DNS record for the system still exists.  I also looked
into the gethostbyname() function, but that has similar problems to
using the external host command.  I also tried to use an external ping
command (ping -c 1 $host), and while I could get that to work, since it
returns non-zero status if the host can not be contacted, it takes quite
a while to execute for even a few hosts at once.  

Anyone ever do this king=d of thing before or have any suggestions on
what might work?
-- 
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message --- Jason Giangrande wrote:
I'm creating an application for an Intranet that, among other things, is
supposed to check to see if particular hosts are online, and if so, what
their IP address is. Anyone know how I can accomplish this? I tried
using exec("host $host"); (where $host is the hostname) and while this
gets the IP it gets the IP address sometimes even if the host is not
active, because a DNS record for the system still exists. I also looked
into the gethostbyname() function, but that has similar problems to
using the external host command. I also tried to use an external ping
command (ping -c 1 $host), and while I could get that to work, since it
returns non-zero status if the host can not be contacted, it takes quite
a while to execute for even a few hosts at once.

Anyone ever do this king=d of thing before or have any suggestions on
what might work?

why not try:

passthru("ping $host");

Adam
--- End Message ---
--- Begin Message ---
On Sat, 2003-11-29 at 12:20, Adam Maas wrote:
> why not try:
> 
>   passthru("ping $host");
> 
> Adam

That still takes a little while to execute on multiple hosts,  Plus I
need to modify the output of the command to print just the IP address
and discard the rest of the output.
-- 
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message --- Adam Maas wrote:

Jason Giangrande wrote:

I'm creating an application for an Intranet that, among other things, is
supposed to check to see if particular hosts are online, and if so, what
their IP address is. Anyone know how I can accomplish this? I tried
using exec("host $host"); (where $host is the hostname) and while this
gets the IP it gets the IP address sometimes even if the host is not
active, because a DNS record for the system still exists. I also looked
into the gethostbyname() function, but that has similar problems to
using the external host command. I also tried to use an external ping
command (ping -c 1 $host), and while I could get that to work, since it
returns non-zero status if the host can not be contacted, it takes quite
a while to execute for even a few hosts at once. Anyone ever do this king=d of thing before or have any suggestions on
what might work?


why not try:

passthru("ping $host");

Adam


My bad, didn't read closely enough.

It's not likely to be able to do this fast, ef you only want it to query when asked. You may want to look into a monitoring solution like NOCOL.

Adam
--- End Message ---
--- Begin Message ---
Jason --

...and then Jason Giangrande said...
% 
% I'm creating an application for an Intranet that, among other things, is
% supposed to check to see if particular hosts are online, and if so, what
% their IP address is.  Anyone know how I can accomplish this?  I tried
...
% a while to execute for even a few hosts at once.  

1) If you're first checking to see if it's alive and second checking for
its IP address you are, IMHO, doing it backwards :-)

2) It sounds like you're rewriting BigBrother.  Check out bb4.com for
info.  It absolutely rocks and I wouldn't run a real site[1] without it.

3) At the very least, cut your ping timeout down to the smallest
acceptable; in general, a full second is plenty of time to get nearly
anywhere on your continent (ain't it great? :-) and so your intranet
should be more than happy with that allowance.

4) I know that BB has already beaten this problem, so you should also
check there, but there may be a way to ping numerous hosts at once
(netping or such).  Try some googling.  If nothing else, I know that you
could whip up a perl script which will fork the load and then run them in
parallel and could return the live/dead/notfound results; I don't think
that php has forking.

[1] My house must therefore by definition not be a real site, but it
aspires to be -- and shall whenever I can find some unallocated time :-)


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message --- I'm working on some database search ranking code. It currently represents 95-98% of the time spent when doing fuzzy seaches. I have tried my best to optimize my code - algorithmic shortcuts, eliminating session variables, unsetting irrelevant results, etc and benchmarking to find the best techniques. That's given me over a 10x improvement. Unfortunately, because of the number of results it must process (up to 20,000), it is still somewhat slow. I think it could use some code structure/formating tweaks to eek out that last bit of performance, but I don't know much about optimizing PHP code in that way. Does anybody have suggestions?

Also, might there be some tweaks for PHP itself to improve performance? I already know about the Zend Optimizer and have it installed, it does help.

Thanks!

Here's my code:

if ($search_results[0]["relevancy"] == "")
{
function cmp($a, $b)
{
if($a["relevancy"] < $b["relevancy"])
{
return 1;
}
elseif($a["relevancy"] > $b["relevancy"])
{
return -1;
}
else
{
return 0;
}
}

$search_statements = $_SESSION["search"]["statements"];

foreach($search_results as $key1 => $value1)
{
$num_fields_matched = 0;
$result_score = 0;
$metaphone_ratio = 0;
foreach($search_statements as $key => $value)
{
if ($value != "" AND $value1[$key] != $value)
{
$value = strtolower(trim($value));
$value1[$key] = strtolower(trim(($value1[$key])));
$num_fields_matched++;
$value_metaphone = metaphone($value1[$key]);
$search_metaphone = metaphone($value);
$search_position = strpos($value1[$key], $value);
$string_count = substr_count($value1[$key], $value);
$levenshtein = levenshtein($value, $value1[$key], "0.5", 1, 1);

if ($search_metaphone == $value_metaphone AND $value_metaphone != "")
{
$metaphone_ratio = 1;
}
elseif ($search_metaphone != 0)
{
$metaphone_ratio = 0.6 * (1 / levenshtein($search_metaphone, $value_metaphone));
}

$result_score = $result_score + ($levenshtein + (8 * $search_position)) - (2 * ($string_count - 1)) - (1.1 * $metaphone_ratio * $levenshtein);
}
elseif ($value1[$key] == $value)
{
$result_score = $result_score - 5;
}
}
if ($num_fields_matched == 0)
{
$num_fields_matched = 1;
}
$search_results[$key1]["relevancy"] = ($result_score * -1) / $num_fields_matched;

if ($fuzzy_search == true AND $search_results[$key1]["relevancy"] < -5)
{
unset($search_results[$key1]);
}
}

usort($search_results, "cmp");
}
--- End Message ---
--- Begin Message ---
--- Bronislav Klucka <[EMAIL PROTECTED]> wrote:
> I've just realized I'm replaying to JeRRy only!!!! Could anybody
> fixt this problem by setting the Reply To header correctly? to
> be able to reply PHP conf. directly using Reply button?!!!

Hi Brona,

Not only has this been discussed in great detail, it is also a useless
argument. Rasmus has already given the definitive stance.

In short, we will not be mangling the Reply-To header in the way you
suggest. It violates standards and is just wrong. The Reply-To header is
set by the sender, and it is where the sender wants replies to the message
sent. If you can't figure out how to use email correctly, ask for help
about that (the "Reply All" button might be worth trying first), but don't
suggest breaking things and describing it as "fixing" something.

No amount of arguing is going to change anything. This list is maintained
by extremely competent people who are not going to be swayed by uninformed
opinions. If you disagree with the way this list is maintained (at least
in terms of issues that have obviously been raised before), you should
probably find somewhere else to ask questions.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
     Coming mid-2004
HTTP Developer's Handbook
     http://httphandbook.org/

--- End Message ---
--- Begin Message ---
Hi , I need to know the conecction speed of  a person who is visiting my
site.
How can I know his speed?
Thaks

--- End Message ---

Reply via email to