By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,375 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,375 IT Pros & Developers. It's quick & easy.

Is PHP still slower than Perl?

P: n/a
@
A benchmark in 2002 showed PHP is much slower in shell or when Apache has
Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI choice.

Java is for a big team in short time to develope something slow.

ASP is a joke.

PHP is a kid.

Perl is around.

C. I don't know why it is not popular. It should be. Maybe those Web
inventors always thought in Linux so they never wanted to push something
binary so they selected Perl, a slower scripting.
Jul 17 '05 #1
Share this Question
Share on Google+
58 Replies


P: n/a
In comp.lang.php @ <as**@asdfsadf.com> wrote:
A benchmark in 2002 showed PHP is much slower in shell or when Apache has
Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI choice.


If you want to troll, please put a little more effort in it.

Like make up some benchmarks to support your facts.

--

Daniel Tryba

Jul 17 '05 #2

P: n/a
@ wrote:
C. I don't know why it is not popular.


I'd say it is because C does not have strings as a native data type.
Other than initializing an array of char, the C compiler has no
string manipulation built in; it requires library functions to do that.
-Joe
Jul 17 '05 #3

P: n/a
@ wrote:
With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.


You mean this regarding PHP 5's OO model? You have never looked at Perl 6's
OO model, haven't you?
JW

Jul 17 '05 #4

P: n/a
"@" <as**@asdfsadf.com> wrote in news:hO********************@rogers.com:
A benchmark in 2002 showed PHP is much slower in shell or when Apache
has Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.


For me Perl is #1 (if possible) because PHP is probably the worst designed
language ever. I am not sure if you can already prepare statements (MySQL),
something I used in Perl ages ago, or still have to use all those
whatsamacalled_quote_shebang garbage.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #5

P: n/a

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
"@" <as**@asdfsadf.com> wrote in news:hO********************@rogers.com:
A benchmark in 2002 showed PHP is much slower in shell or when Apache
has Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.
For me Perl is #1 (if possible) because PHP is probably the worst designed
language ever. I am not sure if you can already prepare statements
(MySQL),


Yes you CAN use prepare statemetnts with MySQL. You should be aware that
this is a MySQL feature, not a PHP feature.
something I used in Perl ages ago, or still have to use all those
whatsamacalled_quote_shebang garbage.


If you don't like PHP then why are you posting to the PHP newsgroup?

--
Tony Marston

http://www.tonymarston.net

Jul 17 '05 #6

P: n/a
@
> > A benchmark in 2002 showed PHP is much slower in shell or when Apache
has
Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.
If you want to troll, please put a little more effort in it.

Like make up some benchmarks to support your facts.

--

Daniel Tryba


google with PHP PERL BENCHMARK, you will see the results. That is the one
back from 2002.

http://216.239.39.104/search?q=cache...ark+2002&hl=en
Jul 17 '05 #7

P: n/a
Janwillem Borleffs wrote:
@ wrote:
With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.


You mean this regarding PHP 5's OO model? You have never looked at Perl
6's OO model, haven't you?


First off, as Perl 6 doesn't really exist yet, the original flame^Wpost
must be comparing against Perl 5.

Second, Perl 6's OO model could yet do a few 180's.

Third, who said anyone would use Perl 6 for CGI?

Fourth, who said Perl 6's performance would suck?

Fifth, I'm not saying PHP 5's performance sucks - I'm just inferring it
from @'s flame^Wpost.
Jul 17 '05 #8

P: n/a
Also sprach Joe Smith:
@ wrote:
C. I don't know why it is not popular.


I'd say it is because C does not have strings as a native data type.
Other than initializing an array of char, the C compiler has no
string manipulation built in; it requires library functions to do that.


That's a distinction in C that's moot. It has no built-in IO mechanisms
either. You have to include a header to get this functionality. But
nonestheless, it's still part of the language.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus}) !JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
Jul 17 '05 #9

P: n/a
In comp.lang.php @ <as**@asdfsadf.com> wrote:

If you want to troll, please put a little more effort in it.

Like make up some benchmarks to support your facts.
google with PHP PERL BENCHMARK, you will see the results.


That is not how it works: you make a claim, so you supply your proof. And
I'm more interested in perl/php vs. java.
That is the one
back from 2002.


2002 is so 2 years ago, that like ancient man.

--

Daniel Tryba

Jul 17 '05 #10

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
"@" <as**@asdfsadf.com> wrote in
news:hO********************@rogers.com:
A benchmark in 2002 showed PHP is much slower in shell or when
Apache has Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.


For me Perl is #1 (if possible) because PHP is probably the worst
designed language ever. I am not sure if you can already prepare
statements (MySQL),


Yes you CAN use prepare statemetnts with MySQL.
You should be aware
that this is a MySQL feature, not a PHP feature.


How can I use it from PHP?
something I used in Perl ages ago, or still have to use all those
whatsamacalled_quote_shebang garbage.


If you don't like PHP then why are you posting to the PHP newsgroup?


