Re: [PHP] How php works?

2006-12-19 Thread Robert Cummings
On Mon, 2006-12-18 at 19:42 -0600, Larry Garfield wrote:
 On Monday 18 December 2006 15:20, Richard Lynch wrote:
 
  Put it this way:  In 2000, if somebody wanted to embed the ZE in a
  commercial product, Zend was planning on charging for it.  I dunno
  what their license for the ZE reads like today, and I wasn't
  authorized to speak on this topic for them then, much less now.
 
 Is that why the PHP License is non-GPL compatible, or is there a different 
 reason for that?  (That's always bugged me, personally.)

PHP and license has less restrictions... it is not viral. You can for
the most part do as you please with the code.

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.  |
`'

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



Re: [PHP] How php works?

2006-12-19 Thread Larry Garfield
On Tuesday 19 December 2006 02:12, Robert Cummings wrote:

  Is that why the PHP License is non-GPL compatible, or is there a
  different reason for that?  (That's always bugged me, personally.)

 PHP and license has less restrictions... it is not viral. You can for
 the most part do as you please with the code.

That's nice.  It's also not what I asked.  I asked what it was that made it 
GPL-incompatible.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] How php works?

2006-12-19 Thread Rory Browne

That's nice.  It's also not what I asked.  I asked what it was that made it
GPL-incompatible.



 6. Redistributions of any form whatsoever must retain the following
acknowledgment:
This product includes PHP software, freely available from
http://www.php.net/software/.


I don't remember why, but this is incompatable with the GPL. IIRC,
it's the difference that makes the modified BSD Licence GPL
Compatable, and the Original BSD Licence Incompatable.

It's a practical problem if there are many such acknowlegment.

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



RE: [PHP] How php works?

2006-12-19 Thread Kristen G. Thorson
 -Original Message-
 From: Larry Garfield [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 19, 2006 10:26 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] How php works?
 
 On Tuesday 19 December 2006 02:12, Robert Cummings wrote:
 
   Is that why the PHP License is non-GPL compatible, or is there a
   different reason for that?  (That's always bugged me, personally.)
 
  PHP and license has less restrictions... it is not viral. You can
for
  the most part do as you please with the code.
 
 That's nice.  It's also not what I asked.  I asked what it was that
made
 it
 GPL-incompatible.



He did answer the question.  The PHP License doesn't enforce many
restrictions on what you can do with the code.  For example, you could
modify it (or not) and sell it without the source if you follow the
restrictions in the license.  The GPL specifically doesn't allow that of
course, so that's why they are incompatible.


http://www.fsf.org/licensing/licenses/index_html#GPLIncompatibleLicenses

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



Re: [PHP] How php works?

2006-12-19 Thread Robert Cummings
On Tue, 2006-12-19 at 09:25 -0600, Larry Garfield wrote:
 On Tuesday 19 December 2006 02:12, Robert Cummings wrote:
 
   Is that why the PHP License is non-GPL compatible, or is there a
   different reason for that?  (That's always bugged me, personally.)
 
  PHP and license has less restrictions... it is not viral. You can for
  the most part do as you please with the code.
 
 That's nice.  It's also not what I asked.  I asked what it was that made it 
 GPL-incompatible.

The answer lies in what I wrote. If you add GPL code to PHP then PHP
code can no longer be used in distributed closed source solutions. GPL
is viral, and it would choke that aspect of PHP's freedom.

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.  |
`'

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



Re: [PHP] How php works?

2006-12-18 Thread Richard Lynch
On Sat, December 16, 2006 6:24 am, Robert Cummings wrote:
 On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
 On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
  (*)
  Actually, if somebody wants to embed the ZE inside of something
 other
  than PHP, then I think Zend expects to get paid for that.

 I don't think so... the PHP and Zend licenses are quite liberal with
 very few restrictions. Namely that you don't call your software php or
 use php in the name (something many packages seem to ignore (either
 that
 or they got permission)). The Zend license is practically a clone of
 the
 PHP license with a search and replace for PHP to Zend :) There's
 nothing
 that says you have to pay to embed it in your own software. That said,
 if you make a product that uses either the PHP or Zend engine and
 makes
 oodles of money, I think you should feel somewhat morally obliged to
 give back in some way.

Put it this way:  In 2000, if somebody wanted to embed the ZE in a
commercial product, Zend was planning on charging for it.  I dunno
what their license for the ZE reads like today, and I wasn't
authorized to speak on this topic for them then, much less now.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] How php works?

