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 25 Oct 2005 02:57:30 -0000 Issue 3756

php-general-digest-helplists.php.net
Date: Mon Oct 24 2005 - 21:57:30 CDT


php-general Digest 25 Oct 2005 02:57:30 -0000 Issue 3756

Topics (messages 224548 through 224607):

Re: Php, Rails and ajax
        224548 by: Phillip Oertel
        224549 by: Phillip Oertel
        224573 by: Paul Waring

Re: cleanly written shop-system (php5, object-oriented)?
        224550 by: James Benson
        224551 by: Jochem Maas
        224555 by: Phillip Oertel
        224588 by: James Benson

Re: Output files encoding
        224552 by: Richard Lynch

Re: Problem reading SimpleXML array
        224553 by: Richard Lynch
        224582 by: Jochem Maas

Re: Ugh, w32 anything is making me want to drink!
        224554 by: Jay Blanchard
        224606 by: Richard Lynch

Re: Email Validation built-in? RFC
        224556 by: Ben Litton
        224558 by: Manuel Lemos
        224602 by: Mark Charette

Re: php Slow with Mac OS X 10.4
        224557 by: Nicolas Ross
        224577 by: Brent Baisley
        224580 by: Atelier Fabien
        224584 by: Nicolas Ross
        224585 by: Nicolas Ross
        224591 by: Brent Baisley
        224605 by: Richard Lynch

moving website from windows to linux hosting
        224559 by: pedro mpa
        224569 by: Ben
        224578 by: Brent Baisley

Why this doesn't work ?
        224560 by: Mário Gamito
        224561 by: Colin Shreffler
        224562 by: Mário Gamito
        224563 by: Jay Blanchard
        224564 by: Jim Moseby
        224565 by: Scott Noyes
        224566 by: Jay Blanchard
        224567 by: Mário Gamito
        224568 by: Phillip Oertel
        224570 by: Jordan Miller
        224571 by: Jim Moseby
        224572 by: Phillip Oertel
        224604 by: Richard Lynch

Re: Temp table doesn't seem to work
        224574 by: Brian Dunning

Re: Ugh, w32 anything is making me want to drink! - SOLVED
        224575 by: Jay Blanchard

PDF printing under windows.
        224576 by: Dave Lists
        224587 by: Dan Baker
        224603 by: Richard Lynch

How to protect a php script that sends variables to itself
        224579 by: Graham Anderson
        224581 by: Jochem Maas
        224586 by: Graham Anderson
        224600 by: Richard Lynch
        224601 by: Richard Lynch

Re: Abstract Classes?
        224583 by: Jochem Maas
        224592 by: GamblerZG

Re: Calling PostgreSQL & MySQL Stored Procedures - SOLVED
        224589 by: Colin Shreffler

Help with a regular expression for 0,1 or 2 decimal places
        224590 by: Shaun
        224594 by: Al
        224599 by: Richard Lynch

how to display GD graphic in web page
        224593 by: Chris
        224596 by: Jasper Bryant-Greene
        224598 by: Richard Lynch

function 'another_mail' with authentication
        224595 by: Etienne Finet
        224597 by: Manuel Lemos

Re: JPG Slide show
        224607 by: John Taylor-Johnston

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:


hi,

"rails" is written in the ruby programming language. which has nothing
to do with php. ruby and php are different programming languages, that
are used on the server-side of the web. normally you decide on one of them!

ajax in contrast is a way of updating the web browser content without
reloading the currently displayed page; to acheive that, both a client
side and a server-side language are involved.

the client side will be written in javascript (using the xmlhttprequest
object), on the server-side you are free to use any language you want,
php, ruby, java, python, perl, asp, ...

if you want to use php and ajax, maybe check out phpontrax or cakephp.
they are clones of ruby on rails.

phil

---

Jacob Friis Saxberg schrieb:
> Hello again.
>
> Is it possible to use Php, Rails and ajax via some open source system?
> How do you do it?
>
> The most important for me is to use Php and ajax.
>
> Thanks,
> Jacob

attached mail follows:


hi,

"rails" is written in the ruby programming language. which has nothing
to do with php. ruby and php are different programming languages that
are used on the server-side of the web. normally you decide on one of them!

ajax in contrast is a way of updating the web browser content without
reloading the currently displayed page; to acheive that, both a client
side and a server-side language are involved.

the client side will be written in javascript (using the xmlhttprequest
object), on the server-side you are free to use any language you want,
php, ruby, java, python, perl, asp, ...

if you want to use php and ajax, maybe check out phpontrax or cakephp.
they are clones of ruby on rails.

phil

---

Jacob Friis Saxberg schrieb:
> Hello again.
>
> Is it possible to use Php, Rails and ajax via some open source system?
> How do you do it?
>
> The most important for me is to use Php and ajax.
>
> Thanks,
> Jacob

attached mail follows:


On Mon, Oct 24, 2005 at 03:34:23PM +0200, Jacob Friis Saxberg wrote:
> Is it possible to use Php, Rails and ajax via some open source system?
> How do you do it?

I don't know what exactly you mean by "rails", as it seems to be a
buzzword for half a dozen different things at the moment. However, I did
come across this site in one of the RSS feeds that I subscribe to:

http://www.phpontrax.com

PHPonTrax claims to be "a web-application and persistance framework that
is based on Ruby on Rails", though having not used it myself I can't
speak for how accurate that claim is.

Paul

--
Rogue Tory
http://www.roguetory.org.uk

attached mail follows:


PHP5 has yet to see the maturity and stability PHP4 offers which is why
most applications use it.

Worst thing you can do is design a website in entirely flash :)

Phillip Oertel wrote:
> hi,
>
> i want to create a "shop server" application. the shop client interface
> will be in flash (communication with php over xml, soap or amfphp), the
> administration interface will be html. most likely it will probably be a
> long-running application that will be extended in several steps, so we
> need a solid foundation. we also need to get started quickly (who
> doesn't), otherwise i would consider starting from scratch.
>
> i have already looked around quite a lot for a nicely adaptable
> shop/ecommerce implementation, but haven't been very successful so far.
> everything i found was conceived in php4 times, where OO wasn't as
> wide-spread in the php community as it is today. some of the packages
> are poorly documented (both in-code and separate documentation), have an
> inconsistent coding style, are dead, are copies of oscommerce with a
> worse interface, ...
>
> feature-wise the best i found was xtcommerce (oscommerce fork)
> admin interface wise: zencart (oscommerce fork)
> code-wise: randshop
> non of them use php5's features, though, none are written object-oriented.
>
> i have no info on the performance of these shops, although that
> shouldn't be a prob as long as it's not desastrous (to some extend, you
> can always scale hardware-wise).
>
> so i am looking for a cleanly layered application where i could swap out
> the presentation layer. and all important shop data (products, product
> categories, cart, etc.) should be represented as objects, so i could
> extend them to implement required customizations.
> it would be a big plus if the admin interface was well thought-out.
>
> we need quite some features like multiple languages, multiple
> categories, discounts on certain products, payment provider integration,
> customer newsletters, possibly administration of several slightly
> different shops in one installation, etc.
>
> is there such an application or am i stuck with oscommerce and its forks?
> i don't need it to be feature complete, as long as there is a way to
> adapt the code without hacking the whole thing (and loosing the
> possibility of upgrading).
>
> as long as the code was open, i would be happy to pay a certain amount
> for the application.
>
> anyone?
>
> phil

attached mail follows:


James Benson wrote:
> PHP5 has yet to see the maturity and stability PHP4 offers which is why
> most applications use it.
>
> Worst thing you can do is design a website in entirely flash :)

no the worst thing you can do is spread FUD.
which you have just done, unless you are capable of backing up your off the cuff
remarks (about the stability of php5) with hard imperical data, which I doubt.

