Is PHP still slower than Perl?

S

Sherm Pendley

Shawn said:
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--
 
S

Shawn Corey

Tony said:
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
 
T

Tim Tyler

In comp.lang.php John Bokma said:
For me Perl is #1 (if possible) because PHP is probably the worst designed
language ever.

PHP was never designed. It evolved.
 
T

Tim Tyler

In comp.lang.php @ said:
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.
 
T

Tony Marston

Tim Tyler said:
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.
 
S

Simon Stienen

Tim Tyler said:
In comp.lang.php @ said:
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.
 
J

John Bokma

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.
 
J

John Bokma

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.
 
C

Chris Hope

John said:
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
 
J

John Bokma

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,

Yeah, I know. Sadly the creator thought he could do a better job? He
should have had a better look at Perl and its design considerations, and
maybe learned from it.
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

Thanks. Perl also started as a tool for a specific task. But the
designer did probably more research or had more experience ;-)

On that page:
"The syntax itself was similar to that of Perl, albeit much more
limited, simple, and somewhat inconsistent."

Sadly, in PHP the focus has been on that inconsistent part, or so it
seems to me.
 
J

John Bokma

[ prepared statements ]
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.
 
C

Chris Hope

John said:
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
 
A

Andrew DeFaria

Michael Vilain said:
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.
 
D

Doug B

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.
 
T

Tim Tyler

In comp.lang.php Simon Stienen said:
Tim Tyler said:
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 :-|
 
T

Tim Tyler

In comp.lang.php Tony Marston said:
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.
 
T

Tim Tyler

In comp.lang.php John Bokma said:
"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?
 
K

Kevin Thorpe

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top