Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Benchmarking 3 PHP Accelerators

timothy posted more than 7 years ago | from the ack-phpttht dept.

81

jfbus writes "PHP, like all scripting languages, suffers from having to parse all script files each time a page is displayed. Accelerators (opcode caches) are necessary to speed PHP enough for large websites. Here is a benchmark of the major PHP accelerators (Zend platform, apc and eAccelerator)."

cancel ×

81 comments

Sorry! There are no comments related to the filter you selected.

Forgive me for my stupidity, (1)

remembertomorrow (959064) | more than 7 years ago | (#15438219)

but how does this work? If one makes something like this:
if($var) {
function Example() { echo "Hi!\n"; }
} else {
function Example() { echo "Bye!\n"; }
}
How does a function defined inside a condition get changed into opcode? Does it place a copy of both functions everywhere where Example() is called?

Re:Forgive me for my stupidity, (4, Informative)

tonigonenstein (912347) | more than 7 years ago | (#15438280)

In such a case you would compile each version of the function and implement the condition by an opcode that put a reference to the correct version into a pointer. Then every call to the function use the reference contained in the pointer. In a word, you use indirect function calls.

Re:Forgive me for my stupidity, (1)

Doug Neal (195160) | more than 7 years ago | (#15439350)

Excuse the pedantry, but that's five words!

Re:Forgive me for my stupidity, (1)

WoodstockJeff (568111) | more than 7 years ago | (#15438594)

Not just functions - conditional includes. In most cases, the accelerator deals with them poorly.

When someone says they have a "can not redeclare class X" error, it's probably because of a caching program being added. It's kept a copy of the compiled script... but keeps hitting those pesky "include()" calls, and reloads what it previously included in the compiled version, or it fails to include the correct file, because it already finished reading its includes.

With some applications, though, the time to compile the PHP is only a fraction of the time to run the program. What's the use of cutting a tenth of a second off the load time, when you're dealing with queries that take 5 to 10 seconds to run? Or if you've got a host that runs PHP as a CGI program?

Re:Forgive me for my stupidity, (1)

slackmaster2000 (820067) | more than 7 years ago | (#15439787)

In some applications that may be true, but overall accelerators do make a huge difference. I'm seeing over 2-3 times faster page generation times for most standard web applications (forums, CMS) using Turck mmcache (forced into memory only). No side effects that I've ever noticed after a couple years of running it. Taking advantage of MySQL's (4.1+) query cache also helps quite a bit.

It's a substantial difference, with heavy php+database pages like forum indexes generating in 0.3 to 0.5 seconds vs. 2 - 3 seconds under moderate load. The PHP cache accounts for a majority of the difference. Start piling on users and it becomes quite critical to server load and overall user experience.

Re:Forgive me for my stupidity, (1)

Oopsz (127422) | more than 8 years ago | (#15442105)

You know the turck codebase has been forked and supplanted by eaccelerator [eaccelerator.net] , right? There's no reason to use turck-mmcache anymore, especially since it hasn't been worked on since late 2003. EA is turck's logical successor.

Re:Forgive me for my stupidity, (1)

slackmaster2000 (820067) | more than 8 years ago | (#15442279)

I use it because I've been using it for years without a hitch. I'm still running PHP 4. No need to fix what isn't broken.

Assuming the development on eAccelerator is on the right track, I'm sure I will be using it at some point down the road.

not really scientific (1)

Keyframe2 (940074) | more than 7 years ago | (#15438226)

from TFA: "Zend Platform has roughly the same performance as eAccelerator and apc (you'll have to believe me, I don't have any numbers to give you), but is the only one to have an official support (provided you pay for it...). Unless you need a real support, unless you need the specific features of Zend Plaform or you really want to pay for the software (one never knows...), you probably do not need Zend Platform. I don't like Zend setup process : it does change a lot of things within php.ini, does many hidden things. " and so on...

Re:not really scientific (1)

richdun (672214) | more than 7 years ago | (#15438349)

What, you want numbers and objective reasoning to back up conclusions comparing three software platforms in an empirical manner? You kids and your obsession with not believing truths that aren't supported by facts.

Re:not really scientific (1)

passthecrackpipe (598773) | more than 7 years ago | (#15438844)

yeah, I thought the same thing - TFA goes something like "I am going to compare and benchmark 3 things for you, except that I am not really going to compare one of them, but while we are on the subject, the one I can't compare for you sucks anyway". The conclusion is just as good: "You can either choose one, or the other. You should choose the one I did, because it r0x0rz and is only better at one thing, but you may want the other one, because my test show it is performs better. Also, theone like has no future." good effort....

Re:not really scientific (1)

Albanach (527650) | more than 7 years ago | (#15439141)

Yes, it looks very much like the kid couldn't afford Zend Platform so just bashes it then disregards it.

Of course if your PHP site is seeing the sort of traffic levels that require an optimzer it's very likely you will in fact want the support that comes with Zend Platform - not to mention the integration and debugging features with Zend Studio. (I have no relationship with Zend other than being a happy customer).

Re:not really scientific (1)

SillyNickName4me (760022) | more than 7 years ago | (#15440382)

Of course if your PHP site is seeing the sort of traffic levels that require an optimzer

You see, you want an optimizer for quite another reason then the amount of traffic you get.

Simply put, it makes running the website less resource intensive, which means that you can host it at a lower cost. You can afford a lot more complexity with the same amount of resources, so you can offer more/better functionality, your web hosting will interfer less with other services on the same physical machine etc etc. Assuming that amount of traffic is what generates the desire for an optimizer is not wrong or such, but it is by far not the only, and in many cases not the most compelling reason.

I have made a lot of use of eAccelerator (and before that turk-mmc) to get a somewhat more complicated site to run on a small server. This is hobby and if I couldn't run it like that, I wouldn't run it, instead of spend money on either a bigger machine or a commercial optimizer.

it's very likely you will in fact want the support that comes with Zend Platform - not to mention the integration and debugging features with Zend Studio. (I have no relationship with Zend other than being a happy customer).

If you are running some commercial service with PHP, you most likely want that, yes.

Three? (1)

kailoran (887304) | more than 7 years ago | (#15438245)

Is it just me or do they only benchmark eAccelerator vs apc (vs bare php), only mentioning Zend here and there? Not as useful as it might be..

Like all scripting languages? (3, Informative)

Bogtha (906264) | more than 7 years ago | (#15438270)

PHP, like all scripting languages, suffers from having to parse all script files each time a page is displayed.

This isn't something common to all scripting languages. For example, when Python scripts are executed, they are compiled to byte-code, and the result is saved for faster execution next time. Of course, in typical web hosting situations, the web server doesn't have permission to write to the filesystem, but you can quickly and easily compile the bytecode yourself [incutio.com] . ASP.NET also compiles once only.

In fact, I believe it's an oddity of PHP that it needs add-ons in order to do this, and I think the next version of PHP will have fixed this. I don't know where they got the idea that all scripting languages must always parse the script on every invocation.

Re:Like all scripting languages? (-1, Flamebait)

Anonymous Crowhead (577505) | more than 7 years ago | (#15438316)

Well if you are using PHP, you are already riding the short bus - if you know what I mean. And I think you do...

Re:Like all scripting languages? (0)

Anonymous Coward | more than 7 years ago | (#15438332)

Agreed, if you are using mod_perl for instance, your scripts are compiled and cached (in RAM). And many folks use fastcgi with Ruby, which basically compiles your code once. Lisp folks keep a running Lisp image going (and can log into it and change the running code without restarting, oooh, gotta love lisp).

PHP really is the odd one out here. Just to get it to "adequate" requires commercial products.

Of course, part of the problem is the utter brain-dead "design" of PHP. With all that global stuff, it's hard to reliably keep code around in RAM. And based on my own experience trying to write a long-running maintance daemon in PHP, the damn thing leaks RAM like you wouldn't believe. I haven't looked at the source code but I bet it's pretty scary.

So, folks who use PHP would be best served moving to pretty much anything else. Having a cleaner language design and a community that isn't 95% newbies doesn't hurt either.

Re:Like all scripting languages? (1)

Ambush Commander (871525) | more than 7 years ago | (#15439526)

"And based on my own experience trying to write a long-running maintance daemon in PHP"

Maybe that's because PHP isn't supposed to be used for writing daemons. ;-)

Re:Like all scripting languages? (1)

pxuongl (758399) | more than 7 years ago | (#15438392)

when developing code, having saved precompiled scripts automatically done is the most annoying thing in the world....

Re:Like all scripting languages? (1)

Bogtha (906264) | more than 7 years ago | (#15438405)

Only if your setup isn't smart enough to notice when the source has changed and there's no way of disabling the caching. It's an old problem sure, but one with plenty of solutions.

Re:Like all scripting languages? (1)

gomoX (618462) | more than 7 years ago | (#15439151)

Dude, mod_python sucks in precisely that aspect. Have you ever used it at all? You can't reload code without restarting Apache or using PITA code such as Vampire. PHP kicks python's ass in this respect.

Re:Like all scripting languages? (1)

Bogtha (906264) | more than 7 years ago | (#15439363)

Dude, mod_python sucks in precisely that aspect. Have you ever used it at all?

Yes, I use mod_python a fair bit. The reloading rules can be confusing if you aren't used to them, but once you understand them, it's easy to set up a sane development environment.

The trouble with the way PHP does things is that even when you cache opcodes, you are still executing everything for every request. Since the Python interpreter is persistent across multiple requests, the expensive operations only need to be executed once every time an httpd process starts up, giving you loads more options when it comes to performance. Yes, that flexibility comes at a cost of complexity, but PHP's approach of simply making it impossible so people don't get confused is hardly optimal.

Re:Like all scripting languages? (1)

gomoX (618462) | more than 8 years ago | (#15440555)

Would you mind enlightening me on this aspect? I have never suceeded in getting sane behaviour out of apache/mod_python when developing other than having a bash script looping over "true" that restarts apache and waits for a keypress to do it again. And I do this quite a while.

Re:Like all scripting languages? (1)

masklinn (823351) | more than 7 years ago | (#15438601)

Only if the implementation of the language is idiotic enough not to be able to notice that the source has changed and should be recompiled to bytecode. While I agree this would probably be an issue with PHP, it's not in most other interpreted languages.

Re:Like all scripting languages? (2, Informative)

Just Some Guy (3352) | more than 7 years ago | (#15438629)

Does any language do that?

Python's loading algorithm goes something like this:

  1. A module tries to import another module named "foo".
  2. Find "foo.py" in the search path.
  3. Does "foo.pyc" ("c" for "compiled") exist in the same directory? If so, is it newer than foo.py? If both are true, then load it.
  4. Otherwise, compile "foo.py" and attempt to write the compiled bytecode to "foo.pyc".

Never in my time developing Python have I once encountered a problem with stale compiled objects. If your language of choice doesn't have this same functionality or its equivalent, then the problem is with the language and not the concept.

Re:Like all scripting languages? (1)

sr180 (700526) | more than 8 years ago | (#15440499)

Microsoft Foxpro does this with its 'programs', which are scripts that are compiled into form. However, unlike Python, Foxpro quite often manages to get itself with out of date compilations.

Re:Like all scripting languages? (0)

Anonymous Coward | more than 8 years ago | (#15440714)

Perl does it with the B::Bytecode compiler backend module.

Re:Like all scripting languages? (1)

Scarblac (122480) | more than 7 years ago | (#15438429)

Yes, and things like mod_perl just keep the Perl interpreter in memory, and load modules only once. I think all traditional "scripting" languages use something like that now, CGI is rather 1996...

Re:Like all scripting languages? (2, Interesting)

suv4x4 (956391) | more than 7 years ago | (#15438441)

In fact, I believe it's an oddity of PHP that it needs add-ons in order to do this, and I think the next version of PHP will have fixed this.

That's one of Zend's main revenue sources. They developed PHP, they developed the accelerator. But they sell the accelerator and offer PHP free with sources as a lure.

What I'm saying is, no, it won't be fixed in the next version of PHP.

Re:Like all scripting languages? (2, Insightful)

Bogtha (906264) | more than 7 years ago | (#15438584)

Rasmus Lerdorf has posted a PHP 6.0 wishlist [php.net] that includes an opcode cache. Rasmus is the founder of the PHP project.

Zend might sell an accelerator, but that doesn't mean they can simply forbid the founder of PHP from adding the feature to his own project. At this point, I think the question is which opcode cache gets added to PHP, not whether it will happen.

Re:Like all scripting languages? (1)

TLLOTS (827806) | more than 8 years ago | (#15441388)

I believe it's more than a wish. In fact I read previously that they had selected the APC opcode cache for integration with PHP, the main reason being that it had a compatible license with PHP whereas other opcode caches did not.

Re:Like all scripting languages? (0)

Anonymous Coward | more than 7 years ago | (#15438467)

ASP .NET is *compiled* to MSIL which itself is then compiled into native code upon first invocation, and again any time the files involved change. Python is compiled into bytecode and that bytecode is interpreted each execution. It's an advantage Microsoft has by sheer virtue of not having to be cross-platform. PHP is worse than either as it stands, since as a scripting language, it is inherently interpreted. If it were not interpreted, it'd not be a scripting language.

Regards,
-Steve Gray
-Cobalt Software

Re:Like all scripting languages? (0)

Anonymous Coward | more than 7 years ago | (#15438747)

Are you trying to make somebody look stupid by signing their name at the bottom of that steaming pile of shit? On the off-chance that you are actually that clueless (and your misplaced admiration for Microsoft would leave no doubt), I suggest you go and read this. [wikipedia.org]

Re:Like all scripting languages? (1)

Jerf (17166) | more than 7 years ago | (#15438755)

I don't know where they got the idea that all scripting languages must always parse the script on every invocation.

Some people have used that as part of the definition of "scripting language". Pre-dot-Net ASP* also worked that way, although I got out of that a long time before .Net and for all I know Microsoft shipped an accelerator at some point before .Net.

There was a time when this idea had at least some value. However, it's been a while now since I've heard a useful definition of "scripting language" beyond "what people have traditionally called scripting languages"; about the only criterion left is "statically typed" vs. "dynamically typed", and it's much more descriptive to actually use those terms instead of "scripting language" in that case.

(*: Which seems to be what PHP copied itself from, which actually explains a lot about PHP.)

Re:Like all scripting languages? (1)

drinkypoo (153816) | more than 7 years ago | (#15438838)

AFAIK Microsoft never provided an ASP accelerator - at least, I've never heard of one :P If I do a websearch I can't find anything either - all the accelerator products are for .net, making me wonder what microsoft's internal acceleration features are good for.

Easy (0)

Anonymous Coward | more than 7 years ago | (#15439104)

all the accelerator products are for .net, making me wonder what microsoft's internal acceleration features are good for.
Those features are for accelerating sales, not run-time performance.

Re:Like all scripting languages? (1)

Bogtha (906264) | more than 7 years ago | (#15439100)

However, it's been a while now since I've heard a useful definition of "scripting language" beyond "what people have traditionally called scripting languages"

I think the definition that most closely mirrors what people consider to be scripting languages these days is that it's a scripting language if the compilation step is automatic, optional or non-existent.

PHP not copied from ASP (1)

mgkimsal2 (200677) | more than 8 years ago | (#15471480)

(*: Which seems to be what PHP copied itself from, which actually explains a lot about PHP.)

PHP was *not* copied from ASP. PHP was originally started in (late?) '94, and was growing in popularity by 1996, when MS introduced their HTC stuff. IIRC "ASP" wasn't in real use until some time in 1997, by which time PHP was widely used.

http://en.wikipedia.org/wiki/Active_Server_Pages [wikipedia.org] says ASP 1.0 was out in Dec 1996. IIRC Rasmus has mentioned that some Microsoft engineers were on an early PHP dev mailing list soliciting input on what people liked/wanted in a web scripting system. However, I can't find any reference to that story anymore, and I might have just made it up in my head. :)

Re:Like all scripting languages? (1)

poot_rootbeer (188613) | more than 7 years ago | (#15438890)

This isn't something common to all scripting languages. For example, when Python scripts are executed, they are compiled to byte-code, and the result is saved for faster execution next time.

It's not a True Scripting Language if there's a just-in-time compiler involved, now is it?

Re:Like all scripting languages? (1)

mcasaday (562287) | more than 7 years ago | (#15439420)


It's not a True Scripting Language if there's a just-in-time compiler involved, now is it?


Python doesn't come with a JIT compiler. The .pyc files it saves out are byte code, not machine instructions.

As an aside: the .pyc files simply keep Python from having to re-compile from source to byte code every time the module is loaded. It doesn't provide any performance advantage past that initial module import stage.

That said, Pyco [sourceforge.net] can generate x86 instructions from Python code in a manner very much like a JIT compiler

Re:Like all scripting languages? (1)

masklinn (823351) | more than 7 years ago | (#15439442)

Why wouldn't it be? JIT compilation is merely a rather advanced kind of interpreter. AFAIK Python already has one [sourceforge.net] (even though dev on it has more or less stopped) and PyPy [codespeak.net] will supposedly include one out of the box, and I think Matz would like Ruby2 to have a JIT compiler.

Re:Like all scripting languages? (1)

lon3st4r (973469) | more than 8 years ago | (#15441023)

I don't know where they got the idea that all scripting languages must always parse the script on every invocation.

From wikipedia [wikipedia.org] : Those languages which are suited to scripting are typically called scripting languages. Many languages for this purpose have common properties: they favor rapid development over efficiency of execution; they are often implemented with interpreters rather than compilers; and they are strong at communication with program components written in other languages.

* lon3st4r *

Turck MMCache (2, Informative)

slashflood (697891) | more than 7 years ago | (#15438282)

What about Turck MMCache [sourceforge.net] ?

Re:Turck MMCache (3, Informative)

hhnerkopfabbeisser (645832) | more than 7 years ago | (#15438340)

The project died when the developer was hired by Zend. Last Version released in late 2003.

Reincarnated here: http://eaccelerator.net/ [eaccelerator.net]

Re:Turck MMCache (1)

gbjbaanb (229885) | more than 7 years ago | (#15438359)

turck is a dead project. It was forked to become... eAccelerator. It is mentioned in the article.

Re:Turck MMCache (1)

slashflood (697891) | more than 7 years ago | (#15438364)

What about Turck MMCache?

Ah, I see:

eAccelerator [sourceforge.net] was born in December 2004 as a fork of the Turck MMCache project. Turck MMCache was created by Dmitry Stogov and much of the eAccelerator code is still based on his work.

But it would've been nice to see a comparision between MMCache and eAccelerator as well.

Re:Turck MMCache (1)

martinultima (832468) | more than 7 years ago | (#15439154)

“But it would've been nice to see a comparision between MMCache and eAccelerator as well.”

I'd have to agree with you on this one – I've never used eAccelerator, and in fact I've never even heard of it up until just now, but I happen to like MMcache a great deal. I know that Wikipedia uses MMcache [wikimedia.org] , and I've been using it extensively on my own server [dyndns.org] as well, because it's a slow server and literally everything on there is generated by some PHP script or other...

Re:Turck MMCache (1)

slackmaster2000 (820067) | more than 7 years ago | (#15439878)

I'm glad this came up because I was wondering why there haven't been any new versions of mmcache.

I still use it because it's rock solid reliable and the performance is still fantastic. I'm now tempted to try out eAccelerator, but my gut tells me that any performance improvements would be fairly small. Anyhow, I'm adding it to the bottom of my "stuff to try" list.

Re:Turck MMCache (1)

matlhDam (149229) | more than 8 years ago | (#15441286)

I'm now tempted to try out eAccelerator, but my gut tells me that any performance improvements would be fairly small.

They are. The big advantage of eAccelerator over Turck is its PHP5 support, rather than performance enhancements.

PHP sucks (-1, Flamebait)

Anonymous Coward | more than 7 years ago | (#15438326)

For those of you hunting to an even uglier alternative to Perl, you'll find a friend in PHP. From the awkward string manipulation routines (who the fuck would want to use C-like functions to manipulate strings in a scripting lanugage?) to the horrendously crappy object oriented programming model, PHP has everything that nobody wants or needs in a language. Hell, you can even embed Perl in HTML pages these days in the same manner.

So, to recap, folks, PHP is...

  • Prone to security holes and misc. bugs
  • An awful pain to program
  • Slow as a dog, even in it's intended "niche" use as a web scripting language. Anyone intending to do something serious with a website would use Servlets or at least mod_perl.

MOD PARENT UP, MOD STORY/PHP/PHP FANBOYS DOWN (1)

SirJaxalot (715418) | more than 7 years ago | (#15438400)

MOD THIS POST UP.

But there's nothing uglier than Perl ! (0)

Anonymous Coward | more than 7 years ago | (#15439473)

Variables global by default? Default variable $_? Auto-converting arrays to array_size in scalar context? Parentheses hell when using multi-dimensional arrays?

learn your perl pragmas: use strict; (1)

Ayanami Rei (621112) | more than 8 years ago | (#15441942)

And if you want to confuse lowly developers just omit that in a module and start throwing around implicit function compositions too:

sub fix_bad_words {
    shift;
    my $BADWORDREGEX = shift || "(fuck|shit|cunt)";
    join map split $IFS, {/$BADWORDREGEX/ ? "*bleep*" : $_;}, $,;
}

Bonus points: So what does it do?

Parsing? (0, Flamebait)

imroy (755) | more than 7 years ago | (#15438387)

PHP, like all scripting languages, suffers from having to parse all script files each time a page is displayed.

Speak for yourself, PHP weenie. My Perl code is parsed and "compiled" only when I restart the FastCGI handler(s) for my Catalyst [catalystframework.org] web app(s). My templates [tt2.org] are (I'm sure) parsed on each invocation though. The situation is probably similar for other real scripting languages e.g Python and Ruby.

Re:Parsing? (1)

Jerf (17166) | more than 7 years ago | (#15438782)

My templates are (I'm sure) parsed on each invocation though.

I'd be surprised. I know Apache::ASP compiles each web page ("template") down to a Perl subroutine once per execution (unless you change it); I'd bet the TT works the same way. The speed gains are too large to ignore, especially in a web environment, and Perl makes it too easy.

Re:Parsing? (1)

onlyjoking (536550) | more than 8 years ago | (#15440812)

My templates are (I'm sure) parsed on each invocation though.

Apache::Template with mod_perl will allow you to have Template-Toolkit preloaded.

Not ruby. (0)

Anonymous Coward | more than 8 years ago | (#15451404)

Ruby is not compiled like perl, python, PHP, pike, etc, etc, etc. It's interpreted line by line just like a shell script. This is one of the reasons why it is so incredibly slow.

Comparison against other languages (1)

digerata (516939) | more than 7 years ago | (#15438418)

I would very much like to see a comparison of the three against established performers in different languages. For example: mod_perl.

"Accelerating" PHP is a waste of time (-1, Troll)

Anonymous Coward | more than 7 years ago | (#15438566)

PHP is crap. It's essentially just like ASP, except unlike ASP you're:

  • locked into a language worse than VBScript,
  • locked into an extension model worse than ActiveX,
  • have a database interface a billion times worse than ADO (for example, the standard PHP MySQL interface has no paramatarized queries!!! Who's the supergenius who thought that up?), and
  • lack almost all the functions, procedures, methods, or objects that would make web programming useful.


For a few glaring examples where PHP doesn't give you even the most basic requirements for first-generation web language, there's no equivilant to ASP's Response.Redirect(). There's no equivilant to ASP's Server.MapPath(). The handling of forms with multiple fields of the same name (like checkboxes) is so hideously broken I don't know if I should laugh or cry.

I want to avoid saying that most PHP sites are amazingly insecure. Certainly, this must be a function of the pathetic losers who use PHP, instead of some function of the language. But after spending even a week on BugTraq, one begins to wonder exactly what most PHP developers are smoking when they write sites.

In short, I think PHP sucks. It's little suprise to me that the editors on this site find it so endearing.

Re:"Accelerating" PHP is a waste of time (1, Redundant)

masklinn (823351) | more than 7 years ago | (#15438675)

I want to avoid saying that most PHP sites are amazingly insecure. Certainly, this must be a function of the pathetic losers who use PHP, instead of some function of the language.

The language helps though, the easiest example one can give is the dozen of different functions just to escape DB query parameters (there are at least 3 for mysql alone -- addslashes, mysql_escape_string and mysql_real_escape_string, only the latter being safe), or the wonderful built-in magic quotes that basically addslashes() everything and require you to stripslash every single parameter when they're activated (cause addslashes doesn't provide safe-to-inject values and fucks them up so you can't just *_escape_string them), or the wonderful Register Globals that was finally turned off by default (not even removed) in PHP 4.2.0.

Re:"Accelerating" PHP is a waste of time (0)

Anonymous Coward | more than 8 years ago | (#15443621)

or the wonderful Register Globals that was finally turned off by default (not even removed) in PHP 4.2.0.

Of course it's not removed. It's perfectly possible to write PHP code without any security problems even with register_globals on.

Some people were able to write non-shite PHP -- quite a feat, since it's still PHP -- even when the language went out of its way to make it easy to fuck things up. No reason those folks should have to rewrite their working code just because you and the other droolers bought computers.

Re:"Accelerating" PHP is a waste of time (2, Insightful)

fractalus (322043) | more than 7 years ago | (#15438780)

PHP may indeed be crap, but not for the reasons you specify.

  • Whether you prefer Perl-like syntax (that PHP uses) or VBScript syntax is largely a matter of preference. I've personally found that VBScript is more of a pain in the ass than PHP.
  • You can have ADO if you want it, or you can use PDO which does support parameterized queries. Or you can use mysqli instead of mysql.
  • I honestly found VBScript lacking more basic convenience functions than PHP ever did.


The extension model may be a matter of taste. I'll give you the benefit of the doubt. PHP's handling of multiple form fields with the same name does suck, but at least it isn't too hard to work-around (just re-parse the posted data the way it should have been done).

PHP security doesn't suck any worse than ASP or Perl or ColdFusion or anything else, once you disable things like magic_quotes and register_globals (which is recommended practice). However, there's a lot of crappy PHP code floating around, and if you're new to web programming, you don't know enough to tell the good code from the bad. Nor do you really grok the notion that your code can be hammered on by every malcontent on the planet. Those problems are also not unique to PHP. But since PHP is so widely available, lots of amateurs write code with it.

Re:"Accelerating" PHP is a waste of time (1)

masklinn (823351) | more than 7 years ago | (#15439392)

Whether you prefer Perl-like syntax (that PHP uses) or VBScript syntax is largely a matter of preference. I've personally found that VBScript is more of a pain in the ass than PHP.

Wrong, PHP doesn't use Perl-like syntax, it uses what it things of as Perl-ish "$" prefixes, the point that these wonderful PHP devs missed is that prefixes actually have a meaning in Perl, in PHP they don't (yes I do know that they're data access shit(1), and I do also know that this is retarded). PHP also removed much of the cryptic-but-useful Perl syntax. PHP definitely does not have a Perl-like syntax unless by perl-like you mean "not like perl's syntax at all".

You can have ADO if you want it, or you can use PDO which does support parameterized queries. Or you can use mysqli instead of mysql.

Remind me when PDO and mysqli finally made their way into the language? PHP5.1 and PHP 5? Are we supposed to be impressed? ADO was born in 1996 for god's sake, that's 4 years before the Zend devs managed to release PHP4 and and programmers had to wait 4 more years to finally get a non-braindead DB interface?

And we're only talking about ADO here, Perl's DBI was specified in 1994, Python's DBAPI was first released in 1996 and it's evolution (DBAPI 2.0) was born in 1999...

PHP security doesn't suck any worse than ASP or Perl or ColdFusion or anything else, once you disable things like magic_quotes and register_globals (which is recommended practice)

The point was why the hell do they exist in the first place?. PHP is insecure by design (in the broadest sense of the term, since PHP has no language design to speak of). Doesn't it bother you that the Zend devs built that level of insecurity in the core language, enabled it by default and are only now thinking of removing it for the next version or the one after that?

Re:"Accelerating" PHP is a waste of time (0)

Anonymous Coward | more than 8 years ago | (#15441976)

I'm trying to remember the last time I witnessed such a content free display of a poster's complete lack of clue, and I must say, I cannot; well done sir, well done.

While it is true that there is much to dislike about PHP, and many of its purported advantages over other languages for web development do in fact not exist, you have managed to completely miss all such in favor of ill-informed and cliched phlegm du jour.

I should not poke fun, it is surely not easy being so ignorant; my apologies and condolences.

Re:"Accelerating" PHP is a waste of time (1)

wonko_el_sano (800636) | more than 7 years ago | (#15439454)

PHP security doesn't suck any worse than ASP or Perl

Have you even heard of "taint-mode" in Perl? It's a built security mode to make sure no user supplied data can ever make it's way into sensitive areas (system calls, filenames, etc) without have been "untainted" first. I'd say that's a pretty big difference in the security of the languages.

Re:"Accelerating" PHP is a waste of time (1)

houseofzeus (836938) | more than 8 years ago | (#15442657)

It checks that you do *something* that *could* untaint it. The fact of the matter is a lot of people (read: the same types of people who write shit PHP) still have ample opportunity to screw up. PHP does have design flaws (though gradually these are being weeded out it has taken longer than it should have) but at the end of the day I think its bad rep has a lot more to do with the kind of 'developers' it has attracted.

Re:"Accelerating" PHP is a waste of time (1)

00lmz (733976) | more than 7 years ago | (#15440170)

You say that VBScript is bad, but please note that the ASP object model is pretty nice, and that you can access it through any ActiveScript language. Windows comes by default with VBScript and JScript, but you can also use PerlScript [activestate.com] , ActiveRuby [infoseek.co.jp] , and Python (with the Win32 extensions [python.net] ). That also means you get to use the libraries of those languages, which are a lot better than what VBScript itself has to offer.

Re:"Accelerating" PHP is a waste of time (1)

mdfst13 (664665) | more than 8 years ago | (#15478350)

register_globals is only a security flaw if you write bad code. Yes, it allows variable poisoning. However, it *only* does so if you use undefined variables.

Re:"Accelerating" PHP is a waste of time (2, Informative)

mogrify (828588) | more than 7 years ago | (#15438899)

/* libAnonCoward.php */

function Redirect($location) {
  header("Location: $location");
  die;
}

function MapPath($file) {
  return realpath($file);
}

Farewell PHP/Zend (0)

Anonymous Coward | more than 7 years ago | (#15438624)

http://nekovm.org/ [nekovm.org]

Re:Farewell PHP/Zend (0, Troll)

masklinn (823351) | more than 7 years ago | (#15438729)

Woonderful, these tools reimplemented ECMAScript, fucked it up with ugly, $-prefixed builtins, dumbed it some more and then sprinkled their spec with illegible english. What an awesome language not to code in.

Re:Farewell PHP/Zend (0)

Anonymous Coward | more than 7 years ago | (#15438931)

What an awesome language not to code in.

Correct.


Neko was intended as an intermediate language, designed to be easy to generate and parse, not to be hand-typed by humans. The VM is lightweight and performing well with JIT due in the next release. It's all in the documentation if you care to read it before spouting off like a child. ( I know, I must be new here. )

Re:Farewell PHP/Zend (1)

masklinn (823351) | more than 7 years ago | (#15439079)

Yeah, that's probably why the very first paragraphs of the front page tell me i can code in neko...

Re:Farewell PHP/Zend (0)

Anonymous Coward | more than 7 years ago | (#15439179)

Well you can, you can also code in assembler or binary if you have the time. No reason to say that a scheme compiler shouldn't produce C which is then compiled to platform specific assembly and finally to native executable. Neko is already bootstrapped, take a look at nekoML.

Yeah, but do they even work? (0)

Anonymous Coward | more than 7 years ago | (#15438915)

I've tried to use these PHP accelerator thingies (except Zend's) on a large Horde/IMP installation. It turns out we started getting random bugs and disconnections, as well as corrupted data. Do these things even work? Specially with PHP5, object-oriented code and in a large system with thousands of simultaneous users?

eAccelerator is great (1)

bahwi (43111) | more than 7 years ago | (#15439076)

But, it doesn't work with 5.1. And, 5.1's performance is pretty close to that of PHP 5 with eAccelerator(not php4 w/), and close to PHP 5 with. I can't wait for eAccelerator to come out for php5.1, but until then, APC compiles cleanly and works well. With a kickass control panel.

Zend's tragedy core dumps apache every 20 minutes.

PHP5.1 + eAccelerator Re:eAccelerator is great (1)

NuShrike (561140) | more than 7 years ago | (#15439260)

Eh? I'm running Wikimedia 1.6.3 with PHP 5.1.4 and eAccelerator 0.9.5.b2 http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/ea ccelerator/ [freebsd.org] ...

OH I see.. I'm using a version that works fine with PHP 5.1+. Fairly quick on this quad-550Mhz Dell.

The only stupid part is updating from PHP 5.1.2 required a recompile of eAccelerator.

Really necessary? (1)

MrZaius (321037) | more than 7 years ago | (#15440126)

The most heavily used PHP/apache/mysql-type server on my network (probably never used by more than tweny hosts at a go) never seems to have any speed issues.

It's a modest machine. Dual 600mhz p3, 256mb of ram. How bad/good/busy do things have to get before a php accelerator becomes necessary?

21 hosts == thermo-nuclear meltdown (0)

Anonymous Coward | more than 7 years ago | (#15440279)

Your bottleneck would be database load which varies per page (or per request). Typically, you wouldn't run into PHP performance issues with hundreds of users and your machine will probably run up against hard limits in your httpd.conf well before then. If you want a better answer, you can use the Apache benchmark tool ( $APACHEROOT/bin/ab ) to test your specific application and fill up your httpd logs.

Re:Really necessary? (1)

rgigger (637061) | more than 8 years ago | (#15470839)

There are a lot of factors here so trying to give you some kind of numbers would be rediculous without knowing your setup. But the simple answer is: If your CPUs get pegged at 100% all the time and all of that CPU is being used up by apache processes running php scripts then it's a good sign that it's time to install an opcode cache. Depending on what your doing they can make a HUGE difference.

bah (0)

Anonymous Coward | more than 8 years ago | (#15440578)

what a waste of webspace.

xcache from lighttpd (1)

randommemoryaccess (922901) | more than 8 years ago | (#15442769)

The guys over at lighttpd.net have released a new opcode cache for php - still in beta (i think), but some might find it useful: http://trac.lighttpd.net/xcache/ [lighttpd.net]
XCache is a fast, stable php opcode cacher that has been tested and now running on production server under high load. It support and is tested on all lastest php cvs branches, such as PHP_4_3 PHP_4_4 PHP_5_0 PHP_5_1 PHP_5_2 HEAD(6.x)
Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?