actually 'the worst thing you can do' is more likely to be something like
'invading a sovereign state in order to be able to subsidise your own oil-addicted,
brainwashed, selfrighteous society' than something that's anything to do with
php or the web. but then again maybe not ;-)

>
>
>
>
>
>
> Phillip Oertel wrote:
>
>> hi,
>>
>> i want to create a "shop server" application. the shop client interface
>> will be in flash (communication with php over xml, soap or amfphp), the
>> administration interface will be html. most likely it will probably be a
>> long-running application that will be extended in several steps, so we
>> need a solid foundation. we also need to get started quickly (who
>> doesn't), otherwise i would consider starting from scratch.
>>
>> i have already looked around quite a lot for a nicely adaptable
>> shop/ecommerce implementation, but haven't been very successful so far.
>> everything i found was conceived in php4 times, where OO wasn't as
>> wide-spread in the php community as it is today. some of the packages
>> are poorly documented (both in-code and separate documentation), have an
>> inconsistent coding style, are dead, are copies of oscommerce with a
>> worse interface, ...
>>
>> feature-wise the best i found was xtcommerce (oscommerce fork)
>> admin interface wise: zencart (oscommerce fork)
>> code-wise: randshop
>> non of them use php5's features, though, none are written
>> object-oriented.
>>
>> i have no info on the performance of these shops, although that
>> shouldn't be a prob as long as it's not desastrous (to some extend, you
>> can always scale hardware-wise).
>>
>> so i am looking for a cleanly layered application where i could swap out
>> the presentation layer. and all important shop data (products, product
>> categories, cart, etc.) should be represented as objects, so i could
>> extend them to implement required customizations.
>> it would be a big plus if the admin interface was well thought-out.
>>
>> we need quite some features like multiple languages, multiple
>> categories, discounts on certain products, payment provider integration,
>> customer newsletters, possibly administration of several slightly
>> different shops in one installation, etc.
>>
>> is there such an application or am i stuck with oscommerce and its forks?
>> i don't need it to be feature complete, as long as there is a way to
>> adapt the code without hacking the whole thing (and loosing the
>> possibility of upgrading).
>>
>> as long as the code was open, i would be happy to pay a certain amount
>> for the application.
>>
>> anyone?
>>
>> phil
>
>

attached mail follows:


hello james,

1) i have been working with php5 for almost a year now, and the biggest
project i have yet worked on (a complex intranet banking application) is
running perfectly on it; no problems. on the contrary, since the zend
engine has been rewritten to properly handle objects (as references not
copies), a huge source of confusion/errors/odd behaviour has been
removed. we have not had one "stability" or "scaling" problem with php5.
(what i *would* worry about is having to develop oo-software in php4.)

2) "Worst thing you can do is design a website in entirely flash" ->
depends on the kind of site. you certainly wouldn't do a news site 100%
flash, but for certain *application* is can make perfect sense. what we
will do is build a product configuratorin flash, not the whole site.

regards,
phillip

---

running perfectly clean James Benson schrieb:
> PHP5 has yet to see the maturity and stability PHP4 offers which is why
> most applications use it.
>
> Worst thing you can do is design a website in entirely flash :)
>
>
>
>
>
>
> Phillip Oertel wrote:
>
>> hi,
>>
>> i want to create a "shop server" application. the shop client interface
>> will be in flash (communication with php over xml, soap or amfphp), the
>> administration interface will be html. most likely it will probably be a
>> long-running application that will be extended in several steps, so we
>> need a solid foundation. we also need to get started quickly (who
>> doesn't), otherwise i would consider starting from scratch.
>>
>> i have already looked around quite a lot for a nicely adaptable
>> shop/ecommerce implementation, but haven't been very successful so far.
>> everything i found was conceived in php4 times, where OO wasn't as
>> wide-spread in the php community as it is today. some of the packages
>> are poorly documented (both in-code and separate documentation), have an
>> inconsistent coding style, are dead, are copies of oscommerce with a
>> worse interface, ...
>>
>> feature-wise the best i found was xtcommerce (oscommerce fork)
>> admin interface wise: zencart (oscommerce fork)
>> code-wise: randshop
>> non of them use php5's features, though, none are written
>> object-oriented.
>>
>> i have no info on the performance of these shops, although that
>> shouldn't be a prob as long as it's not desastrous (to some extend, you
>> can always scale hardware-wise).
>>
>> so i am looking for a cleanly layered application where i could swap out
>> the presentation layer. and all important shop data (products, product
>> categories, cart, etc.) should be represented as objects, so i could
>> extend them to implement required customizations.
>> it would be a big plus if the admin interface was well thought-out.
>>
>> we need quite some features like multiple languages, multiple
>> categories, discounts on certain products, payment provider integration,
>> customer newsletters, possibly administration of several slightly
>> different shops in one installation, etc.
>>
>> is there such an application or am i stuck with oscommerce and its forks?
>> i don't need it to be feature complete, as long as there is a way to
>> adapt the code without hacking the whole thing (and loosing the
>> possibility of upgrading).
>>
>> as long as the code was open, i would be happy to pay a certain amount
>> for the application.
>>
>> anyone?
>>
>> phil

attached mail follows:


Bad choice of words.

I was comparing PHP4 to PHP5 and how long PHP4 has been around compared
to PHP5, it's bound to be more stable aint it?

I was not trying to say PHP5 is not stable because im sure it is very
much so.

Or am I not allowed to say anything like that in this forum?
Ill just silently exit through the back door then :)