2006-12-18 Thread Robert Cummings
On Mon, 2006-12-18 at 15:20 -0600, Richard Lynch wrote:
 On Sat, December 16, 2006 6:24 am, Robert Cummings wrote:
  On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
  On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
   (*)
   Actually, if somebody wants to embed the ZE inside of something
  other
   than PHP, then I think Zend expects to get paid for that.
 
  I don't think so... the PHP and Zend licenses are quite liberal with
  very few restrictions. Namely that you don't call your software php or
  use php in the name (something many packages seem to ignore (either
  that
  or they got permission)). The Zend license is practically a clone of
  the
  PHP license with a search and replace for PHP to Zend :) There's
  nothing
  that says you have to pay to embed it in your own software. That said,
  if you make a product that uses either the PHP or Zend engine and
  makes
  oodles of money, I think you should feel somewhat morally obliged to
  give back in some way.
 
 Put it this way:  In 2000, if somebody wanted to embed the ZE in a
 commercial product, Zend was planning on charging for it.  I dunno
 what their license for the ZE reads like today, and I wasn't
 authorized to speak on this topic for them then, much less now.

Hmmm, seems a tad risky upgrading software over a 6 year timespan
without ever checking that the licenses haven't discretely added a we
own your immortal soul clause :| Unless of course you're still using
PHP 4.0 or whatever was around back then (I'm guessing you're not since
you seem a fairly reasonable sort :)

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.  |
`'

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



Re: [PHP] How php works?

2006-12-18 Thread Larry Garfield
On Monday 18 December 2006 15:20, Richard Lynch wrote:

 Put it this way:  In 2000, if somebody wanted to embed the ZE in a
 commercial product, Zend was planning on charging for it.  I dunno
 what their license for the ZE reads like today, and I wasn't
 authorized to speak on this topic for them then, much less now.

Is that why the PHP License is non-GPL compatible, or is there a different 
reason for that?  (That's always bugged me, personally.)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] How php works?

2006-12-17 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-16 09:52:18 -0500:
 On Sat, 2006-12-16 at 15:59 +, Roman Neuhauser wrote:
  # [EMAIL PROTECTED] / 2006-12-16 07:24:49 -0500:
   On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
 (*)
 Actually, if somebody wants to embed the ZE inside of something other
 than PHP, then I think Zend expects to get paid for that.
   
   I don't think so... the PHP and Zend licenses are quite liberal with
   very few restrictions. Namely that you don't call your software php or
   use php in the name (something many packages seem to ignore (either that
   or they got permission)). The Zend license is practically a clone of the
   PHP license with a search and replace for PHP to Zend :) There's nothing
   that says you have to pay to embed it in your own software. That said,
   if you make a product that uses either the PHP or Zend engine and makes
   oodles of money, I think you should feel somewhat morally obliged to
   give back in some way.
  
  Sorry if I take this OT, but when I publish my work under the MIT license,
  I mean it. Anything else would be hypocrisy. OSS is not beggarware.
 
 I'm not sure I understand the point you are making :/

That the license states everything he needs to feel obliged to.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] How php works?

2006-12-17 Thread Robert Cummings
On Sun, 2006-12-17 at 14:41 +, Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-12-16 09:52:18 -0500:
  On Sat, 2006-12-16 at 15:59 +, Roman Neuhauser wrote:
   # [EMAIL PROTECTED] / 2006-12-16 07:24:49 -0500:
On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
 On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
  (*)
  Actually, if somebody wants to embed the ZE inside of something 
  other
  than PHP, then I think Zend expects to get paid for that.

I don't think so... the PHP and Zend licenses are quite liberal with
very few restrictions. Namely that you don't call your software php or
use php in the name (something many packages seem to ignore (either that
or they got permission)). The Zend license is practically a clone of the
PHP license with a search and replace for PHP to Zend :) There's nothing
that says you have to pay to embed it in your own software. That said,
if you make a product that uses either the PHP or Zend engine and makes
oodles of money, I think you should feel somewhat morally obliged to
give back in some way.
   
   Sorry if I take this OT, but when I publish my work under the MIT license,
   I mean it. Anything else would be hypocrisy. OSS is not beggarware.
  
  I'm not sure I understand the point you are making :/
 
 That the license states everything he needs to feel obliged to.

Ah well, I was stating my opinion denoted by I think. Sorry to have
wrinkled your panties.

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.  |
`'

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



Re: [PHP] How php works?

2006-12-16 Thread Kai Xiang

On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Fri, December 15, 2006 3:32 am, Kai Xiang wrote:
 Oh, that's interesting to know, is that from certain test of design
 goals? I
 suspect this for I thought the most time-consuming work in PHP should
 be
 compiling.

The most time consuming work in PHP isn't in PHP at all. :-)

It's in the database, the file system, the network congestion...

It's true, that for the core of PHP, for what little time is spent by
PHP doing anything at all, compiling the code to opcode takes longer
than ripping through those opcodes and dispatching the function call
to some external library, not counting the time spent outside of PHP
core actually executing whatever that extension library does.

