On Sun, 16 Sep 2001, Bora Paksoy wrote:

> Hi;
> I am planning to implement a new site which will be
> using mysql db heavily, and I am in the middle of (and
> stuck:) deciding what I should use for implementation.
> I would definitely prefer Java Servlets, but it is
> very expensive to host servlets, so I am only
> comparing PHP vs. Perl.

    Why on earth would you prefer java servlets?

> I have been hearing very good things about PHP for a
> long time, and I started reading the manual/tutorial
> posted on php.net. To be honest, I didn't see much
> difference from perl. It is almost identical (I have
> to admit, there are some practical advantages, but not
> a huge difference), even the syntax is almost same to
> perl.

    PHP is a much "cleaner" language than Perl, ie, it doesn't have the
    same abiguities that plague Perl (print reverse split
    /\s+/, "H P A J";) and is much more akin to C in many ways.  Also,
    PHP was written and intended for the web (it can be used in other
    veins as well), therefore its imho much easier to do web programming
    with php.

> Comparing basic functional stuff:
> 1.Speed: If you use mod_perl or fastcgi kind of deals
> (which are based on threadding instead of forking), I
> don't think PHP is considerably faster than perl? Is
> that the case?
    The speed is comparable between the two languages, but then again if
    you count all the extra Perl libraries you have to call in to
    achieve the same results, php starts to win.

    FYI, JSP is the slowest to my knowledge.

> 2.Database Connection: What is the BIG advantage of
> PHP here? Using DBI packages for perl, and fastcgi for
> db connection pooling, you can achieve the same thing,
> I guess. It just looks like PHP has some of these
> libraries embedded in the core language, but the idea
> is same--implementing the native db protocol over
> sockets?

    The PHP way is slightly faster, that's it though (yeah, yeah, I know
    database independence, but if you want your code to run with any
    speed you'll tune your sql for the individual database anyway,
    loosing the necessary portability).

> 3.Shared Memory, global variables, etc: I was
> expecting a better interface for this in PHP, and I
> was really disappointed to see that developers have to
> use O/S level shared memory. First of all, this is not
> available on Windows???? And, it is kind of messy and
> hard to use, especially when you compare this to
> Java's static variables.

    No, its not available on Windows, but then again, why on earth would
    you want to use Windows? ;) If you really need shm on windows,
    submit a patch, hint, its just a mmap() :)

    The same applies for perl btw...  I have a feeling your not talking
    about Shared memory by the way, but rather sessions, which you can
    do via the built-in PHP sessioning support, see below.  Shared
    memory is usually only a good idea (outside of the session scope)
    when you want to communicate with other programs/processes.  Using
    it on high traffic sites is also not a good idea.

> 4.Session Management: If you use files to manage
> sessions, same thing can be achieved in perl.
> Regarding in memory session management, as far as I
> know, FastCGI can share variables among sessions, so
> it shouldn't be hard to write a session manager in
> perl as well.

    You can use Files or SHM management, or write your own custom
    session backend using for example MySQL.

> 5.Architecture: I couldn't find any doc about how PHP
> works. And any answer to important questions, like
>       -How does compilation process work? Does the PHP
> engine compile htmls first time a request is made to
> that html and use that compiled code later on(just
> like JSPs), or does it compile everytime? Is PHP
> engine an interpreter, jvm-like byte-code
> generator/executer or a compiler?

    No.  Its compile and execute everytime, however if you use one of
    the Cache's mentioned below its simply an execute each time.  JSP
    btw is slower despite the fact that it compiles the stuff ahead of

>       -How does threadding work? How can you cache stuff,
> etc.?

    you can cache your scripts using the commercial (but higher quality) Zend Cache
    (www.zend.com) or the (free) APC Cache (apc.communityconnect.com).

>       -What is the generic lifecycle of a request/response?

    zend.com should have some information on this.

> 6. Embedding scripts in HTML: Well, I mean, this is
> similar to JSP, but what the hell, you can use <<AA
> ..... AA; syntax and embed any string you want at any
> point by mixing and matching HTML and perl code. I
> mean, yeah PHP is easier, but it is not considerably
> easier, I believe.

    Yes, but do you want your web designer going through your perl code
    and messing with that section alone?  Its much easier to maintain
    the PHP code in this respect (you could use a templating engine in
    Perl of course, but that would slow your code down another notch).
    Also, with Perl HERE blocks you can't embed any logic, just
    variables into your HTML code.

    I'm personally a Perl fan myself, as far as syntax is concerned, so
    I can't make the best argument for PHP over Perl.  But the reason I
    use PHP instead of Perl for web related programming is simply
    because I can code faster in PHP than I can in Perl (really, PHP is
    much quicker to develop with).  And PHP code is easier for other
    programmers/web designers to maintain for people who aren't Perl


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to