Jochem Maas wrote:
> James Benson wrote:
>
>> PHP5 has yet to see the maturity and stability PHP4 offers which is
>> why most applications use it.
>>
>> Worst thing you can do is design a website in entirely flash :)
>
>
> no the worst thing you can do is spread FUD.
> which you have just done, unless you are capable of backing up your off
> the cuff
> remarks (about the stability of php5) with hard imperical data, which I
> doubt.
>
> actually 'the worst thing you can do' is more likely to be something like
> 'invading a sovereign state in order to be able to subsidise your own
> oil-addicted,
> brainwashed, selfrighteous society' than something that's anything to do
> with
> php or the web. but then again maybe not ;-)
>
>>
>>
>>
>>
>>
>>
>> Phillip Oertel wrote:
>>
>>> hi,
>>>
>>> i want to create a "shop server" application. the shop client interface
>>> will be in flash (communication with php over xml, soap or amfphp), the
>>> administration interface will be html. most likely it will probably be a
>>> long-running application that will be extended in several steps, so we
>>> need a solid foundation. we also need to get started quickly (who
>>> doesn't), otherwise i would consider starting from scratch.
>>>
>>> i have already looked around quite a lot for a nicely adaptable
>>> shop/ecommerce implementation, but haven't been very successful so far.
>>> everything i found was conceived in php4 times, where OO wasn't as
>>> wide-spread in the php community as it is today. some of the packages
>>> are poorly documented (both in-code and separate documentation), have an
>>> inconsistent coding style, are dead, are copies of oscommerce with a
>>> worse interface, ...
>>>
>>> feature-wise the best i found was xtcommerce (oscommerce fork)
>>> admin interface wise: zencart (oscommerce fork)
>>> code-wise: randshop
>>> non of them use php5's features, though, none are written
>>> object-oriented.
>>>
>>> i have no info on the performance of these shops, although that
>>> shouldn't be a prob as long as it's not desastrous (to some extend, you
>>> can always scale hardware-wise).
>>>
>>> so i am looking for a cleanly layered application where i could swap out
>>> the presentation layer. and all important shop data (products, product
>>> categories, cart, etc.) should be represented as objects, so i could
>>> extend them to implement required customizations.
>>> it would be a big plus if the admin interface was well thought-out.
>>>
>>> we need quite some features like multiple languages, multiple
>>> categories, discounts on certain products, payment provider integration,
>>> customer newsletters, possibly administration of several slightly
>>> different shops in one installation, etc.
>>>
>>> is there such an application or am i stuck with oscommerce and its
>>> forks?
>>> i don't need it to be feature complete, as long as there is a way to
>>> adapt the code without hacking the whole thing (and loosing the
>>> possibility of upgrading).
>>>
>>> as long as the code was open, i would be happy to pay a certain amount
>>> for the application.
>>>
>>> anyone?
>>>
>>> phil
>>
>>
>>

attached mail follows:


On Mon, October 24, 2005 9:16 am, Yannick Warnier wrote:
> Le lundi 24 octobre 2005 à 14:37 +0100, Yannick Warnier a écrit :
>> Hi guys,
>>
>> For a reason that I don't really understand, my PHP install outputs
>> file
>> in UTF-8 by default.
>>
>> I would like to output files in ISO-8859-1 in certain cases. How do
>> I do
>> that?
>>
>> I have tried changing default_charset to iso-8859-1 with an
>> ini_set()
>> call, but it doesn't help. I also looked at the doc for fopen() and
>> fwrite() (the functions I am using to write my file) and to the
>> mbstring
>> module, but it looks like nothing is really coded to allow me to do
>> this.
>
> For some reason now I could write a fully ISO-8859-1 file, so I can
> guess I had been missing something. If someone has an explanation or a
> document on how the files created by PHP are encoded, I would be very
> glad. Thanks.

I think we went through this already...

PHP outputs a file. Period.

There is no inherent format, much less character set, to the file.

Whatever you are using to detect the character set of this file is
basically a badly-designed piece of software that is making up an
answer out of thin air. *

The only possible distinct in file types is PHP under versions of
Windows where "binary" and "text" files are different, and this is
determined by fopen()
http://php.net/fopen

* It may be looking inside the contents of the file, and searching
through all the bytes looking for what it thinks are valid character
combinations, and then "guessing" at what character set is used inside
the file... And that may not be a totally horrible thing to do, but
it's misleading to claim that the file is of a particular character
set.

The data within the file happens to fit into a particular character
set. With a small enough file, and a limited enough sample, there are
any number of character sets that *COULD* be valid. If the file is
"empty" what character set is it?

PHP isn't doing anything different to any file to make it be any
particular character set.

You get out of it what you put into it. That's pretty much PHP's
perspective on a file.

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

attached mail follows:


On Mon, October 24, 2005 3:50 am, George Pitcher wrote:
> Hi,
>
> I'm having a problem reading an xml feed. This is my object:
>
> SimpleXMLElement Object (
> [Header] => SimpleXMLElement Object (
> [ID] => FX12GB
> [Test] => false
> [Name] => Foreign Exchange United Kingdom Pound Noon Rates
> [Prepared] => 2005-10-24
> [Sender] => SimpleXMLElement Object (
> [Name] => Federal Reserve Bank of New York
> [Contact] => SimpleXMLElement Object (
> [Name] => George Matthes
> [Email] => george.matthesny.frb.org ) )
> [ReportingBegin] => 1994-01-06 )
> [DataSet] => SimpleXMLElement Object (
> [Series] => SimpleXMLElement Object (
> [Key] => SimpleXMLElement Object (
> [FREQ] => D
> [CURR] => GBP
> [FX_TIME] => 12
> [FX_TYPE] => S )
> [Obs] => SimpleXMLElement Object (
> [TIME_PERIOD] => 2005-10-21
> [OBS_VALUE] => 1.7692 ) ) ) )
>
> I'm trying to get those last two lines: TIME_PERIOD and OBS_VALUE.
>
> I can get the ID (third line) using $s->Header->ID (where $s is my
> object).
> $s->DataSet->Series->Obs->TIME_PERIOD; // 'Trying to get property of
> non-object'

echo "<PRE>";
var_dump($s);
echo "<hr />\n";
var_dump($s->DataSet);
echo "<hr />\n";
var_dump($s->DataSet->Series);
echo "<hr />\n";
.
.
.

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

attached mail follows:


Richard,

I'm guessing you haven't played with simpleXML ...

(apologies inadvance for any/all mistakes :-)

chances are the var_dump() pointer you gave (which under
normal circumstances would be spot on) will probably
lead to more confusion. to put it lightly SimpleXML
doesn't lend itself to introspection (ATM?) because of the
very #%^$ (for the totally naive: that was masking the word 'nice')
string casting magic. at least it drove me absolutely nuts.

anyway copious and experimental use of explicit casting to
strings [i.e. using '(string)'] was the order of the day for me.

as far as I understand it the problem lies in the fact that the object
you get back has properties which behave as strings and objects which
for good measure can (all) can be iterated [foreach] like arrays.

all very simple, well ... you decide. :-)

Richard Lynch wrote:
> On Mon, October 24, 2005 3:50 am, George Pitcher wrote:
>
>>Hi,
>>
>>I'm having a problem reading an xml feed. This is my object:
>>
>>SimpleXMLElement Object (
>> [Header] => SimpleXMLElement Object (
>> [ID] => FX12GB
>> [Test] => false
>> [Name] => Foreign Exchange United Kingdom Pound Noon Rates
>> [Prepared] => 2005-10-24
>> [Sender] => SimpleXMLElement Object (
>> [Name] => Federal Reserve Bank of New York
>> [Contact] => SimpleXMLElement Object (
>> [Name] => George Matthes
>> [Email] => george.matthesny.frb.org ) )
>> [ReportingBegin] => 1994-01-06 )
>> [DataSet] => SimpleXMLElement Object (
>> [Series] => SimpleXMLElement Object (
>> [Key] => SimpleXMLElement Object (
>> [FREQ] => D
>> [CURR] => GBP
>> [FX_TIME] => 12
>> [FX_TYPE] => S )
>> [Obs] => SimpleXMLElement Object (
>> [TIME_PERIOD] => 2005-10-21
>> [OBS_VALUE] => 1.7692 ) ) ) )
>>
>>I'm trying to get those last two lines: TIME_PERIOD and OBS_VALUE.
>>
>>I can get the ID (third line) using $s->Header->ID (where $s is my
>>object).
>>$s->DataSet->Series->Obs->TIME_PERIOD; // 'Trying to get property of
>>non-object'
>
>
>
> echo "<PRE>";
> var_dump($s);
> echo "<hr />\n";
> var_dump($s->DataSet);
> echo "<hr />\n";
> var_dump($s->DataSet->Series);
> echo "<hr />\n";
> .
> .
> .
>

attached mail follows:


[snip]
Also, lots of other good info on this topic at:
http://www.php.net/manual/en/install.windows.php
[/snip]

ACCCCCCCCCCCKKKKKKKKKKKKKKKKKKKKK!!!!!!!!

I have tried several things, now I am at my wits end. I finally rebooted the
server (as suggested by someone one the PHP Windows list) and now all of the
php pages come up with 404 not found errors. Googling has not helped so far.
Any clues?

attached mail follows:


On Mon, October 24, 2005 11:06 am, Jay Blanchard wrote:
> [snip]
> Also, lots of other good info on this topic at:
> http://www.php.net/manual/en/install.windows.php
> [/snip]
>
> ACCCCCCCCCCCKKKKKKKKKKKKKKKKKKKKK!!!!!!!!
>
> I have tried several things, now I am at my wits end. I finally
> rebooted the
> server (as suggested by someone one the PHP Windows list) and now all
> of the
> php pages come up with 404 not found errors. Googling has not helped
> so far.
> Any clues?

This before or after you switched to Apache?...

Can you surf to a static page?

Can you surf to a static page in the same directory as the PHP page?

PHP CGI or Service/Module?

Anything in the log files?