That still doesn't mean that the actual process of converting PHP
echo to opcode #42 takes any large chunk of time.  It's very tiny.

 Refer to the early descussion,  because all the thread share the same
 opcode, so it could save memory usage at the same time, is that true?
 say if
 there is a lot of requests at the same time, that could be a lot of
 memories. is that the design goal? or why not just implement a PHP
 file
 cache.

Because if you just did the file cache, it would be an equal amount of
work to doing the opcode cache, so you might as well go ahead and
cache the opcode, and save that extra 1% performance.

Caching the parser output as opcodes instead of raw PHP input is like
free gravy. :-)

It's a question of inserting your cache calls in line 1470 or line
1530, and you either cache the PHP source at 1470, or the opcode
output at 1530.  So you do it at 1530 and save those lines of code in
between that do the opcode translation.
[line numbers used for illustrative purposes, and are not actual line
numbers, nor even realistic range between them]



That's really useful information, thanks


 2. Is there some alternative choise except zend engineen, why need

 a
  zend
  engine? for performance advantage or just easy for porting to
  different
  platform?

You could, in theory, take PHP, rip out its guts (aka the Zend Engine)
and replace it with some other compiler/parser/engine that did much
the same thing, if you had nothing better to do with your life for the
next several years...



I'm just curious, I'll save more time for fun... :)


The Zend Engine is what translates:


if (...){
  myfunction(...);
}

into something that the computer can actually execute.

That's pretty much all it is.

Note that the Zend Engine is OPEN SOURCE and it will always be OPEN
SOURCE and it will never not be OPEN SOURCE and it is FREE and it will
always be FREE and it will never not be FREE (*) for PHP.

But, sure, if you feel strongly enough about it, go ahead and fork the
PHP project to rip out the Zend Engine and write your own.
[shrug]

That's why it's Open Source, to give you the freedom to do that.

Seems like an awful lot of work to no real purpose to this naive
reader, but to each their own.

(*)
Actually, if somebody wants to embed the ZE inside of something other
than PHP, then I think Zend expects to get paid for that.  I do know
they had a deal or two on the table when I worked for them, back in
2000 or so, but I dunno if they came to fruition or not.  ZE may well
be embedded in some telecom gear somewhere, as it would be a good fit
for a simple scripting language that is small enough (without
extensions) to fit in that niche market.  And the telco industry can
afford whatever Zend charged them for that, most likely.



Yes, we know there is a possibility that Opensource can make money, and
bring value for those who don't want to pay at the same time..

--

Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




Re: [PHP] How php works?

2006-12-16 Thread Robert Cummings
On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
 On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
  (*)
  Actually, if somebody wants to embed the ZE inside of something other
  than PHP, then I think Zend expects to get paid for that.

I don't think so... the PHP and Zend licenses are quite liberal with
very few restrictions. Namely that you don't call your software php or
use php in the name (something many packages seem to ignore (either that
or they got permission)). The Zend license is practically a clone of the
PHP license with a search and replace for PHP to Zend :) There's nothing
that says you have to pay to embed it in your own software. That said,
if you make a product that uses either the PHP or Zend engine and makes
oodles of money, I think you should feel somewhat morally obliged to
give back in some way.

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.  |
`'

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



Re: [PHP] How php works?

2006-12-16 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-16 07:24:49 -0500:
 On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
  On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
   (*)
   Actually, if somebody wants to embed the ZE inside of something other
   than PHP, then I think Zend expects to get paid for that.
 
 I don't think so... the PHP and Zend licenses are quite liberal with
 very few restrictions. Namely that you don't call your software php or
 use php in the name (something many packages seem to ignore (either that
 or they got permission)). The Zend license is practically a clone of the
 PHP license with a search and replace for PHP to Zend :) There's nothing
 that says you have to pay to embed it in your own software. That said,
 if you make a product that uses either the PHP or Zend engine and makes
 oodles of money, I think you should feel somewhat morally obliged to
 give back in some way.

Sorry if I take this OT, but when I publish my work under the MIT license,
I mean it. Anything else would be hypocrisy. OSS is not beggarware.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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




Re: [PHP] How php works?

2006-12-16 Thread Robert Cummings
On Sat, 2006-12-16 at 15:59 +, Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-12-16 07:24:49 -0500:
  On Sat, 2006-12-16 at 19:58 +0800, Kai Xiang wrote:
   On 12/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
(*)
Actually, if somebody wants to embed the ZE inside of something other
than PHP, then I think Zend expects to get paid for that.
  
  I don't think so... the PHP and Zend licenses are quite liberal with
  very few restrictions. Namely that you don't call your software php or
  use php in the name (something many packages seem to ignore (either that
  or they got permission)). The Zend license is practically a clone of the
  PHP license with a search and replace for PHP to Zend :) There's nothing
  that says you have to pay to embed it in your own software. That said,
  if you make a product that uses either the PHP or Zend engine and makes
  oodles of money, I think you should feel somewhat morally obliged to
  give back in some way.
 
 Sorry if I take this OT, but when I publish my work under the MIT license,
 I mean it. Anything else would be hypocrisy. OSS is not beggarware.

I'm not sure I understand the point you are making :/

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.  |
`'

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



