Subject: Presentation about LAMP (= Linux, Apache, MySQL and Perl/PHP/Python)

From: Shlomi Fish <[email-masked]>
Date: Tue, 15 Feb 2005 10:21:59 +0200

I finally finished writing the slides for a presentation I prepared about LAMP 
(Linux, Apache, MySQL, and Perl/PHP/Python). You can find them online here:

http://www.shlomifish.org/lecture/LAMP/slides/

Enjoy!

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      [email-masked]
Homepage:        http://www.shlomifish.org/

Knuth is not God! It took him two days to build the Roman Empire.

---

From: Shlomi Loubaton <[email-masked]>
Date: Wed, 16 Feb 2005 21:59:40 +0200

Hi 

I totally disagree with some (all!) of the remarks you made about PHP:
http://www.shlomifish.org/lecture/LAMP/slides/server-technologies/sss-overview/php.html

it's clear that these remarks were written by a Perl programmer who
doesn't know PHP very well.

it's also clear that all these issues are old and outdated.
You are definitely not being objective on this.
i bet you didn't use PHP for the last 3 years or so.

"PHP was thought to be faster than Perl, but it is less powerful and
flexible (no modules, no references, no namespaces, objects proper
only in PHP 5, no closures), and sports an easy to learn core
language.
"

it's designed for web development and includes whatever you may need for it. 
PHP DOES have references, RTFM!
PHP5 only features some improvements about using references.
PHP's code is very READABLE.
PHP5 has greatly improved it's OO abilities.

"PHP, as a language, has several potential security issues, which
causes sloppy code to become vulnerable more easily.
"
all these issues were fixed and dealt with. even in latest version 4.x
releases.
Post information is no longer "injected" by default. you simply use
$_POST , $_GET or $_REQUEST.

"PHP has many configuration options, which affect its run-time behaviour.
"
and it's still faster than Perl for web.

why all that FUD about PHP? 
try to "get the facts"(tm). 

Regards,
         Shlomil.

---

From: Shlomi Fish <[email-masked]>
Date: Fri, 18 Feb 2005 22:12:15 +0200

> it's designed for web development and includes whatever you may need for

I disagree with it. I actively use some of the features missing from it and 
present in Perl even for web-development.

> PHP DOES have references, RTFM! 

Possibly. I was told about the & operator (IIRC). In any case, if you have a 
nested data structure, and you reference a sub-node and modify it, will the 
original data structure be modified as well?

> PHP5 only features some improvements about using references.

I don't understand the sentence's context especially considering the fact it 
has "only".

> PHP's code is very READABLE.

Possibly. I did not say it isn't.

> PHP5 has greatly improved it's OO abilities.

Right. I said:

<<<
objects proper only in PHP 5

> $_POST , $_GET or $_REQUEST.

PHP can still be configured to allow sloppy code to be written easily, and 
often you need to configure it this way to run third-party modules. For 
example, fopen() can be used to both read files on the file-system and fetch 
URLs. Someone once gave me the following code for a proxy:

<<<
$file = fopen($_GET["myurl"]);
$contents = fread($file);
print $contents;

Now if you pass /etc/passwd as the myurl get parameter, you get it echoed to 
the screen.

> and it's still faster than Perl for web.

I did not mean that they affect its run-time _performance_, I meant that it 
affect its run-time _behaviour_. I.e: the scripts run differently with 
different configuration options. For example, you can put CGI parameters 
inside variables with their names or not. You can SQL-escape the CGI 
parameters or not, etc. This writing scripts that are portable across all 
configurations very hard.

As for speed - Yahoo benchmarked mod_php and mod_perl when they evaluated a 
conversion to PHP, and they found out that mod_perl was faster than mod_php. 
It's possible that they did not use a bytecode-caching mechanism, but I can't 
tell.

> try to "get the facts"(tm).

And you please try to write with the first letters of the sentence 
capitalized.

Regards,

	Shlomi Fish

---

From: Shlomi Loubaton <[email-masked]>
Date: Sat, 19 Feb 2005 04:44:31 +0200

> original data structure be modified as well?

Yes.

php -r '$a[x][y][z]=10; $b=&$a[x][y]; $b[z]=5 ; echo $a[x][y][z];'
The output of this line is '5'.
(using PHP4)

> I don't understand the sentence's context especially considering the fact it

There are some improvements regarding references in PHP5 but
references are available in PHP4 as well.

> Possibly. I did not say it isn't.

I find PHP code is much more readable than Perl code.
Maybe you can add that to your presentation.

> Now if you pass /etc/passwd as the myurl get parameter, you get it echoed to

If the programmer is stupid enough he'll allways find creative ways to
write bad code (Do you want me to show you bad Perl code?). I usually
use fopen only with local files, but if I wanted to fix your code, i
could easily do this:
if(file_exists($_GET["myurl"])) die('<h1>:P</h1>');

I don't think you can say that the language made you write this bad code...

> It's possible that they did not use a bytecode-caching mechanism, but I can't

Do you have some links to the benchmark results?

> And you please try to write with the first letters of the sentence

sure, sorry ;)

Shlomif , if you don't have a clue about PHP then don't try to write about it.
If you want, I can write few words about it for your presentation.

     Shlomil.

---

From: Shlomi Fish <[email-masked]>
Date: Sat, 26 Mar 2005 22:34:16 +0200

On Saturday 19 February 2005 04:44, Shlomi Loubaton wrote:
> > Possibly. I was told about the & operator (IIRC). In any case, if you
> > have a nested data structure, and you reference a sub-node and modify it,
> > will the original data structure be modified as well?
>
> Yes.
>

Corrected.

> > I don't understand the sentence's context especially considering the fact
> > it has "only".
>

I see.

> Maybe you can add that to your presentation.

PHP code may be more readale than Perl, but also tends to be more wordy and 
less succint.

> > PHP can still be configured to allow sloppy code to be written easily,
> > and often you need to configure it this way to run third-party modules.
> > For example, fopen() can be used to both read files on the file-system
> > and fetch URLs. Someone once gave me the following code for a proxy:
> >
> > <<<
> > Now if you pass /etc/passwd as the myurl get parameter, you get it echoed
> > to the screen.
>

But the ambivalence of the fopen function gives way to such misbehaviour. And 
someone gave me the code I showed here. Such things make secure programming 
in PHP more difficult.

> > > "PHP has many configuration options, which affect its run-time
> > > behaviour. "
> > I did not mean that they affect its run-time _performance_, I meant that
> > it affect its run-time _behaviour_. I.e: the scripts run differently with
> > As for speed - Yahoo benchmarked mod_php and mod_perl when they evaluated
> > a conversion to PHP, and they found out that mod_perl was faster than
> > mod_php. It's possible that they did not use a bytecode-caching
> > mechanism, but I can't tell.
>

http://public.yahoo.com/~radwin/talks/yahoo-phpcon2002.htm

> Shlomif , if you don't have a clue about PHP then don't try to write about
> it. If you want, I can write few words about it for your presentation.

First of all, please don't address me as "Shlomif, ". "Shlomi," is much 
better. ("Shlomif" is reserved for third person). You can write something 
about it and send me what you wrote and I'll see what parts of it I would 
integrate into my presentation.

Other than that, next time you can try speaking while sounding less hot-headed 
and more rational.

Regards,

	Shlomi Fish

Hacker sees bug. Hacker fixes bug.