Do all browsers say 404, or is that just the badly-broken MS IE
generalized message?

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

attached mail follows:


You could certainly write an extension to do so. That's what I did (mostly
I was writing one for another purpose and added a function I stole from
O'Reilly. You can find the C code I used here:
http://www.oreillynet.com/pub/a/network/excerpt/spcookbook_chap03/index3.html.
It's pretty clever (If you're used to doing things the PHP/regex way) and
while I haven't benchmarked it, I'd imagine it is pretty fast.

There are lots of php extension tutorials out there, but if you want me to
wrap it for you I probably could. I'm sure though that the many php regex
solutions out there are probably 'good enough' for your needs, and I
haven't tested that C code on some of the stranger e-mail addresses out
there in existance.

Ben

On Fri, 21 Oct 2005 22:58:38 -0400, "Richard Lynch" <ceol-i-e.com> wrote:

> Given:
>
> It is unacceptable to reject perfectly valid email addresses, no
> matter how arcane. [Like mine. :-)]
>
> The CORRECT RegEx for validating an email is 3 pages long, and
> performance in PHP would probably not be so good...
>
> In today's Security-conscious world, data validation is a requirement.
>
> The (relatively) recent changes in domain names that allow UTF
> (Unicode?) characters.
>
> Checking MX records is not reliable at all.
>
> Forcing users to respond to email is A) burdensome to real users in
> many cases, and B) no real barrier to halfway intelligent fake users.
>
> ... would it not make sense for there to be a BUILT-IN PHP function of
> a TRUE email syntactic validation?
>
> So at least one KNOWS that the email is a valid construct, before you
> even try (if you try at all) to make sure that a person actually
> checks it at least once in their life.
>
> Currently, email syntax validation is being done in very limited
> fashion, if not outright "wrong" by rejecting what actually ARE valid
> email addresses in about 10,000,000 PHP scripts by users who don't
> have any realistic options to truly "do it right" because who can
> really live with that 3-page Regex in their PHP code?
>
> Yes, in the past, I may have come down squarely on the opposite side
> of this topic, but I've changed my mind.
>
> I believe PHP needs a built-in syntactically CORRECT email validation
> function, vetted and tested by professionals, instead of the mess we
> now have.
>
> PLEASE do not point me to any existing email validation code unless
> you believe it is not only 100% correct and complete with RFC
> definitions of syntactically valid email. Not interested. I've
> already seen them, and been burned by them.
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

attached mail follows:


Hello,

on 10/23/2005 07:21 PM Robin Vickery said the following:
>>> Checking MX records is not reliable at all.
>> I agree that it is less useful today, but it still help catches many
>> domain name typos.
>>
>>> ... would it not make sense for there to be a BUILT-IN PHP function of
>>> a TRUE email syntactic validation?
>> I don't see that being much better than passing a good regular
>> expression to preg_match.
>
> 1. Technically you can't write a regular expression that matches
> *all* valid email addresses as part of the address specification is
> recursive.
>
> ccontent = ctext / quoted-pair / comment
> comment = "(" *([FWS] ccontent) [FWS] ")"
>
> Admittedly 99.99% of people don't even know you *can* comment email
> addresses so it's not a huge problem...

If I am not mistaken, PCRE supports recursive regular expressions.

Anyway, the way I got the RFC that is not quite the form of an address
but the way it may be presented in message header. Meaning, you can add
comments in To: or other e-mail header but in reality the comments are
not part of the address.

> 2. Very few people seem to be capable of recognising a *good* regular
> expression, let alone writing one. It seems clear that validating an
> address is a task that many people want to do, but few can do
> properly. I'd say that's a good reason for making it a built-in
> function.

Yes. What I meant is that just copying a good enough regular expression
would be sufficient to use it. There is no need to understand it.

>> For many years I use this regular expression in popular email validation
>> and forms generation and validation classes.
>>
>>
>> Rather than accepting only valid characters, it rejects all invalid
>> characters as specified in the RFC.
>>
>> ^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,6}$
>>
>
> I'm sorry, but this regular expression rejects many perfectly valid
> ASCII characters. It seems to take into account only dot-atoms, not
> quoted-strings. It also rejects valid addresses using domain-literals.

You are right of course. What I wrote is not what I meant. I fixed the
sentence later but I did not realize that the message had already been sent.

What I meant is that despite I use that regular expression for many
years without complaints, it could be improved to reject only invalid
characters, but of course that is not what that expression does.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


Ben Litton wrote:

> You could certainly write an extension to do so. That's what I did
> (mostly I was writing one for another purpose and added a function I
> stole from O'Reilly.

As you stated in your article, it isn't rfc822 compliant (it isn't even
close). Richard was pretty specific in his needs.

attached mail follows:


Just a little follow-up to my own post.

From the latest expriments I've done with a fresh install of OS X 10.4 (with
the latest 10.4.3 beta update), it seems to point to an IO problem.

My test site uses mambo as a CMS, and I've inclued collecting of
microseconds timestamps at key points of the index file, and whenever it
includes some files it slows down. It's worse when there are several nested
includes. One other point is the mysql db connection.

I must recall to all that when called from the cli, it's ok. Only when
called from apache (1 or 2), dso or static and only on Mac OS X 10.4 (it's
ok with 10.3 and 10.2) I expericed a major slowdown. For all tests, all
config is the same, libraries and binaries where all the same on all
systems.

I've tried compiling php as cgi also, it helps a little bit, but it's still
too slow...

Thanks for any hints...

Nicolas

----- Original Message -----
From: "Nicolas Ross" <rossnick-listscybercat.ca>
To: <php-generallists.php.net>
Sent: Wednesday, September 14, 2005 9:00 AM
Subject: [PHP] php Slow with Mac OS X 10.4

> Hi all !
>
> Here, we've got several Mac computer acting as servers to serve many kinds
> of sites. One of wich was running, until the middle of august, Mac OS X
> 10.2. It was then with apache 1.3.x, and php 4.3.10 dso. All things were
> "normal".
>
> At the middle of august, we upgraded to Mac OS X 10.4 (re-install from
> scratch). Now, it's with apache2, php 4.4.0 dso. Now, everthing that is
> php
> is slow as hell. A page that took normally less than a second to render,
> now
> takes up to 15 ! Yes, fifteen seconds. That depends of course on the
> general
> load of the server, but it nevers goes down under 8 to 10 seconds.
>
> The machine is a dual G4, with 1.5 gigs of ram.
>
> Now, if I go to the command line, in the directory of this site and type
> "php index.php", it renders in about 1 to 1.5 seconds, wich is acceptable.
>
> I did tests with :
>
> - apache 1, php 4, php 5, all static or dso
> - apache 2, php 4, php 5, dso
> - php 4.3, php 4.4
> - Stock php that comes with Tiger
> - Stock apache that comes with Tiger
> - Different compile options with mysql as --with-mysql
> and --with-mysql=/usr/local/mysql
> - I've also tried with and without zend optimizer, turck mmcache.
>
> All with the same results.
>
> In my test case, there is mysql involved, but it's irrelevent to the
> problem, since the mysql is an another machine and is the same all trough
> my
> tests.
>
> Now, in a different server room, we have a set of 3 xserves cluster node
> dual g5 with 4 gigs of ram each. One of them was upgraded to Mac OS X 10.4
> (server) and the other 2 are still with 10.3.
>
> If I take the same setup (same compile options, same versions) on these
> machines, the exact same site is slow as hell on the 10.4, and lightning
> fast on 10.3.
>
>
> Here's my php configure command :
>
> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-fbsql
> --with-xml --enable-ftp --with-curl=/sw --with-zlib --with-png-dir=/sw --with-jpeg-dir=/sw
> --with-gd --with-ttf=/sw --with-freetype-dir=/sw --enable-track-vars --enable-trans-id
> --disable-debug
>
>
> This is really begins to bugs me...
>
> Any hints ?