Re: [PHP] How php works?

2006-12-15 Thread Kai Xiang

On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Wed, December 13, 2006 12:15 am, Kai Xiang wrote:
 1. I heard there is a zend engine inside PHP playing the role as a
 virtual
 machine, and PHP excution have 2 step, first compile to opcode and
 then
 excute the opcode,
 so is that means the php are compiled only once per file? or still
 need to
 recompile when another request issued to the server? also I heard
 about the
 caching extention about php, is it talking about caching the opcode?
 is't
 caching the opcode or excute results? how it shares between the
 requests?

There is a Zend Engine inside the guts of PHP, and it does compile to
opcode and execute.

You can buy or find opcode cache software that will cache the
compiled opcode and run that on the next request.

Note that the BIG win there is not the compilation, but the hard drive
not getting hit to load in the PHP script.



Oh, that's interesting to know, is that from certain test of design goals? I
suspect this for I thought the most time-consuming work in PHP should be
compiling.

Refer to the early descussion,  because all the thread share the same
opcode, so it could save memory usage at the same time, is that true? say if
there is a lot of requests at the same time, that could be a lot of
memories. is that the design goal? or why not just implement a PHP file
cache.




 2. Is there some alternative choise except zend engineen, why need a
 zend
 engine? for performance advantage or just easy for porting to
 different
 platform?

The original PHP guts were a hand-crafted parser by Rasmus Lerdorf,
who, and this is NOT meant to be pejorative, had no idea what he was
doing :-)
He didn't know that there were tools out there to write new computer
languages, and didn't use them.
So his parser was, well, kinda buggy, actually.
Ze'ev and Andi gutted the system with a shiny new parser using the pro
tools for homework, and ended up being Core PHP Developers by
accident. :-)
So, that became the Zend Engine, as Ze'ev and Andi's idea of a Good
Time is not building PHP websites, but building cool tools to improve
the guts of PHP, which is also why they started Zend ( http://zend.com)
to sell high-end tools to high-end customers, like the Zend Cache.



:) PHP change it's gut to make it more fresh.



 3. Take linux apache for example, if compiled as a apache module, and
 using
 prefork threading model, for example, if I have 100 process, is that
 means I
 have 100 copy of PHP library local data(I assume only one reentrant
 excutable image) in each process? compare to a worker model, like 10
 process
 and 10 threads in each one process, should it make a difference that
 we only
 have 10 copy of PHP library local data ?

Yes, but if you don't use prefork, you have some serious thread safety
Risks, particularly in the extensions, and most especially in any
extensions that aren't getting heavy use already by people trying to
push into the threaded environment...

Stick with pre-fork unless your testing budget is 10 X your dev budget.

 I'm not sure if this is the right place to talk about this, anyway, if
 you
 know a better place, help me out :)

This is probably about as on-topic a post as one can get, though much
of the info is out there if you can sift through the junk to find
it.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




Re: [PHP] How php works?

2006-12-15 Thread Richard Lynch
On Fri, December 15, 2006 3:32 am, Kai Xiang wrote:
 Oh, that's interesting to know, is that from certain test of design
 goals? I
 suspect this for I thought the most time-consuming work in PHP should
 be
 compiling.

The most time consuming work in PHP isn't in PHP at all. :-)

It's in the database, the file system, the network congestion...

It's true, that for the core of PHP, for what little time is spent by
PHP doing anything at all, compiling the code to opcode takes longer
than ripping through those opcodes and dispatching the function call
to some external library, not counting the time spent outside of PHP
core actually executing whatever that extension library does.

That still doesn't mean that the actual process of converting PHP
echo to opcode #42 takes any large chunk of time.  It's very tiny.

 Refer to the early descussion,  because all the thread share the same
 opcode, so it could save memory usage at the same time, is that true?
 say if
 there is a lot of requests at the same time, that could be a lot of
 memories. is that the design goal? or why not just implement a PHP
 file
 cache.

Because if you just did the file cache, it would be an equal amount of
work to doing the opcode cache, so you might as well go ahead and
cache the opcode, and save that extra 1% performance.

Caching the parser output as opcodes instead of raw PHP input is like
free gravy. :-)

It's a question of inserting your cache calls in line 1470 or line
1530, and you either cache the PHP source at 1470, or the opcode
output at 1530.  So you do it at 1530 and save those lines of code in
between that do the opcode translation.
[line numbers used for illustrative purposes, and are not actual line
numbers, nor even realistic range between them]

  2. Is there some alternative choise except zend engineen, why need
 a
  zend
  engine? for performance advantage or just easy for porting to
  different
  platform?