Look at the headers, this has been crossed to a Perl group. Besides, I
hope the PHP group isn't only there for people who say it's a great
language? (which it isn't).

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #11

P: n/a
@
> >>
If you want to troll, please put a little more effort in it.

Like make up some benchmarks to support your facts.


google with PHP PERL BENCHMARK, you will see the results.


That is not how it works: you make a claim, so you supply your proof. And
I'm more interested in perl/php vs. java.
That is the one
back from 2002.


2002 is so 2 years ago, that like ancient man.


I personally did my own benchmark in late 2003. I am not an expert at
benchmarking softwares, but it is true Perl is much faster than PHP from my
result. I used PHP/Perl in web enviroment for printing one line per hit.
Jul 17 '05 #12

P: n/a


@ wrote:
C. I don't know why it is not popular. It should be. Maybe those Web
inventors always thought in Linux so they never wanted to push something
binary so they selected Perl, a slower scripting.


Why don't you try assembly!!!! I bet you can get that to be running even
faster than C!!!

good luck,
-d
Jul 17 '05 #13

P: n/a
In article <Xn*************************@130.133.1.4>,
John Bokma <po********@castleamber.com> wrote:
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
"@" <as**@asdfsadf.com> wrote in
news:hO********************@rogers.com:

A benchmark in 2002 showed PHP is much slower in shell or when
Apache has Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.

For me Perl is #1 (if possible) because PHP is probably the worst
designed language ever. I am not sure if you can already prepare
statements (MySQL),
Yes you CAN use prepare statemetnts with MySQL.
You should be aware
that this is a MySQL feature, not a PHP feature.


How can I use it from PHP?


Buy one of the many PHP books that mentions building sites and using
MySQL. O'Reilly has PROGRAMMING PHP, which I used to develop my site.
There are others, which I leave to you to investigate.

If you're to strapped for funds to buy something, there's

http://www.php.net/manual/en/
something I used in Perl ages ago, or still have to use all those
whatsamacalled_quote_shebang garbage.


If you don't like PHP then why are you posting to the PHP newsgroup?


Look at the headers, this has been crossed to a Perl group. Besides, I
hope the PHP group isn't only there for people who say it's a great
language? (which it isn't).


One thing I'm unconvinced of is security. With database applications, I
have to put passwords to the database inside php scripts and they have
to be readable by the web server which runs under the nobody UID.
Instead, I chose to do parts of my site with Perl CGI and CGIwrap. This
allows me to protect the files from group or other access as these
scripts run as my account's UID.

I found recently that you can put such files outside of the server's
DOCUMENT ROOT and get access through the php include_path global, but
the web server still needs access to the file.

One thing I like about php is that each script is stored in the usual
place in the user's document directory. The files are executed and the
output is displayed without having to put everything in the ScriptAlias
directory (usually cgi-bin).

While php has PEAR, a depository for additional libraries written by
others, perl has CPAN which is at least 2 orders of magnitude larger and
more diverse. There's also lots of network and system-level things you
can do with perl and usually someone's already done it in a CPAN module.

This thread is about as enlightening as "which car is better". It all
depends on where and how you're trying to get there.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

Jul 17 '05 #14

P: n/a
In article <vi**************************@comcast.dca.giganews .com>, "Michael Vilain <vi****@spamcop.net>" wrote:
One thing I'm unconvinced of is security. With database applications, I
have to put passwords to the database inside php scripts and they have
to be readable by the web server which runs under the nobody UID.
Instead, I chose to do parts of my site with Perl CGI and CGIwrap. This
allows me to protect the files from group or other access as these
scripts run as my account's UID.
But you can use PHP in CGI too. And use suExec to run it under a
different uid.
I found recently that you can put such files outside of the server's
DOCUMENT ROOT and get access through the php include_path global, but
the web server still needs access to the file.
http://shiflett.org/articles/security-corner-mar2004
One thing I like about php is that each script is stored in the usual
place in the user's document directory. The files are executed and the
output is displayed without having to put everything in the ScriptAlias
directory (usually cgi-bin).


Once again, this is purely a webserver configuration issue.

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>
Jul 17 '05 #15

P: n/a
"Doug" <do*****@XXXXremovetheXearthlink.net> wrote in message
news:eQ*****************@newsread2.news.atl.earthl ink.net...


@ wrote:
C. I don't know why it is not popular. It should be. Maybe those Web
inventors always thought in Linux so they never wanted to push something
binary so they selected Perl, a slower scripting.


Why don't you try assembly!!!! I bet you can get that to be running even
faster than C!!!

good luck,
-d


And I heard that you can get great performance by designing your own
silicon.
Jul 17 '05 #16

P: n/a
@
> One thing I'm unconvinced of is security. With database applications, I
have to put passwords to the database inside php scripts and they have
to be readable by the web server which runs under the nobody UID.
Instead, I chose to do parts of my site with Perl CGI and CGIwrap. This
allows me to protect the files from group or other access as these
scripts run as my account's UID.


Could you tell me how others can read your files? If you set PHP as 604?

In perl's case, if I set it as 755, does it allow everyone to read the
script? Should I set it as 705?
Jul 17 '05 #17

P: n/a
@
> > One thing I'm unconvinced of is security. With database applications, I
have to put passwords to the database inside php scripts and they have
to be readable by the web server which runs under the nobody UID.
Instead, I chose to do parts of my site with Perl CGI and CGIwrap. This
allows me to protect the files from group or other access as these
scripts run as my account's UID.


Could you tell me how others can read your files? If you set PHP as 604?

In perl's case, if I set it as 755, does it allow everyone to read the
script? Should I set it as 705?


I think as long as the directory is set as 400 then nobody will be able to
get access to any of your files, regardless how they set mod on them
Jul 17 '05 #18

P: n/a
@ wrote:
Could you tell me how others can read your files? If you set PHP as 604?
What is "set PHP as 604" supposed to mean? Are you referring to setting
the permissions on *.php files?

If that's what you mean, please read any basic introduction to UNIX. 604
makes a file readable and writable by its owner, and readable by any
other user.
In perl's case
File permissions are language-independent. A file that's readable for
Perl is readable for PHP, is readable for Java, is readable for C, etc.

Michael is referring to a server configuration that will run CGIs with
the permissions of the CGI's owner, instead of running them as "nobody".
That way, you don't have to make anything world readable - you can make
sensitive files 0600, and the CGI will be able to read them.
Should I set it as 705?


No. You should read a good basic introduction to UNIX, concentrating on
the section(s) about file permissions and ownership. That way you'll
know what these numbers mean, and you won't have to throw them around at
random.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Jul 17 '05 #19

P: n/a
@ wrote:
In perl's case, if I set it as 755, does it allow everyone to read the
script? Should I set it as 705?

I think as long as the directory is set as 400 then nobody will be able to
get access to any of your files, regardless how they set mod on them


The files should be set to o=r,go= (400) or u=rw,go= (600). The
directory they are in should be u=rx,go= (500) or u=rwx,go= (700).
Directories must be executable to read the inode. The inode stores,
among other things, the sectors where the file contents are.

Perl modules should be placed in a directory not accessible by the
server. Perl can access them by using 'use lib' to add the path to the
library directory list (see perldoc lib). The permission on the modules
should be u=rx,go= (500) and the first line:

#!/

This means if the server accesses the file, it will try to execute it
and fail, making it impossible for it to display the code. This is
important if you are under the obligation of not exposing the code to
the public.

--- Shawn
Jul 17 '05 #20

P: n/a
Sherm Pendley wrote:
If that's what you mean, please read any basic introduction to UNIX. 604
makes a file readable and writable by its owner, and readable by any
other user.


Not so, users in the same group cannot read, write or execute the files.
UNIX check only the user's permissions if you are the user, only the
group's permissions if you are in that group and only the other's
permissions if you are not the user or in the group. No cross sharing of
permissions.

--- Shawn
Jul 17 '05 #21

P: n/a

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
"@" <as**@asdfsadf.com> wrote in
news:hO********************@rogers.com:

A benchmark in 2002 showed PHP is much slower in shell or when
Apache has Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI
choice.

For me Perl is #1 (if possible) because PHP is probably the worst
designed language ever. I am not sure if you can already prepare
statements (MySQL),


Yes you CAN use prepare statemetnts with MySQL.
You should be aware
that this is a MySQL feature, not a PHP feature.


How can I use it from PHP?


http://dev.mysql.com/tech-resources/...tatements.html
something I used in Perl ages ago, or still have to use all those
whatsamacalled_quote_shebang garbage.


If you don't like PHP then why are you posting to the PHP newsgroup?


Look at the headers, this has been crossed to a Perl group. Besides, I
hope the PHP group isn't only there for people who say it's a great
language? (which it isn't).


I don't waste my time posting to a Microsoft newsgroup saying that all MS
products suck (otherwise I'd never get anything done), so what makes you (or
anyone else) think that you can post such comments to this group without
getting an animated response.

You may think that Perl is better than PHP (what is your justification?) and
as it is still a free country (that is until President Blair finishes
screwing up the constitution) it is your God-given right to hold that
opinion. I think you are wrong, but it is still your right.

--
Tony Marston

http://www.tonymarston.net

Jul 17 '05 #22

P: n/a
Shawn Corey wrote:
Not so, users in the same group cannot read, write or execute the files.
UNIX check only the user's permissions if you are the user, only the
group's permissions if you are in that group and only the other's
permissions if you are not the user or in the group.


That's not a safe assumption to make. My Debian Linux machine behaves as
you describe - if I disable group access for my group, but leave world
access enabled, I cannot read the file.

But My Mac OS X machine behaves differently. On that, access to a file
is granted if you have *any* means of doing so, whether it's by virtue
of owning the file, belonging to the correct group, or by way of the
"other user" permissions.

I don't know if what I'm seeing here is specific to Mac OS X, to HFS+,
or shared with any other BSD* variants. Although to me, it makes more
sense than what I'm seeing on Linux.

The traditional security mindset is to deny access by default (other),
and grant access only to specific users (group). This is what's enforced
on my Mac - if you want to deny anyone access to a file, you first have
to deny *everyone* access via other permissions, and then decide what
specific users to allow via group permissions.

Linux file permissions allow the opposite mindset as well - granting
access by default (other), while denying specific users (group). An
"allow by default" security mindset is not, in my opinion, a Good Thing.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Jul 17 '05 #23

P: n/a
Tony Marston wrote:
I don't waste my time posting to a Microsoft newsgroup saying that all MS
products suck (otherwise I'd never get anything done), so what makes you (or
anyone else) think that you can post such comments to this group without
getting an animated response.

You may think that Perl is better than PHP (what is your justification?) and
as it is still a free country (that is until President Blair finishes
screwing up the constitution) it is your God-given right to hold that
opinion. I think you are wrong, but it is still your right.


What good is having a debate on the merits of two languages if you
solicit opinions from only one side? If this thread was only posted to
one newsgroup, I would have 'Ignore Thread' a long time ago.

--- Shawn
Jul 17 '05 #24

P: n/a
In article <2s*************@uni-berlin.de>,
Tim Van Wassenhove <eu**@pi.be> wrote:
In article <vi**************************@comcast.dca.giganews .com>, "Michael
Vilain <vi****@spamcop.net>" wrote:
One thing I'm unconvinced of is security. With database applications, I
have to put passwords to the database inside php scripts and they have
to be readable by the web server which runs under the nobody UID.
Instead, I chose to do parts of my site with Perl CGI and CGIwrap. This
allows me to protect the files from group or other access as these
scripts run as my account's UID.


But you can use PHP in CGI too. And use suExec to run it under a
different uid.
I found recently that you can put such files outside of the server's
DOCUMENT ROOT and get access through the php include_path global, but
the web server still needs access to the file.


http://shiflett.org/articles/security-corner-mar2004
One thing I like about php is that each script is stored in the usual
place in the user's document directory. The files are executed and the
output is displayed without having to put everything in the ScriptAlias
directory (usually cgi-bin).


Once again, this is purely a webserver configuration issue.


I think I'm more constrained by how my web hosting company has
configured their web host. Their Apache is compiled without suExec (a
Good Thing[tm], I think) and can I can only run php from Apache as
there's no php command line installed. The mechanism they offer for
running code under my UID is CGIwrap and perl.

I suppose if I wanted to spend the money, I could co-locate a system in
their datacenter and get any hosting environment. But what they offer
is "good enough", only costs $25/month, and the support guy answers the
phone on the 2nd ring, usually. Their security constraints don't get in
the way of me doing web development and I don't have to admin any
machine but my desktop.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

Jul 17 '05 #25

P: n/a
>>>>> "Chung" == Chung Leong <ch***********@hotmail.com> writes:

Chung> And I heard that you can get great performance by designing your own
Chung> silicon.

Or booting your own universe.

"Yes, in my new universe, CGI will be the 47th element!"

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me****@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Jul 17 '05 #26

P: n/a
In comp.lang.php John Bokma <po********@castleamber.com> wrote or quoted:
For me Perl is #1 (if possible) because PHP is probably the worst designed
language ever.


PHP was never designed. It evolved.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #27

P: n/a
In comp.lang.php @ <as**@asdfsadf.com> wrote or quoted:
C. I don't know why it is not popular. It should be. [...]


Safety. Security. Imports as includes. Header files.
Lack of binary portability. The preprocessor. The fact that C++ sucks.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #28

P: n/a

"Tim Tyler" <ti*@tt1lock.org> wrote in message news:I5*******@bath.ac.uk...
In comp.lang.php John Bokma <po********@castleamber.com> wrote or quoted:
For me Perl is #1 (if possible) because PHP is probably the worst
designed
language ever.


PHP was never designed. It evolved.


Most languages evolve for the simple reason that nobody ever gets it right
the very first time. Ideas change over time, so languages must change to
keep up with the times.

--
Tony Marston

http://www.tonymarston.net

Jul 17 '05 #29

P: n/a
Tim Tyler <ti*@tt1lock.org> wrote:
In comp.lang.php @ <as**@asdfsadf.com> wrote or quoted:
C. I don't know why it is not popular. It should be. [...]


Safety. Security. Imports as includes. Header files.
Lack of binary portability. The preprocessor. The fact that C++ sucks.


Please explain the difference between safety and security.
If you've done this:
*What* is bad about header files and the preprocessor?
WTF has C++ to do with C?
Why do you expect binary portability from C, while there is binary
portability for neither PHP, nor Perl, nor Java. (You won't get a binary
for the first two and Java wants to be portable but isn't as it proofed
with the 6809-emulator we wrote in school last year.)

By now, your whole post shouts:
"I don't have a clue about C, so it *has* to be bad."
Do something against this first expression.
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #30

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in news:cjofs2$sa9$1
$8*******@news.demon.co.uk:
http://dev.mysql.com/tech-resources/...tatements.html


"Another API that has prepared statement support is PHP. PHP 5 has a new
MySQL interface called "mysqli"."

More cluttering of the namespace :-( Why wasn't this in the language years
(!) ago?

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #31

P: n/a
Tim Tyler <ti*@tt1lock.org> wrote in news:I5*******@bath.ac.uk:
In comp.lang.php John Bokma <po********@castleamber.com> wrote or
quoted:
For me Perl is #1 (if possible) because PHP is probably the worst
designed language ever.


PHP was never designed. It evolved.


My point ;-)

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #32

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:

"Tim Tyler" <ti*@tt1lock.org> wrote in message
news:I5*******@bath.ac.uk...
In comp.lang.php John Bokma <po********@castleamber.com> wrote or
quoted:
For me Perl is #1 (if possible) because PHP is probably the worst
designed
language ever.


PHP was never designed. It evolved.


Most languages evolve for the simple reason that nobody ever gets it
right the very first time. Ideas change over time, so languages must
change to keep up with the times.


But it can't hurt to have a good look at how other languages are designed
before you start with the primordial soup (did PHP already reach that
stage?) I mean just reading a few books on general language design could
have given the maker(s) at least some clue.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #33

P: n/a
"Michael Vilain <vi****@spamcop.net>" wrote in news:vilain-
69*******************@comcast.dca.giganews.com:
In article <Xn*************************@130.133.1.4>,
John Bokma <po********@castleamber.com> wrote:
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:
>
> "John Bokma" <po********@castleamber.com> wrote in message
> news:Xn*************************@130.133.1.4...
>> "@" <as**@asdfsadf.com> wrote in
>> news:hO********************@rogers.com:
>>
>>> A benchmark in 2002 showed PHP is much slower in shell or when
>>> Apache has Mod_Perl.
>>>
>>> With the new PHP kissing Java's ass, Perl is once again the #1 CGI >>> choice.
>>
>> For me Perl is #1 (if possible) because PHP is probably the worst
>> designed language ever. I am not sure if you can already prepare
>> statements (MySQL),
>
> Yes you CAN use prepare statemetnts with MySQL.
> You should be aware
> that this is a MySQL feature, not a PHP feature.
How can I use it from PHP?


Buy one of the many PHP books that mentions building sites and using
MySQL. O'Reilly has PROGRAMMING PHP, which I used to develop my site.
There are others, which I leave to you to investigate.


According to the MySQL it just has been evolved into PHP, huray! Version
5 does support it, finally.

[ snip ]
One thing I like about php is that each script is stored in the usual
place in the user's document directory. The files are executed and the output is displayed without having to put everything in the ScriptAlias directory (usually cgi-bin).
You can configure Apache to run .cgi from every directory you like, also
you can use mod_rewrite to rewrite your urls.
While php has PEAR, a depository for additional libraries written by
others, perl has CPAN which is at least 2 orders of magnitude larger and more diverse.
Only 2? I think it has also been longer around, and quite a few modules
have excellent programmers behind them.
There's also lots of network and system-level things you
can do with perl and usually someone's already done it in a CPAN

module.

Agreed.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #34

P: n/a
John Bokma wrote:
"Tim Tyler" <ti*@tt1lock.org> wrote in message
news:I5*******@bath.ac.uk...
In comp.lang.php John Bokma <po********@castleamber.com> wrote or
quoted:

For me Perl is #1 (if possible) because PHP is probably the worst
designed
language ever.

PHP was never designed. It evolved.


Most languages evolve for the simple reason that nobody ever gets it
right the very first time. Ideas change over time, so languages must
change to keep up with the times.


But it can't hurt to have a good look at how other languages are designed
before you start with the primordial soup (did PHP already reach that
stage?) I mean just reading a few books on general language design could
have given the maker(s) at least some clue.


That may be so, but PHP was initially created as a quick and simple way for
the creator to measure the number of people who viewed his CV online, and
it evolved from there. Interestingly enough, it started off as a collection
of libraries written in Perl, and then moved to an implementation written
in C with version 2.0.

If you are interested, you can read the history at
http://www.php.net/history

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #35

P: n/a
Simon Stienen <si***********@news.slashlife.de> writes:
Tim Tyler <ti*@tt1lock.org> wrote:
In comp.lang.php @ <as**@asdfsadf.com> wrote or quoted:
C. I don't know why it is not popular. It should be. [...]
Safety. Security. Imports as includes. Header files.
Lack of binary portability. The preprocessor. The fact that C++ sucks.


Please explain the difference between safety and security.


C's unsafe because there is a good chance that C programs will crash
in spectacular ways. C's insecure because it encourages programing
practices that lead to buffer overruns.
If you've done this:
*What* is bad about header files and the preprocessor?
The preprocessors Macro system is badly thourt out. The way it
expands means that what looks like a quite resonable programing
construct can infact have supprisingly diffrent results.

[...]
Why do you expect binary portability from C, while there is binary
portability for neither PHP, nor Perl, nor Java.


Scripting lanages are portable to where ever there interpreter has
been ported to.
--
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
Jul 17 '05 #36

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
news:cj*******************@news.demon.co.uk:
[ prepared statements ]
How can I use it from PHP?
http://dev.mysql.com/tech-resources/.../4.1/prepared-

statements.ht ml
That's mySQL, not PHP.

I mean something like:

$query = "INSERT INTO table VALUES(?, ?, ?)";
mysql_bla( $query, $a, $b, $c );

Hence without the quote_she_bang_garbage
I don't waste my time posting to a Microsoft newsgroup saying that all
MS products suck (otherwise I'd never get anything done), so what
makes you (or anyone else) think that you can post such comments to
this group without getting an animated response.
Look at the headers in this posting, and then define "this group"
You may think that Perl is better than PHP (what is your
justification?
A solid background in computer science, including some courses in
compiler and language design?
) and as it is still a free country (that is until
President Blair finishes screwing up the constitution) it is your
God-given right to hold that opinion. I think you are wrong, but it is
still your right.


I think you have not much experience with Perl ;-) Or any other decent
programming language for that matter either.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #37

P: n/a
John Bokma wrote:
I mean something like:

$query = "INSERT INTO table VALUES(?, ?, ?)";
mysql_bla( $query, $a, $b, $c );

Hence without the quote_she_bang_garbage


You can do that with the PEAR database libraries, although some PHP
developers on this newsgroup argue that PEAR is too slow, but I personally
have never had any problems with it. For databases that actually support
prepared queries it does it in the database; for those that don't (eg MySQL
4.0.x and earlier) it simulates it in code.

http://pear.php.net/manual/en/package.database.db.php

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #38

P: n/a
"Michael Vilain <vi****@spamcop.net>" wrote:
One thing I like about php is that each script is stored in the usual
place in the user's document directory. The files are executed and the
output is displayed without having to put everything in the ScriptAlias
directory (usually cgi-bin).


Or you could enable the CGI type.

--
I wasn't born a bitch. Men like you made me this way.
Jul 17 '05 #39

P: n/a
While this topic appear to have been intended to create an argumentative
long thread of discussion, I will add in my own ideas.

The idea of comparing one language to another requires some assumptions and
restrictions on what is being compared. I primarily do web based stuff, so
I will address the various languages in terms of their use on the internet.

PHP is intended for and excels at processing text, a range of math
functions, and interaction with databases, with a limited amount of fuss on
the part of the coder. It also is a natural for building web pages
requiring the coder to do nothing special to get their output to the
browser. If speed includes deployment time, php wins this in my book.

PERL offers additional capabilities over PHP many of which are of no use to
the web server uses. If those additional capabilities are of use to you
then PERL must take the front seat. Again, PERL has managed to stay fairly
simple for the programmer allowing them to concentrate more on the task at
hand than the architecture of the processor they might be running on, or how
memory is laid out. PERL for web work requires a few additional steps
however when coding, so for me, PHP wins here. But I also use perl quite a
bit for other tasks, like when PHP has been crippled by the hoster such as
doing http uploads.

C and C++, and other more complex systems require you to do a bit more
planning for your program, both in the coding, and the deployment of that
program, requiring a compile step in the testing process which is not
necessary in the PHP or PERL pipeline of development. So if speed includes
deployment time, perl and php both win over C. I also don't know C or C++
so I cannot address specific strengths or weaknesses, but the learning curve
alone pushes C off to the side for many people.

ASP in my opinion is an overly complex language which brings with it all the
drawbacks of C and VB in terms of a lack of simple text handling (which is
virtually all web work is). ASP unfortunately is the only way (or VB) to
access some of the microsoft proprietary features when doing certain things
though I believe, so if those features are required in your application,
then you are stuck with ASP or VB.

JAVA is fantastic in concept, but typically poor in execution. It is
essentially centrally managed code, which auto deploys to the end user,
hopefully OS independant. This OS independance though comes at a price in
terms of system performance more often than not, and people tend to use java
in places where something with significantly less overhead would have
sufficed.

One you left out, ColdFusion. CF is a very nice system also, with similar
capabilities to PHP. This comes at a cost though in dollars. PHP is free,
and CF is certainly not free. PHP also has far more features which can be
compiled in (for free) extending it to include graphics
manipulation/creation and database interaction with most any database server
available. ColdFusion is good, but cost becomes a factor pretty quick.

Jul 17 '05 #40

P: n/a
In comp.lang.php Simon Stienen <si***********@news.slashlife.de> wrote or quoted:
Tim Tyler <ti*@tt1lock.org> wrote:
In comp.lang.php @ <as**@asdfsadf.com> wrote or quoted:
C. I don't know why it is not popular. It should be. [...]
Safety. Security. Imports as includes. Header files.
Lack of binary portability. The preprocessor. The fact that C++ sucks.


Please explain the difference between safety and security.


http://dictionary.reference.com/search?q=safety
http://dictionary.reference.com/search?q=security
*What* is bad about header files and the preprocessor?
They require unnecessary maintenance - and produce unreadable,
unmaintainable, unparsable, incomprehensible programs respectively.
WTF has C++ to do with C?
C++ is what C programmers tend to use when they find they
actually needed OO features after all - and that
consequently they started their project in the wrong language.

They shift to C++ because it is backwards-compatible with C.
Why do you expect binary portability from C, while there is binary
portability for neither PHP, nor Perl, nor Java. (You won't get a binary
for the first two and Java wants to be portable but isn't as it proofed
with the 6809-emulator we wrote in school last year.)
Java won't run on my mechano set - therefore it isn't portable.

A good argument you have there.
By now, your whole post shouts:
"I don't have a clue about C, so it *has* to be bad."


That just shows you failed to understand what I wrote :-|
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #41

P: n/a
In comp.lang.php Tony Marston <to**@nospam.demon.co.uk> wrote or quoted:
"Tim Tyler" <ti*@tt1lock.org> wrote in message news:I5*******@bath.ac.uk...
In comp.lang.php John Bokma <po********@castleamber.com> wrote or quoted:
For me Perl is #1 (if possible) because PHP is probably the worst
designed language ever.


PHP was never designed. It evolved.


Most languages evolve for the simple reason that nobody ever gets it right
the very first time. Ideas change over time, so languages must change to
keep up with the times.


Much as I respect evolutionary approaches to design - if you were
planning on building a rocket ship in 1995 - it would have been
best not to have started with a steam engine - and to have attempted
a series of gradual changes once the thing was going along.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #42

P: n/a
In comp.lang.php John Bokma <po********@castleamber.com> wrote or quoted:
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in news:cjofs2$sa9$1

http://dev.mysql.com/tech-resources/...tatements.html


"Another API that has prepared statement support is PHP. PHP 5 has a new
MySQL interface called "mysqli"."

More cluttering of the namespace :-( Why wasn't this in the language years
(!) ago?


To avoid cluttering the namespace? ;-)

Why have an interface to a particular database in the standard library
anyway?

Are they trying to *encourage* the use of database-specific features?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #43

P: n/a
>>WTF has C++ to do with C?


C++ is what C programmers tend to use when they find they
actually needed OO features after all - and that
consequently they started their project in the wrong language.


ROFLMAO - no really, I'm not kidding I literally cracked up.

You are soooooo correct. Who on earth decided to add object oriented
stuff to what is essentially a macro-assembler? I learned OO from
Smalltalk, C++ is fundamentally wrong and broken.

Jul 17 '05 #44

P: n/a
On Wed, 6 Oct 2004 12:17:03 GMT, Tim Tyler wrote:
In comp.lang.php Tony Marston <to**@nospam.demon.co.uk> wrote or quoted:
"Tim Tyler" <ti*@tt1lock.org> wrote in message news:I5*******@bath.ac.uk...
In comp.lang.php John Bokma <po********@castleamber.com> wrote or quoted: For me Perl is #1 (if possible) because PHP is probably the worst
designed language ever.

PHP was never designed. It evolved.


Most languages evolve for the simple reason that nobody ever gets it right
the very first time. Ideas change over time, so languages must change to
keep up with the times.


Much as I respect evolutionary approaches to design - if you were
planning on building a rocket ship in 1995 - it would have been
best not to have started with a steam engine - and to have attempted
a series of gradual changes once the thing was going along.


True. But, as Chris said above, they never planned to build a rocket ship
-- PHP was originally just a simple wheelcart made for pushing some earth
around. That it evolved into the transgalactic cargo hauler it is today is
simply amazing.

Berislav
Jul 17 '05 #45

P: n/a
John Bokma <po********@castleamber.com> wrote in message news:<Xn*************************@130.133.1.4>...
That's mySQL, not PHP.

I mean something like:

$query = "INSERT INTO table VALUES(?, ?, ?)";
mysql_bla( $query, $a, $b, $c );

Hence without the quote_she_bang_garbage


I can't believe you can't actually write such a function yourself???

People should always be writing wrapper functions or classes to handle
db connections, to remove such stuff as addslashes()ing. Use
func_num_args() to find out the number of arguments passed to a php
function and func_get_arg([number]) to get the [number]th argument
passed. I've written such a function for myself. Well in fact I use
three classes for handling databases - one abstract "Database" class
for any database, one Database specific class (eg mysql_db for mysql
databases) and a Query class for handling queries in the manner you
suggest. Now I do this:

$sql = "SELECT foo, bar
FROM table
WHERE a = ?
AND b = ?";
$db->query(new Query($sql, $a, $b), __LINE__, __FILE__);

And all query preprocessing is handled by the Query class, and
database connection/query processing/error handling is handled by the
database-specific class.

I use such classes in all my developments. They're written once then
forgotten about, and simply reused where needed.

All I'm saying is that it's really pretty easy to implement many
things yourself, without moaning that the language hasn't done them
for you.
Jul 17 '05 #46

P: n/a
or************@gmail.com (Brad Shinoda) wrote in
news:ad**************************@posting.google.c om:
John Bokma <po********@castleamber.com> wrote in message
news:<Xn*************************@130.133.1.4>...
That's mySQL, not PHP.

I mean something like:

$query = "INSERT INTO table VALUES(?, ?, ?)";
mysql_bla( $query, $a, $b, $c );

Hence without the quote_she_bang_garbage
I can't believe you can't actually write such a function yourself???


Sure. I can even write my own improved PHP clone. What's the point?
People should always be writing wrapper functions or classes to handle
db connections, to remove such stuff as addslashes()ing. Use
func_num_args() to find out the number of arguments passed to a php
function and func_get_arg([number]) to get the [number]th argument
passed. I've written such a function for myself.
Yes, and everybody has to write wrapper functions. You get the point
now, or do you want it spelled out?
Well in fact I use
three classes for handling databases - one abstract "Database" class
for any database,
Yes, in Perl that is called DBI. You don't have to write it yourself.

one Database specific class (eg mysql_db for mysql
databases) and a Query class for handling queries in the manner you
suggest. Now I do this:

$sql = "SELECT foo, bar
FROM table
WHERE a = ?
AND b = ?";
$db->query(new Query($sql, $a, $b), __LINE__, __FILE__);

And all query preprocessing is handled by the Query class, and
database connection/query processing/error handling is handled by the
database-specific class.

I use such classes in all my developments. They're written once then
forgotten about, and simply reused where needed.
Wonderful. With Perl it's put on CPAN and used (and tested) by many
people.
All I'm saying is that it's really pretty easy to implement many
things yourself, without moaning that the language hasn't done them
for you.


Programming shouldn't be about reinventing wheels, and worse reinventing
bugs.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #47

P: n/a

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
or************@gmail.com (Brad Shinoda) wrote in
news:ad**************************@posting.google.c om:
John Bokma <po********@castleamber.com> wrote in message
news:<Xn*************************@130.133.1.4>...
That's mySQL, not PHP.

I mean something like:

$query = "INSERT INTO table VALUES(?, ?, ?)";
mysql_bla( $query, $a, $b, $c );

Hence without the quote_she_bang_garbage


I can't believe you can't actually write such a function yourself???


Sure. I can even write my own improved PHP clone. What's the point?
People should always be writing wrapper functions or classes to handle
db connections, to remove such stuff as addslashes()ing. Use
func_num_args() to find out the number of arguments passed to a php
function and func_get_arg([number]) to get the [number]th argument
passed. I've written such a function for myself.


Yes, and everybody has to write wrapper functions. You get the point
now, or do you want it spelled out?


But different developers will write wrapper functions in different ways.
Whish one should I choose? Why?
Well in fact I use
three classes for handling databases - one abstract "Database" class
for any database,


Yes, in Perl that is called DBI. You don't have to write it yourself.


Yes, but what happens if I don't like the way it works?
one Database specific class (eg mysql_db for mysql
databases) and a Query class for handling queries in the manner you
suggest. Now I do this:

$sql = "SELECT foo, bar
FROM table
WHERE a = ?
AND b = ?";
$db->query(new Query($sql, $a, $b), __LINE__, __FILE__);

And all query preprocessing is handled by the Query class, and
database connection/query processing/error handling is handled by the
database-specific class.

I use such classes in all my developments. They're written once then
forgotten about, and simply reused where needed.


Wonderful. With Perl it's put on CPAN and used (and tested) by many
people.
All I'm saying is that it's really pretty easy to implement many
things yourself, without moaning that the language hasn't done them
for you.


Programming shouldn't be about reinventing wheels, and worse reinventing
bugs.


But it is about reinventing wheels. A pram wheel is no good for a sports
car, so you have to invent one that works under those circumstances.

I have stopped using other people's solutions for the following reasons:
(a) There are too many solutions from too many people. The people have
various skill levels (from pathetic to passable), and the solutions are
tailored for specific purposes.
(b) It takes too much time to go though all the possible solutions to find
one that is applicable to the problem in hind. I find it much quicker to use
my decades of experience in devising my own solution.

Just my personal opinion.

--
Tony Marston

http://www.tonymarston.net

Jul 17 '05 #48

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
"John Bokma" <po********@castleamber.com> wrote in message
[ snip ]
People should always be writing wrapper functions or classes to
handle db connections, to remove such stuff as addslashes()ing. Use
func_num_args() to find out the number of arguments passed to a php
function and func_get_arg([number]) to get the [number]th argument
passed. I've written such a function for myself.


Yes, and everybody has to write wrapper functions. You get the point
now, or do you want it spelled out?


But different developers will write wrapper functions in different
ways. Whish one should I choose? Why?


The one that solves your problem the most efficient.

Imagine everybody writing wrapper functions all the time instead of
doing real work...
Yes, in Perl that is called DBI. You don't have to write it yourself.


Yes, but what happens if I don't like the way it works?


In that rare case you can write a wrapper, and make it available on
CPAN.
Programming shouldn't be about reinventing wheels, and worse
reinventing bugs.


But it is about reinventing wheels. A pram wheel is no good for a
sports car, so you have to invent one that works under those
circumstances.


If you want to screw something in the wall, do you make your own custom
screws or do you go to the hardware store?
I have stopped using other people's solutions for the following
reasons: (a) There are too many solutions from too many people. The
people have various skill levels (from pathetic to passable), and the
solutions are tailored for specific purposes.
With PHP, Perl or in general?
(b) It takes too much time to go though all the possible solutions to
find one that is applicable to the problem in hind. I find it much
quicker to use my decades of experience in devising my own solution.


I use my decades of experience to select a library or module, or consult
the right people. It has always saved me a lot of time and trouble.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #49

P: n/a

"John Bokma" <po********@castleamber.com> wrote in message
news:Xn*************************@130.133.1.4...
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
"John Bokma" <po********@castleamber.com> wrote in message


[ snip ]
People should always be writing wrapper functions or classes to
handle db connections, to remove such stuff as addslashes()ing. Use
func_num_args() to find out the number of arguments passed to a php
function and func_get_arg([number]) to get the [number]th argument
passed. I've written such a function for myself.

Yes, and everybody has to write wrapper functions. You get the point
now, or do you want it spelled out?


But different developers will write wrapper functions in different
ways. Whish one should I choose? Why?


The one that solves your problem the most efficient.

Imagine everybody writing wrapper functions all the time instead of
doing real work...


Image using the wrong wrapper function. Besides, even if you do write your
own wrapper function you only ever do so once. Then you re-use it, and
re-use it, and re-use it.
Yes, in Perl that is called DBI. You don't have to write it yourself.


Yes, but what happens if I don't like the way it works?


In that rare case you can write a wrapper, and make it available on
CPAN.
Programming shouldn't be about reinventing wheels, and worse
reinventing bugs.


But it is about reinventing wheels. A pram wheel is no good for a
sports car, so you have to invent one that works under those
circumstances.


If you want to screw something in the wall, do you make your own custom
screws or do you go to the hardware store?


If I want to fix something to a wall then a screw is not necessarily the
only method. What about a nail or even glue? There are different possible
fixings for different types of wall, so just because someone has invented
one type of fixing does mean that it is the only type of fixing.
I have stopped using other people's solutions for the following
reasons: (a) There are too many solutions from too many people. The
people have various skill levels (from pathetic to passable), and the
solutions are tailored for specific purposes.


With PHP, Perl or in general?


With PHP, UNIFACE, COBOL and a few other languages I have used in the past.
I don't touch perl.
(b) It takes too much time to go though all the possible solutions to
find one that is applicable to the problem in hind. I find it much
quicker to use my decades of experience in devising my own solution.


I use my decades of experience to select a library or module, or consult
the right people. It has always saved me a lot of time and trouble.


When there are thousands of competing libraries out there, how do I know
which is the right one? Should I spend weeks looking and comparing, or days
in writing my own?

Who are the "right people"? I have come across too many people who class
themselves as "experts" who turn out to be charlatans and quacks.

--
Tony Marston

http://www.tonymarston.net

Jul 17 '05 #50

58 Replies

This discussion thread is closed

Replies have been disabled for this discussion.