attached mail follows:


I haven't had any problems with slowdowns on 10.4. Usually when there
are slowdowns on the Mac like you indicate, it has something to do
with DNS lookups being performed. Apple seems to be having a hard
time getting this right. You could problem find a ton of posts on
very slow ssh on the Apple forums that have to do with DNS.

Have you figured out what the computer is doing when a page is taking
that long? You mention it seems to point to an IO problem, have you
used iostat (or fs_usage) to verify it's disk IO? My first guess is
something with the network and you have to wait for a lookup,
response or timeout, which is why it's taking at a minimum 10
seconds. Again, I would check DNS first, the most obvious being
Apache resolving IP addresses for the log (don't do it).

On Oct 24, 2005, at 12:44 PM, Nicolas Ross wrote:

> Just a little follow-up to my own post.
>
> From the latest expriments I've done with a fresh install of OS X
> 10.4 (with the latest 10.4.3 beta update), it seems to point to an
> IO problem.
>
> My test site uses mambo as a CMS, and I've inclued collecting of
> microseconds timestamps at key points of the index file, and
> whenever it includes some files it slows down. It's worse when
> there are several nested includes. One other point is the mysql db
> connection.
>
> I must recall to all that when called from the cli, it's ok. Only
> when called from apache (1 or 2), dso or static and only on Mac OS
> X 10.4 (it's ok with 10.3 and 10.2) I expericed a major slowdown.
> For all tests, all config is the same, libraries and binaries where
> all the same on all systems.
>
> I've tried compiling php as cgi also, it helps a little bit, but
> it's still too slow...
>
> Thanks for any hints...
>
> Nicolas
>
> ----- Original Message ----- From: "Nicolas Ross" <rossnick-
> listscybercat.ca>
> To: <php-generallists.php.net>
> Sent: Wednesday, September 14, 2005 9:00 AM
> Subject: [PHP] php Slow with Mac OS X 10.4
>
>
>
>> Hi all !
>>
>> Here, we've got several Mac computer acting as servers to serve
>> many kinds
>> of sites. One of wich was running, until the middle of august, Mac
>> OS X
>> 10.2. It was then with apache 1.3.x, and php 4.3.10 dso. All
>> things were
>> "normal".
>>
>> At the middle of august, we upgraded to Mac OS X 10.4 (re-install
>> from
>> scratch). Now, it's with apache2, php 4.4.0 dso. Now, everthing
>> that is php
>> is slow as hell. A page that took normally less than a second to
>> render, now
>> takes up to 15 ! Yes, fifteen seconds. That depends of course on
>> the general
>> load of the server, but it nevers goes down under 8 to 10 seconds.
>>
>> The machine is a dual G4, with 1.5 gigs of ram.
>>
>> Now, if I go to the command line, in the directory of this site
>> and type
>> "php index.php", it renders in about 1 to 1.5 seconds, wich is
>> acceptable.
>>
>> I did tests with :
>>
>> - apache 1, php 4, php 5, all static or dso
>> - apache 2, php 4, php 5, dso
>> - php 4.3, php 4.4
>> - Stock php that comes with Tiger
>> - Stock apache that comes with Tiger
>> - Different compile options with mysql as --with-mysql
>> and --with-mysql=/usr/local/mysql
>> - I've also tried with and without zend optimizer, turck mmcache.
>>
>> All with the same results.
>>
>> In my test case, there is mysql involved, but it's irrelevent to the
>> problem, since the mysql is an another machine and is the same all
>> trough my
>> tests.
>>
>> Now, in a different server room, we have a set of 3 xserves
>> cluster node
>> dual g5 with 4 gigs of ram each. One of them was upgraded to Mac
>> OS X 10.4
>> (server) and the other 2 are still with 10.3.
>>
>> If I take the same setup (same compile options, same versions) on
>> these
>> machines, the exact same site is slow as hell on the 10.4, and
>> lightning
>> fast on 10.3.
>>
>>
>> Here's my php configure command :
>>
>> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
>> --with-fbsql
>> --with-xml --enable-ftp --with-curl=/sw --with-zlib --with-png-
>> dir=/sw --with-jpeg-dir=/sw
>> --with-gd --with-ttf=/sw --with-freetype-dir=/sw --enable-track-
>> vars --enable-trans-id
>> --disable-debug
>>
>>
>> This is really begins to bugs me...
>>
>> Any hints ?
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

attached mail follows:


I'm no fs_usage expert, so I have no idea on how to profile IO with
it. I do know/see very high CPU usage when running PHP. The httpd
process takes up to 70% of CPU capacity. This 'peak' can take about 4
to 8 seconds for example.

So I'm tempted to rule out DNS issues. Also because static (html)
files and simple php files (without includes) are very fast.

Any tips on fs_usage etc. are still welcome though.

> I haven't had any problems with slowdowns on 10.4. Usually when
> there are slowdowns on the Mac like you indicate, it has something
> to do with DNS lookups being performed. Apple seems to be having a
> hard time getting this right. You could problem find a ton of posts
> on very slow ssh on the Apple forums that have to do with DNS.
>
> Have you figured out what the computer is doing when a page is
> taking that long? You mention it seems to point to an IO problem,
> have you used iostat (or fs_usage) to verify it's disk IO? My first
> guess is something with the network and you have to wait for a
> lookup, response or timeout, which is why it's taking at a minimum
> 10 seconds. Again, I would check DNS first, the most obvious being
> Apache resolving IP addresses for the log (don't do it).

attached mail follows:


As stated before in this thread, in my case it's nothing about dns.

On 2 machines I have, both were 10.3, one was upgraded to 10.4, the other
not. Nothing else has changed. On the 10.4, it's slow, on the 10.3, it's
fast. All dns lookup is off in all apache config...

I did an iostat when I experience the slowdown, and I get no noticable disk
activity.

With fs_usager (that I didn't know), I get in about 1 second 57k lines of
activity ! But still appears (with the timestamps I see) take only about 1
second.

With netstat -an, besides the mysql connection and the http connection, I
see nothing else waiting to return...

BTW, on my test machine, there is nothing else running or other "live"
site...

Brent, can you tell me what kind of php application you're running on os x
10.4 ? Can you share your apache config ? What king of setup do you have
(what apache, php etc.) ?

Thanks,

Nicolas

----- Original Message -----
From: "Brent Baisley" <brentlandover.com>
To: "Nicolas Ross" <rossnick-listscybercat.ca>
Cc: <php-generallists.php.net>; "Shawn Moore" <shawnheliumflash.com>;
"Atelier Fabien" <infoatelierfabien.be>
Sent: Monday, October 24, 2005 3:13 PM
Subject: Re: [PHP] php Slow with Mac OS X 10.4

>I haven't had any problems with slowdowns on 10.4. Usually when there are
>slowdowns on the Mac like you indicate, it has something to do with DNS
>lookups being performed. Apple seems to be having a hard time getting this
>right. You could problem find a ton of posts on very slow ssh on the Apple
>forums that have to do with DNS.
>
> Have you figured out what the computer is doing when a page is taking
> that long? You mention it seems to point to an IO problem, have you used
> iostat (or fs_usage) to verify it's disk IO? My first guess is something
> with the network and you have to wait for a lookup, response or timeout,
> which is why it's taking at a minimum 10 seconds. Again, I would check
> DNS first, the most obvious being Apache resolving IP addresses for the
> log (don't do it).
>
>
>
> On Oct 24, 2005, at 12:44 PM, Nicolas Ross wrote:
>
>> Just a little follow-up to my own post.
>>
>> From the latest expriments I've done with a fresh install of OS X 10.4
>> (with the latest 10.4.3 beta update), it seems to point to an IO
>> problem.
>>
>> My test site uses mambo as a CMS, and I've inclued collecting of
>> microseconds timestamps at key points of the index file, and whenever it
>> includes some files it slows down. It's worse when there are several
>> nested includes. One other point is the mysql db connection.
>>
>> I must recall to all that when called from the cli, it's ok. Only when
>> called from apache (1 or 2), dso or static and only on Mac OS X 10.4
>> (it's ok with 10.3 and 10.2) I expericed a major slowdown. For all
>> tests, all config is the same, libraries and binaries where all the same
>> on all systems.
>>
>> I've tried compiling php as cgi also, it helps a little bit, but it's
>> still too slow...
>>
>> Thanks for any hints...
>>
>> Nicolas
>>
>> ----- Original Message ----- From: "Nicolas Ross" <rossnick-
>> listscybercat.ca>
>> To: <php-generallists.php.net>
>> Sent: Wednesday, September 14, 2005 9:00 AM
>> Subject: [PHP] php Slow with Mac OS X 10.4
>>
>>
>>
>>> Hi all !
>>>
>>> Here, we've got several Mac computer acting as servers to serve many
>>> kinds
>>> of sites. One of wich was running, until the middle of august, Mac OS X
>>> 10.2. It was then with apache 1.3.x, and php 4.3.10 dso. All things
>>> were
>>> "normal".
>>>
>>> At the middle of august, we upgraded to Mac OS X 10.4 (re-install from
>>> scratch). Now, it's with apache2, php 4.4.0 dso. Now, everthing that is
>>> php
>>> is slow as hell. A page that took normally less than a second to
>>> render, now
>>> takes up to 15 ! Yes, fifteen seconds. That depends of course on the
>>> general
>>> load of the server, but it nevers goes down under 8 to 10 seconds.
>>>
>>> The machine is a dual G4, with 1.5 gigs of ram.
>>>
>>> Now, if I go to the command line, in the directory of this site and
>>> type
>>> "php index.php", it renders in about 1 to 1.5 seconds, wich is
>>> acceptable.
>>>
>>> I did tests with :
>>>
>>> - apache 1, php 4, php 5, all static or dso
>>> - apache 2, php 4, php 5, dso
>>> - php 4.3, php 4.4
>>> - Stock php that comes with Tiger
>>> - Stock apache that comes with Tiger
>>> - Different compile options with mysql as --with-mysql
>>> and --with-mysql=/usr/local/mysql
>>> - I've also tried with and without zend optimizer, turck mmcache.
>>>
>>> All with the same results.
>>>
>>> In my test case, there is mysql involved, but it's irrelevent to the
>>> problem, since the mysql is an another machine and is the same all
>>> trough my
>>> tests.
>>>
>>> Now, in a different server room, we have a set of 3 xserves cluster
>>> node
>>> dual g5 with 4 gigs of ram each. One of them was upgraded to Mac OS X
>>> 10.4
>>> (server) and the other 2 are still with 10.3.
>>>
>>> If I take the same setup (same compile options, same versions) on these
>>> machines, the exact same site is slow as hell on the 10.4, and
>>> lightning
>>> fast on 10.3.
>>>
>>>
>>> Here's my php configure command :
>>>
>>>
>>> /configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-fbsql
>>> --with-xml --enable-ftp --with-curl=/sw --with-zlib --with-png-
>>> dir=/sw --with-jpeg-dir=/sw
>>> --with-gd --with-ttf=/sw --with-freetype-dir=/sw --enable-track-
>>> vars --enable-trans-id
>>> --disable-debug
>>>
>>>
>>> This is really begins to bugs me...
>>>
>>> Any hints ?
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
> --
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I must point out also, that during this time, the httpd thread that servers
my request is taking 100% of cpu for the whole 8 or 10 seconds...

Thanks,

Nicolas

----- Original Message -----
From: "Brent Baisley" <brentlandover.com>
To: "Nicolas Ross" <rossnick-listscybercat.ca>
Cc: <php-generallists.php.net>; "Shawn Moore" <shawnheliumflash.com>;
"Atelier Fabien" <infoatelierfabien.be>
Sent: Monday, October 24, 2005 3:13 PM
Subject: Re: [PHP] php Slow with Mac OS X 10.4

>I haven't had any problems with slowdowns on 10.4. Usually when there are
>slowdowns on the Mac like you indicate, it has something to do with DNS
>lookups being performed. Apple seems to be having a hard time getting this
>right. You could problem find a ton of posts on very slow ssh on the Apple
>forums that have to do with DNS.
>
> Have you figured out what the computer is doing when a page is taking
> that long? You mention it seems to point to an IO problem, have you used
> iostat (or fs_usage) to verify it's disk IO? My first guess is something
> with the network and you have to wait for a lookup, response or timeout,
> which is why it's taking at a minimum 10 seconds. Again, I would check
> DNS first, the most obvious being Apache resolving IP addresses for the
> log (don't do it).
>
>
>
> On Oct 24, 2005, at 12:44 PM, Nicolas Ross wrote:
>
>> Just a little follow-up to my own post.
>>
>> From the latest expriments I've done with a fresh install of OS X 10.4
>> (with the latest 10.4.3 beta update), it seems to point to an IO
>> problem.
>>
>> My test site uses mambo as a CMS, and I've inclued collecting of
>> microseconds timestamps at key points of the index file, and whenever it
>> includes some files it slows down. It's worse when there are several
>> nested includes. One other point is the mysql db connection.
>>
>> I must recall to all that when called from the cli, it's ok. Only when
>> called from apache (1 or 2), dso or static and only on Mac OS X 10.4
>> (it's ok with 10.3 and 10.2) I expericed a major slowdown. For all
>> tests, all config is the same, libraries and binaries where all the same
>> on all systems.
>>
>> I've tried compiling php as cgi also, it helps a little bit, but it's
>> still too slow...
>>
>> Thanks for any hints...
>>
>> Nicolas
>>
>> ----- Original Message ----- From: "Nicolas Ross" <rossnick-
>> listscybercat.ca>
>> To: <php-generallists.php.net>
>> Sent: Wednesday, September 14, 2005 9:00 AM
>> Subject: [PHP] php Slow with Mac OS X 10.4
>>
>>
>>
>>> Hi all !
>>>
>>> Here, we've got several Mac computer acting as servers to serve many
>>> kinds
>>> of sites. One of wich was running, until the middle of august, Mac OS X
>>> 10.2. It was then with apache 1.3.x, and php 4.3.10 dso. All things
>>> were
>>> "normal".
>>>
>>> At the middle of august, we upgraded to Mac OS X 10.4 (re-install from
>>> scratch). Now, it's with apache2, php 4.4.0 dso. Now, everthing that is
>>> php
>>> is slow as hell. A page that took normally less than a second to
>>> render, now
>>> takes up to 15 ! Yes, fifteen seconds. That depends of course on the
>>> general
>>> load of the server, but it nevers goes down under 8 to 10 seconds.
>>>
>>> The machine is a dual G4, with 1.5 gigs of ram.
>>>
>>> Now, if I go to the command line, in the directory of this site and
>>> type
>>> "php index.php", it renders in about 1 to 1.5 seconds, wich is
>>> acceptable.
>>>
>>> I did tests with :
>>>
>>> - apache 1, php 4, php 5, all static or dso
>>> - apache 2, php 4, php 5, dso
>>> - php 4.3, php 4.4
>>> - Stock php that comes with Tiger
>>> - Stock apache that comes with Tiger
>>> - Different compile options with mysql as --with-mysql
>>> and --with-mysql=/usr/local/mysql
>>> - I've also tried with and without zend optimizer, turck mmcache.
>>>
>>> All with the same results.
>>>
>>> In my test case, there is mysql involved, but it's irrelevent to the
>>> problem, since the mysql is an another machine and is the same all
>>> trough my
>>> tests.
>>>
>>> Now, in a different server room, we have a set of 3 xserves cluster
>>> node
>>> dual g5 with 4 gigs of ram each. One of them was upgraded to Mac OS X
>>> 10.4
>>> (server) and the other 2 are still with 10.3.
>>>
>>> If I take the same setup (same compile options, same versions) on these
>>> machines, the exact same site is slow as hell on the 10.4, and
>>> lightning
>>> fast on 10.3.
>>>
>>>
>>> Here's my php configure command :
>>>
>>>
>>> /configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-fbsql
>>> --with-xml --enable-ftp --with-curl=/sw --with-zlib --with-png-
>>> dir=/sw --with-jpeg-dir=/sw
>>> --with-gd --with-ttf=/sw --with-freetype-dir=/sw --enable-track-
>>> vars --enable-trans-id
>>> --disable-debug
>>>
>>>
>>> This is really begins to bugs me...
>>>
>>> Any hints ?
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
> --
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


You certainly wouldn't want to do just fs_usage. Typing something
like "fs_usage httpd" will show you just what the httpd process is
accessing. Read the man pages for other options that may be helpful.

I've got a few things running on OSX 10.4, although none that handle
lots of traffic. Public sites:
dutchessfootball.com - a football pool, the picks page is the slowest
to load. That's on a single cpu 1.25 G4 512MB RAM
heardthroughthegrapevine.com - wine tasting site, nothing fancy or
that complicated. That's on a 400Mhz G4 384MB RAM.

The big application is internal to my company and has about 285 "web"
files total, and about 45 mysql tables (contacts, companies, resumes
invoices, jobs, emails, journal,etc). They all have lots of includes
since I use a custom templating system to separate php from html. I
do not use PEAR or any content management system, I found them too
slow. I know a few people who have looked at Mambo and rejected it
because of it's CPU load, although they were all using Windows
servers. I've never looked into why Mambo has high CPU requirements.

Is it just the Mambo parts you are having problems with or is it php
in general?

With 100% CPU, we've narrowed it down to something there. Now we need
to figure out why the CPU is the bottleneck.

On Oct 24, 2005, at 4:21 PM, Nicolas Ross wrote:

> As stated before in this thread, in my case it's nothing about dns.
>
> On 2 machines I have, both were 10.3, one was upgraded to 10.4, the
> other not. Nothing else has changed. On the 10.4, it's slow, on the
> 10.3, it's fast. All dns lookup is off in all apache config...
>
> I did an iostat when I experience the slowdown, and I get no
> noticable disk activity.
>
> With fs_usager (that I didn't know), I get in about 1 second 57k
> lines of activity ! But still appears (with the timestamps I see)
> take only about 1 second.
>
> With netstat -an, besides the mysql connection and the http
> connection, I see nothing else waiting to return...
>
> BTW, on my test machine, there is nothing else running or other
> "live" site...
>
> Brent, can you tell me what kind of php application you're running
> on os x 10.4 ? Can you share your apache config ? What king of
> setup do you have (what apache, php etc.) ?
>
> Thanks,
>
> Nicolas
>
> ----- Original Message ----- From: "Brent Baisley"
> <brentlandover.com>
> To: "Nicolas Ross" <rossnick-listscybercat.ca>
> Cc: <php-generallists.php.net>; "Shawn Moore"
> <shawnheliumflash.com>; "Atelier Fabien" <infoatelierfabien.be>
> Sent: Monday, October 24, 2005 3:13 PM
> Subject: Re: [PHP] php Slow with Mac OS X 10.4
>
>
>
>> I haven't had any problems with slowdowns on 10.4. Usually when
>> there are slowdowns on the Mac like you indicate, it has
>> something to do with DNS lookups being performed. Apple seems to
>> be having a hard time getting this right. You could problem find
>> a ton of posts on very slow ssh on the Apple forums that have to
>> do with DNS.
>>
>> Have you figured out what the computer is doing when a page is
>> taking that long? You mention it seems to point to an IO problem,
>> have you used iostat (or fs_usage) to verify it's disk IO? My
>> first guess is something with the network and you have to wait
>> for a lookup, response or timeout, which is why it's taking at a
>> minimum 10 seconds. Again, I would check DNS first, the most
>> obvious being Apache resolving IP addresses for the log (don't do
>> it).
>>
>>
>>
>> On Oct 24, 2005, at 12:44 PM, Nicolas Ross wrote:
>>
>>
>>> Just a little follow-up to my own post.
>>>
>>> From the latest expriments I've done with a fresh install of OS
>>> X 10.4 (with the latest 10.4.3 beta update), it seems to point
>>> to an IO problem.
>>>
>>> My test site uses mambo as a CMS, and I've inclued collecting of
>>> microseconds timestamps at key points of the index file, and
>>> whenever it includes some files it slows down. It's worse when
>>> there are several nested includes. One other point is the mysql
>>> db connection.
>>>
>>> I must recall to all that when called from the cli, it's ok.
>>> Only when called from apache (1 or 2), dso or static and only on
>>> Mac OS X 10.4 (it's ok with 10.3 and 10.2) I expericed a major
>>> slowdown. For all tests, all config is the same, libraries and
>>> binaries where all the same on all systems.
>>>
>>> I've tried compiling php as cgi also, it helps a little bit, but
>>> it's still too slow...
>>>
>>> Thanks for any hints...
>>>
>>> Nicolas
>>>
>>> ----- Original Message ----- From: "Nicolas Ross" <rossnick-
>>> listscybercat.ca>
>>> To: <php-generallists.php.net>
>>> Sent: Wednesday, September 14, 2005 9:00 AM
>>> Subject: [PHP] php Slow with Mac OS X 10.4
>>>
>>>
>>>
>>>
>>>> Hi all !
>>>>
>>>> Here, we've got several Mac computer acting as servers to serve
>>>> many kinds
>>>> of sites. One of wich was running, until the middle of august,
>>>> Mac OS X
>>>> 10.2. It was then with apache 1.3.x, and php 4.3.10 dso. All
>>>> things were
>>>> "normal".
>>>>
>>>> At the middle of august, we upgraded to Mac OS X 10.4 (re-
>>>> install from
>>>> scratch). Now, it's with apache2, php 4.4.0 dso. Now, everthing
>>>> that is php
>>>> is slow as hell. A page that took normally less than a second to
>>>> render, now
>>>> takes up to 15 ! Yes, fifteen seconds. That depends of course
>>>> on the general
>>>> load of the server, but it nevers goes down under 8 to 10 seconds.
>>>>
>>>> The machine is a dual G4, with 1.5 gigs of ram.
>>>>
>>>> Now, if I go to the command line, in the directory of this site
>>>> and type
>>>> "php index.php", it renders in about 1 to 1.5 seconds, wich is
>>>> acceptable.
>>>>
>>>> I did tests with :
>>>>
>>>> - apache 1, php 4, php 5, all static or dso
>>>> - apache 2, php 4, php 5, dso
>>>> - php 4.3, php 4.4
>>>> - Stock php that comes with Tiger
>>>> - Stock apache that comes with Tiger
>>>> - Different compile options with mysql as --with-mysql
>>>> and --with-mysql=/usr/local/mysql
>>>> - I've also tried with and without zend optimizer, turck mmcache.
>>>>
>>>> All with the same results.
>>>>
>>>> In my test case, there is mysql involved, but it's irrelevent to
>>>> the
>>>> problem, since the mysql is an another machine and is the same
>>>> all trough my
>>>> tests.
>>>>
>>>> Now, in a different server room, we have a set of 3 xserves
>>>> cluster node
>>>> dual g5 with 4 gigs of ram each. One of them was upgraded to
>>>> Mac OS X 10.4
>>>> (server) and the other 2 are still with 10.3.
>>>>
>>>> If I take the same setup (same compile options, same versions)
>>>> on these
>>>> machines, the exact same site is slow as hell on the 10.4, and
>>>> lightning
>>>> fast on 10.3.
>>>>
>>>>
>>>> Here's my php configure command :
>>>>
>>>> /configure --with-apxs2=/usr/local/apache2/bin/apxs --with-
>>>> mysql --with-fbsql
>>>> --with-xml --enable-ftp --with-curl=/sw --with-zlib --with-png-
>>>> dir=/sw --with-jpeg-dir=/sw
>>>> --with-gd --with-ttf=/sw --with-freetype-dir=/sw --enable-track-
>>>> vars --enable-trans-id
>>>> --disable-debug
>>>>
>>>>
>>>> This is really begins to bugs me...
>>>>
>>>> Any hints ?
>>>>
>>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>>
>>
>> --
>> Brent Baisley
>> Systems Architect
>> Landover Associates, Inc.
>> Search & Advisory Services for Advanced Technology Environments
>> p: 212.759.6400/800.759.0577
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

attached mail follows:


On Mon, October 24, 2005 3:21 pm, Nicolas Ross wrote:
> As stated before in this thread, in my case it's nothing about dns.

You've pointed to 2 potential problems so far.

1 is mysql_connect()

2 is include '';

Can you run a quick test to find out which one is WORSE, and focus on
that first?

If it's MySQL, just for fun, consider trying some of these thing:
1. mysql command line monitor.
2. Perl + MySQL (or anything not PHP, just to see)
3. mysql_pconnect

If it's "include" that is slow, check:
1. What is include_path? Does it contain non-existent directories?
2. Does include_path contain directories with a zillion things in them?

Also start running hardware component checks.

Maybe 10.4 (or whatever is the bad one) is triggering something that
never got utilized in 10.3, like maybe they just got dual CPU to
actually be used, or maybe their RAM management changed how it works,
or maybe disk drivers are now allocating hard drive chunks
"differently" or... So bad hardware could be behind it all.

I got no idea what tools are out there these to test Mac RAM / HD etc,
but I presume they are out there...

Is Dr. Norton still in the house? Man, I go back a long way with
Macs. I rembmer when Dr. Norton was new and cool. :-)

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

attached mail follows:


Hi!

I have to move my website from Windows hosting to a linux hosting machine.
Does anyone have special tips, procedures I should consider?
(Like changing directory paths from \ to / ).

It's a classifieds posting website and it's in final testing stage.

Pedro.
Apologies for my bad English.

attached mail follows:


pedro mpa said the following on 10/24/05 10:13:
> Hi!
>
> I have to move my website from Windows hosting to a linux hosting machine.
> Does anyone have special tips, procedures I should consider?
> (Like changing directory paths from \ to / ).
>
> It's a classifieds posting website and it's in final testing stage.
>
> Pedro.
> Apologies for my bad English.

Absolutely nothing wrong with your english!

Aside from the paths you will want to check any system calls that you
are doing. The only problem I have ever run into was that I had the
error reporting level set differently on one platform than the other so
I was getting errors about undeclared variables (bad habit) on one
platform that I wasn't getting on the other.

Otherwise I think you will find the move to be relatively painless.
That said, I'd start testing on the Linux server as soon as possible
just in case.

- Ben

attached mail follows:


Find out if the linux box is using a case sensitive file system. If
it is, you need to make sure all your calls to other files use the
right case. This was an extremely common problem in the beginning of
the .com boom.

On Oct 24, 2005, at 1:13 PM, pedro mpa wrote:

> Hi!
>
> I have to move my website from Windows hosting to a linux hosting
> machine.
> Does anyone have special tips, procedures I should consider?
> (Like changing directory paths from \ to / ).
>
> It's a classifieds posting website and it's in final testing stage.
>
> Pedro.
> Apologies for my bad English.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

attached mail follows:


Hi,

Why this doesn't work ?

---
$query = "SELECT COUNT (login) FROM WHERE login = '$login'";
$result = mysql_query($query);
mysql_fetch_row($result);
---

It gives me
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
result resource in /var/www/html/registar_action.php on line 22

Any help would be apreciated.

Warm Regards,
Mário Gamito

attached mail follows:


It looks to me like you forgot to specify the table in your query:

SELECT COUNT (login) FROM <TABLENAME GOES HERE> WHERE login = '$login'

> Hi,
>
> Why this doesn't work ?
>
> ---
> $query = "SELECT COUNT (login) FROM WHERE login = '$login'";
> $result = mysql_query($query);
> mysql_fetch_row($result);
> ---
>
> It gives me
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
> result resource in /var/www/html/registar_action.php on line 22
>
> Any help would be apreciated.
>
> Warm Regards,
> Mário Gamito
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

Thank you,
Colin Shreffler
Principal
303.349.9010 - cell
928.396.1099 - fax
colin.shrefflerwarp9software.com

Warp 9 Software, LLC.
6791 Halifax Avenue
Castle Rock, CO 80104

Confidentiality Notice: The information in this e-mail may be confidential
and/or privileged. This e-mail is intended to be reviewed by only the
individual or organization named in the e-mail address. If you are not the
intended recipient, you are hereby notified that any review, dissemination
or copying of this e-mail and attachments, if any, or the information
contained herein, is strictly prohibited.

attached mail follows:


Hi,

Sorry, i do have the table name.
It just passed me while transcripting.

The code is:

---
$query = "SELECT COUNT (login) FROM formacao WHERE login = '$login'";
$result = mysql_query($query);
mysql_fetch_row($result);
---

It works perfectly on MySQL prompt.

Regards,
Mário Gamito

Colin Shreffler wrote:
> It looks to me like you forgot to specify the table in your query:
>
> SELECT COUNT (login) FROM <TABLENAME GOES HERE> WHERE login = '$login'
>
>
>>Hi,
>>
>>Why this doesn't work ?
>>
>>---
>>$query = "SELECT COUNT (login) FROM WHERE login = '$login'";
>>$result = mysql_query($query);
>>mysql_fetch_row($result);
>>---
>>
>>It gives me
>>Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
>>result resource in /var/www/html/registar_action.php on line 22
>>
>>Any help would be apreciated.
>>
>>Warm Regards,
>>Mário Gamito
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
>
>
> Thank you,
> Colin Shreffler
> Principal
> 303.349.9010 - cell
> 928.396.1099 - fax
> colin.shrefflerwarp9software.com
>
> Warp 9 Software, LLC.
> 6791 Halifax Avenue
> Castle Rock, CO 80104
>
> Confidentiality Notice: The information in this e-mail may be confidential
> and/or privileged. This e-mail is intended to be reviewed by only the
> individual or organization named in the e-mail address. If you are not the
> intended recipient, you are hereby notified that any review, dissemination
> or copying of this e-mail and attachments, if any, or the information
> contained herein, is strictly prohibited.
>

attached mail follows:


[snip]
---
$query = "SELECT COUNT (login) FROM formacao WHERE login = '$login'";
$result = mysql_query($query);
mysql_fetch_row($result);
---
[/snip]

mysql_query() requires a connections resource

$result = mysql_query($query, $myConnection);

attached mail follows:


>
> [snip]
> ---
> $query = "SELECT COUNT (login) FROM formacao WHERE login = '$login'";
> $result = mysql_query($query);
> mysql_fetch_row($result);
> ---
> [/snip]
>
> mysql_query() requires a connections resource
>
> $result = mysql_query($query, $myConnection);

The connection resource is optional. It will use the most recent connection
if not specified.

JM

attached mail follows:


> $query = "SELECT COUNT (login) FROM formacao WHERE login