You could, in theory, take PHP, rip out its guts (aka the Zend Engine)
and replace it with some other compiler/parser/engine that did much
the same thing, if you had nothing better to do with your life for the
next several years...

The Zend Engine is what translates:

if (...){
  myfunction(...);
}

into something that the computer can actually execute.

That's pretty much all it is.

Note that the Zend Engine is OPEN SOURCE and it will always be OPEN
SOURCE and it will never not be OPEN SOURCE and it is FREE and it will
always be FREE and it will never not be FREE (*) for PHP.

But, sure, if you feel strongly enough about it, go ahead and fork the
PHP project to rip out the Zend Engine and write your own.
[shrug]

That's why it's Open Source, to give you the freedom to do that.

Seems like an awful lot of work to no real purpose to this naive
reader, but to each their own.

(*)
Actually, if somebody wants to embed the ZE inside of something other
than PHP, then I think Zend expects to get paid for that.  I do know
they had a deal or two on the table when I worked for them, back in
2000 or so, but I dunno if they came to fruition or not.  ZE may well
be embedded in some telecom gear somewhere, as it would be a good fit
for a simple scripting language that is small enough (without
extensions) to fit in that niche market.  And the telco industry can
afford whatever Zend charged them for that, most likely.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] How php works?

2006-12-14 Thread Richard Lynch
On Wed, December 13, 2006 12:15 am, Kai Xiang wrote:
 1. I heard there is a zend engine inside PHP playing the role as a
 virtual
 machine, and PHP excution have 2 step, first compile to opcode and
 then
 excute the opcode,
 so is that means the php are compiled only once per file? or still
 need to
 recompile when another request issued to the server? also I heard
 about the
 caching extention about php, is it talking about caching the opcode?
 is't
 caching the opcode or excute results? how it shares between the
 requests?

There is a Zend Engine inside the guts of PHP, and it does compile to
opcode and execute.

You can buy or find opcode cache software that will cache the
compiled opcode and run that on the next request.

Note that the BIG win there is not the compilation, but the hard drive
not getting hit to load in the PHP script.

 2. Is there some alternative choise except zend engineen, why need a
 zend
 engine? for performance advantage or just easy for porting to
 different
 platform?

The original PHP guts were a hand-crafted parser by Rasmus Lerdorf,
who, and this is NOT meant to be pejorative, had no idea what he was
doing :-)
He didn't know that there were tools out there to write new computer
languages, and didn't use them.
So his parser was, well, kinda buggy, actually.
Ze'ev and Andi gutted the system with a shiny new parser using the pro
tools for homework, and ended up being Core PHP Developers by
accident. :-)
So, that became the Zend Engine, as Ze'ev and Andi's idea of a Good
Time is not building PHP websites, but building cool tools to improve
the guts of PHP, which is also why they started Zend (http://zend.com)
to sell high-end tools to high-end customers, like the Zend Cache.

 3. Take linux apache for example, if compiled as a apache module, and
 using
 prefork threading model, for example, if I have 100 process, is that
 means I
 have 100 copy of PHP library local data(I assume only one reentrant
 excutable image) in each process? compare to a worker model, like 10
 process
 and 10 threads in each one process, should it make a difference that
 we only
 have 10 copy of PHP library local data ?

Yes, but if you don't use prefork, you have some serious thread safety
Risks, particularly in the extensions, and most especially in any
extensions that aren't getting heavy use already by people trying to
push into the threaded environment...

Stick with pre-fork unless your testing budget is 10 X your dev budget.

 I'm not sure if this is the right place to talk about this, anyway, if
 you
 know a better place, help me out :)

This is probably about as on-topic a post as one can get, though much
of the info is out there if you can sift through the junk to find
it.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] How php works?

2006-12-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-13 14:15:26 +0800:
 I'm new here and looking PHP these days, howerver , I'm confused by how it
 works, and here is some questions I have.
 Is there any old bird wanna help me out?
 
 1. I heard there is a zend engine inside PHP playing the role as a virtual
 machine, and PHP excution have 2 step, first compile to opcode and then
 excute the opcode,
 so is that means the php are compiled only once per file? or still need to
 recompile when another request issued to the server? also I heard about the
 caching extention about php, is it talking about caching the opcode? is't
 caching the opcode or excute results? how it shares between the requests?

Both kinds of things exist, with different sharing strategies.
 
 3. Take linux apache for example, if compiled as a apache module, and using
 prefork threading model, for example, if I have 100 process, is that means I
 have 100 copy of PHP library local data(I assume only one reentrant
 excutable image) in each process? compare to a worker model, like 10 process
 and 10 threads in each one process, should it make a difference that we only
 have 10 copy of PHP library local data ?

Practical concerns make your question moot: even if the basic
distribution was all threadsafe, you're bound to hit a library that uses
strtok(3) or strerror(3), or static variables. How much of the code you
rely on is labelled by its authors as threadsafe?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] How php works?

2006-12-13 Thread Jochem Maas
Kai Xiang wrote:
 Hello all:
 
 I'm new here and looking PHP these days, howerver , I'm confused by how it
 works, and here is some questions I have.
 Is there any old bird wanna help me out?
 
 1. I heard there is a zend engine inside PHP playing the role as a virtual
 machine, and PHP excution have 2 step, first compile to opcode and then
 excute the opcode,
 so is that means the php are compiled only once per file? or still need to
 recompile when another request issued to the server? also I heard about the
 caching extention about php, is it talking about caching the opcode? is't
 caching the opcode or excute results? how it shares between the requests?

there are opcode caching mechanisms available (e.g. php.net/apc - which needs to
be installed via 'pecl'**); however the standard php installation will not do 
any
opcode caching (i.e. compilation to opcode is done at each request).

** pecl.php.net / pear.php.net
 
 2. Is there some alternative choise except zend engineen, why need a zend
 engine? for performance advantage or just easy for porting to different
 platform?

no, there is no plugin replacement for the zend engine and AFAIK the zend engine
is not used in any other products apart from php ... maybe zend.com has an
article on what exactly the zend engine is (I have never really bothered to
find out myself :-).

 
 3. Take linux apache for example, if compiled as a apache module, and using
 prefork threading model, for example, if I have 100 process, is that
 means I
 have 100 copy of PHP library local data(I assume only one reentrant
 excutable image) in each process? compare to a worker model, like 10
 process
 and 10 threads in each one process, should it make a difference that we
 only
 have 10 copy of PHP library local data ?

php is not threadsafe (well actually some php extensions are not thread safe ...
it's an unknown quantity) the prefork worker module for apache2 is the only
recommended way to go (if running as an apache module)

you might want to look into the FastCGI SAPI if you need a speed boost ...
I can't tell you anything about it because I have no experience with it as such.

 
 I'm not sure if this is the right place to talk about this, anyway, if you
 know a better place, help me out :)

this is the place - always best to ask here first; if what your asking is
better aimed at the developers list someone here will point you in the right 
direction.

 Thanks in advantage
 
 Regards
 Kai
 

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



Re: [PHP] How php works?

2006-12-13 Thread Kai Xiang

On 12/13/06, Roman Neuhauser [EMAIL PROTECTED] wrote:


# [EMAIL PROTECTED] / 2006-12-13 14:15:26 +0800:
 I'm new here and looking PHP these days, howerver , I'm confused by how
it
 works, and here is some questions I have.
 Is there any old bird wanna help me out?

 1. I heard there is a zend engine inside PHP playing the role as a
virtual
 machine, and PHP excution have 2 step, first compile to opcode and then
 excute the opcode,
 so is that means the php are compiled only once per file? or still need
to
 recompile when another request issued to the server? also I heard about
the
 caching extention about php, is it talking about caching the opcode?
is't
 caching the opcode or excute results? how it shares between the
requests?

Both kinds of things exist, with different sharing strategies.



Can you tell it more detail, opcode caching cache the compiled opcode, so
not any compile needed anymore if no source changed? what about results,
what kind of methdology it's taking?




 3. Take linux apache for example, if compiled as a apache module, and
using
 prefork threading model, for example, if I have 100 process, is that
means I
 have 100 copy of PHP library local data(I assume only one reentrant
 excutable image) in each process? compare to a worker model, like 10
process
 and 10 threads in each one process, should it make a difference that we
only
 have 10 copy of PHP library local data ?

Practical concerns make your question moot: even if the basic
distribution was all threadsafe, you're bound to hit a library that uses
strtok(3) or strerror(3), or static variables. How much of the code you
rely on is labelled by its authors as threadsafe?



So it is not a good idea to use worker and php module at the same time, but
if no threadsafe problem , maybe my thinking is right?
Btw, I thought strerror in libc were thread-safe.




--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991



Re: [PHP] How php works?

2006-12-13 Thread Kai Xiang

On 12/13/06, Jochem Maas [EMAIL PROTECTED] wrote:


Kai Xiang wrote:
 Hello all:

 I'm new here and looking PHP these days, howerver , I'm confused by how
it
 works, and here is some questions I have.
 Is there any old bird wanna help me out?

 1. I heard there is a zend engine inside PHP playing the role as a
virtual
 machine, and PHP excution have 2 step, first compile to opcode and then
 excute the opcode,
 so is that means the php are compiled only once per file? or still need
to
 recompile when another request issued to the server? also I heard about
the
 caching extention about php, is it talking about caching the opcode?
is't
 caching the opcode or excute results? how it shares between the
requests?

there are opcode caching mechanisms available (e.g. php.net/apc - which
needs to
be installed via 'pecl'**); however the standard php installation will not
do any
opcode caching (i.e. compilation to opcode is done at each request).

** pecl.php.net / pear.php.net



That sounds good, I can take a more look at it




 2. Is there some alternative choise except zend engineen, why need a
zend
 engine? for performance advantage or just easy for porting to different
 platform?

no, there is no plugin replacement for the zend engine and AFAIK the zend
engine
is not used in any other products apart from php ... maybe zend.com has an
article on what exactly the zend engine is (I have never really bothered
to
find out myself :-).






 3. Take linux apache for example, if compiled as a apache module, and
using
 prefork threading model, for example, if I have 100 process, is that
 means I
 have 100 copy of PHP library local data(I assume only one reentrant
 excutable image) in each process? compare to a worker model, like 10
 process
 and 10 threads in each one process, should it make a difference that we
 only
 have 10 copy of PHP library local data ?

php is not threadsafe (well actually some php extensions are not thread
safe ...
it's an unknown quantity) the prefork worker module for apache2 is the
only
recommended way to go (if running as an apache module)

you might want to look into the FastCGI SAPI if you need a speed boost ...
I can't tell you anything about it because I have no experience with it as
such.


 I'm not sure if this is the right place to talk about this, anyway, if
you
 know a better place, help me out :)

this is the place - always best to ask here first; if what your asking is
better aimed at the developers list someone here will point you in the
right direction.



That's fine, thanks



Thanks in advantage

 Regards
 Kai





Re: [PHP] How php works?

2006-12-13 Thread Jochem Maas
Kai Xiang wrote:
 On 12/13/06, Roman Neuhauser [EMAIL PROTECTED] wrote:
 
 # [EMAIL PROTECTED] / 2006-12-13 14:15:26 +0800:
  I'm new here and looking PHP these days, howerver , I'm confused by how
 it
  works, and here is some questions I have.
  Is there any old bird wanna help me out?
 
  1. I heard there is a zend engine inside PHP playing the role as a
 virtual
  machine, and PHP excution have 2 step, first compile to opcode and then
  excute the opcode,
  so is that means the php are compiled only once per file? or still need
 to
  recompile when another request issued to the server? also I heard about
 the
  caching extention about php, is it talking about caching the opcode?
 is't
  caching the opcode or excute results? how it shares between the
 requests?

 Both kinds of things exist, with different sharing strategies.
 
 
 Can you tell it more detail, opcode caching cache the compiled opcode, so
 not any compile needed anymore if no source changed? what about results,
 what kind of methdology it's taking?

you can get a good idea of APC from the changelog:

http://pecl.php.net/package-changelog.php?package=APC

Zend als offers opcode caching as part of their suite of products ... Im
not all to familiar with Zend's stuff but no doubt their website has plenty
of info.

 
 
 
  3. Take linux apache for example, if compiled as a apache module, and
 using
  prefork threading model, for example, if I have 100 process, is that
 means I
  have 100 copy of PHP library local data(I assume only one reentrant
  excutable image) in each process? compare to a worker model, like 10
 process
  and 10 threads in each one process, should it make a difference that we
 only
  have 10 copy of PHP library local data ?

 Practical concerns make your question moot: even if the basic
 distribution was all threadsafe, you're bound to hit a library that uses
 strtok(3) or strerror(3), or static variables. How much of the code you
 rely on is labelled by its authors as threadsafe?
 
 
 So it is not a good idea to use worker and php module at the same time, but

correct - stick with the prefork module with apache, I believe *think* it is 
possible
to safely use a threaded module if you decide to go the FastCGI route but I 
maybe
thinking this because I completely misunderstood what someone was saying about 
FastCGI
(I remember reading quite abit about FastCGI in posts made to 
internals@lists.php.net
by core-dev/Zend-Founder Andi Gutmans - although I can't say I understood 
everything I read!)

 if no threadsafe problem , maybe my thinking is right?
 Btw, I thought strerror in libc were thread-safe.
 
 

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



Re: [PHP] How php works?

2006-12-13 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-13 18:57:58 +0800:
 On 12/13/06, Roman Neuhauser [EMAIL PROTECTED] wrote:
 # [EMAIL PROTECTED] / 2006-12-13 14:15:26 +0800:
  3. Take linux apache for example, if compiled as a apache module,
  and using prefork threading model, for example, if I have 100
  process, is that means I have 100 copy of PHP library local data(I
  assume only one reentrant excutable image) in each process? compare
  to a worker model, like 10 process and 10 threads in each one
  process, should it make a difference that we only have 10 copy of
  PHP library local data ?
 
 Practical concerns make your question moot: even if the basic
 distribution was all threadsafe, you're bound to hit a library that
 uses strtok(3) or strerror(3), or static variables. How much of the
 code you rely on is labelled by its authors as threadsafe?
 
 
 So it is not a good idea to use worker and php module at the same
 time, but if no threadsafe problem , maybe my thinking is right?

vvv
 Btw, I thought strerror in libc were thread-safe.
^^^

In a touch of genius, you summed up the whole thread-safety problem
so succintly, it puts an end to the whole thread.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] How php works?

2006-12-13 Thread tedd

At 2:15 PM +0800 12/13/06, Kai Xiang wrote:

Hello all:

I'm new here and looking PHP these days, howerver , I'm confused by how it
works, and here is some questions I have.
Is there any old bird wanna help me out?


Sure, which way did you come in?

You might want to ask one of the younger birds, they remember most of 
what we forgot.


tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] How php works?

2006-12-13 Thread Kai Xiang

Thanks Jochem, Roman :)


On 12/13/06, Jochem Maas [EMAIL PROTECTED] wrote:


Kai Xiang wrote:
 On 12/13/06, Roman Neuhauser [EMAIL PROTECTED] wrote:

 # [EMAIL PROTECTED] / 2006-12-13 14:15:26 +0800:
  I'm new here and looking PHP these days, howerver , I'm confused by
how
 it
  works, and here is some questions I have.
  Is there any old bird wanna help me out?
 
  1. I heard there is a zend engine inside PHP playing the role as a
 virtual
  machine, and PHP excution have 2 step, first compile to opcode and
then
  excute the opcode,
  so is that means the php are compiled only once per file? or still
need
 to
  recompile when another request issued to the server? also I heard
about
 the
  caching extention about php, is it talking about caching the opcode?
 is't
  caching the opcode or excute results? how it shares between the
 requests?

 Both kinds of things exist, with different sharing strategies.


 Can you tell it more detail, opcode caching cache the compiled opcode,
so
 not any compile needed anymore if no source changed? what about results,
 what kind of methdology it's taking?

you can get a good idea of APC from the changelog:

   http://pecl.php.net/package-changelog.php?package=APC

Zend als offers opcode caching as part of their suite of products ... Im
not all to familiar with Zend's stuff but no doubt their website has
plenty
of info.




  3. Take linux apache for example, if compiled as a apache module, and
 using
  prefork threading model, for example, if I have 100 process, is that
 means I
  have 100 copy of PHP library local data(I assume only one reentrant
  excutable image) in each process? compare to a worker model, like 10
 process
  and 10 threads in each one process, should it make a difference that
we
 only
  have 10 copy of PHP library local data ?

 Practical concerns make your question moot: even if the basic
 distribution was all threadsafe, you're bound to hit a library that
uses
 strtok(3) or strerror(3), or static variables. How much of the code you
 rely on is labelled by its authors as threadsafe?


 So it is not a good idea to use worker and php module at the same time,
but

correct - stick with the prefork module with apache, I believe *think* it
is possible
to safely use a threaded module if you decide to go the FastCGI route but
I maybe
thinking this because I completely misunderstood what someone was saying
about FastCGI
(I remember reading quite abit about FastCGI in posts made to
internals@lists.php.net
by core-dev/Zend-Founder Andi Gutmans - although I can't say I understood
everything I read!)

 if no threadsafe problem , maybe my thinking is right?
 Btw, I thought strerror in libc were thread-safe.






Re: [PHP] How php works?

2006-12-13 Thread Kai Xiang

On 12/14/06, tedd [EMAIL PROTECTED] wrote:


At 2:15 PM +0800 12/13/06, Kai Xiang wrote:
Hello all:

I'm new here and looking PHP these days, howerver , I'm confused by how
it
works, and here is some questions I have.
Is there any old bird wanna help me out?

Sure, which way did you come in?

You might want to ask one of the younger birds, they remember most of
what we forgot.



Ha, that sounds interesting :)

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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




[PHP] How php works?

2006-12-12 Thread Kai Xiang

Hello all:

I'm new here and looking PHP these days, howerver , I'm confused by how it
works, and here is some questions I have.
Is there any old bird wanna help me out?

1. I heard there is a zend engine inside PHP playing the role as a virtual
machine, and PHP excution have 2 step, first compile to opcode and then
excute the opcode,
so is that means the php are compiled only once per file? or still need to
recompile when another request issued to the server? also I heard about the
caching extention about php, is it talking about caching the opcode? is't
caching the opcode or excute results? how it shares between the requests?

2. Is there some alternative choise except zend engineen, why need a zend
engine? for performance advantage or just easy for porting to different
platform?

3. Take linux apache for example, if compiled as a apache module, and using
prefork threading model, for example, if I have 100 process, is that means I
have 100 copy of PHP library local data(I assume only one reentrant
excutable image) in each process? compare to a worker model, like 10 process
and 10 threads in each one process, should it make a difference that we only
have 10 copy of PHP library local data ?

I'm not sure if this is the right place to talk about this, anyway, if you
know a better place, help me out :)
Thanks in advantage

Regards
Kai