Posted
by
michael
from the choice-of-a-new-generation dept.
aftk2 writes "PHP.Net has just reported the release of PHP 4.3.0. The update sports a unified method of handling files and sockets, a bundled GD library (for working with images), and finalizes PHP's command line interface. For other information, check out the ChangeLog."
This discussion has been archived.
No new comments can be posted.
Thanks go to the PHP team for all this great work!!:-)
It's a pity though that Apache 2 support is still experimental. I hope the Apache and the PHP team get the work done fast so that Apache 2 can spread faster!:)
The last time I asked about apache2 support on the #PHP IRC channel, someone told me that the apache2 api is still a moving target and that's why it's taking so long for php to be "stable" on apache2.
I can't wait to use Apache2 but I need PHP support to be stable before I can upgrade.
Yes, this is a shame. I too hope they can get together and freeze the API or whatever it is thats holding things up.
Last time I tried php with apache (4.2.2 + 2.0.43 IIRC), apache would segfault when it received a SIGHUP after log rotation. It seems libphp4 was not handling the signal correctly.
This may have been solved by now, but I'm not going to use PHP with Apache 2.x until it gets better than this.
Actually, the prefork MPM module is the old 1.3-style model. Worker is a well-known threading model wherein a "boss" thread delegates work to a pool of "workers" and queues work requests when all workers are busy. Of course, it's more involved than that, and there are several sub-models of the Boss/Worker model, but you get the point.
Is the friendly error messages [php.net] , they point you back to the PHP Documentation [php.net]. Being a regular in #PHP IRC channels, this is going to save me a lot of headaches:) Praise the lord, the newbies have fully automated RTFM messaging!!
My favorite are the Web Monkey'esque articles that show you how to create a content management system that can be "hacked" by an 11 year old with little more PHP knowledge than O'Reilly's pocket reference.
I have nothing against learning and growing, what I hate are people who don't read the documentation and ask dumbass questions. Too bad I can't find any example, but if you read the PHP forums I'm sure you'll see a few of them.
I'll have to recheck this later, but I installed PHP 4.3.0 on a Cobalt RaQ3 over a PHP 4.2.3 install using the same configuration line, simply adding the GD install flags. The PostgreSQL make errored out on the install, when it was compiled in 4.2.3 without a problem. Took it out of the configure line, and it installed fine.
I really do enjoy having Postgre and MySQL support on the same machine, but for now I guess I'll have to stick with MySQL until I figure this one out.
But above all, CONGRATS on the changes, PHP team, and please keep up with the good work! It's a great software and a great asset to server administrators, programmers and scripters around.
...this just came in to my inbox. PEAR at version 1.0. Good job folks!
The new PEAR package PEAR-1.0 (stable) has been released at http://pear.php.net/.
Release notes ------------- * set default cache_ttl to 1 hour * added "clear-cache" command
Package Info ------------- The PEAR package contains: * the PEAR base class * the PEAR_Error error handling mechanism * the PEAR installer, for creating, distributing and installing packages
One of the problems I'm having is that there's no way in the standard PHP build to deal with XML. I either have to treat it as a string and write regular expressions (which, as anyone who knows the regexp xml problem, isn't reliable) or build my own with some external xml library, meaning that as I want to allow others to use my code I have to get each user to recompile too (which is like asking people to recompile their kernel, some will do it, some won't, and there's _usually_ no good reason why it had to happen in the first place).
Does this release change what's bundled in the base XML support? They mention function call changes but usually those functions are useless without a recompile.
PHP is still mostly a web page language. XML support should be just bread and butter to it. I need it to deal with RSS or RDF. I need it to deal with user input (if I want to do XHTML I don't want a user typing posts that are malformed - right now I have no way of knowing that).
//
Php has strip_tags() which, naturally, strips tags from a string. But as there's little functional difference between tags and attributes it seems strange that I'm unable to strip attributes with as easy a syntax (yes, I have to use regexps again).
//
I hope this doesn't sound too down on PHP. It's a good language. It's just not a great language like Java or.NET (lets face it, OO in PHP isn't great, and that's what most people have been waiting on PHP 4.3 to fix)
PHP can be configured for XML support, but I've seen PHP move from HTML to XHTML support instead. One thing I'd love to see is a way for an install-level configuration for using XHTML or XML on PHP output. Also, yes, the striptags and htmlentities and such will barf on XML codings, and there should be better support for this, hopefully in 4.4.0
You should consider switching to the Zope [zope.org] platform. Although XML parsing is not yet out-of-the-box in Zope, there are several products for the platform available free of charge that should do what you want it to do.
Expat/SAX in PHP rocks. XSLT is pretty good. The PEAR XML parser isn't bad, either.
However, XML-DOM (DOMXML, whatever) sucks because, well, can you say, "Shifting APIs"? On the one hand, I appreciate the fact that it's getting fairly close to W3 specs now, and that's a Very Good Thing(tm); on the other, the function names and definitions (along with some of the interfaces themselves) have changed in very non-trivial ways with nearly every single bloody point release since 4.0.0 and it's a royal pain in the arse. I'm working on a project right now that would be much better done if we could depend on consistent DOM support.
My pet peeve aside, the new release looks pretty good.:)
(Before you flame, please consider the possibility that there might be other uses for the Document Object Model besides making stuff fly around in browser windows. Thank you.)
please educate yourself further. When you post obviously ignorant remarks like this you make yourself look extremely dumb.
You can compile SAX or DOMXML function into php or you can load them as modules. Same with mysql and postgres. As a rule PHP can load any set of functions dynamically or it can compile them statically.
Having external libraries is no different then PERL having modules, or VB having dlls, or java loading classes.
All the libraries you need are included in the distribution. Get the source code and do a./configure and choose the modules you want loaded statically. What is this nonsense you are sprouting off about them not "being included by default".
Please do yourself a favor and actually install the thing before you start rambling about things you know nothing about.
Look you obnoxious boy, when did I ever say it wasn't possible? Where did I ever say that the issue I have with PHP was to do with lack of support for XML?
I didn't. You're an obnoxious git who argues against cliches of his own invention.
However, I did say "there's no way in the standard PHP build to deal with XML" because in 90% of the installed PHP base out there there is no XML support. As AC said,
"GD could be configured too, but now it's standard because they understand that being in the base distro has social advantages. Why not XML too"
The PHP programmers obviously recognise the distinction between being included in the standard build and being an optional extra. You insult me for making the same distinction. Not including it by default means it won't be available on 90% of the installed PHP hosts out there, meaning that those offering (OSS) PHP software for download can't rely on others having those libraries. Notice the distinction?
I'm not saying include everything by default - as I'm sure you'll extrapolate my point to. I am saying that XML support should be default, like GD.
You can't even talk respectfully to strangers. You're a freak.
"The PHP programmers obviously recognise the distinction between being included in the standard build and being an optional extra."
Once again go and actually install the thing before you make ignorant comments like this. You have to configure the thing before you make and install it. Have you ever compiled a unix app before? Who the hell cares what is "default" and what is not. You always have to include at least one thing or another or you are going to get a pretty useless php build.
If you are really too stupid and lazy use the debian system. They have separately compiled each and every php option into loadable modules so you can do things like apt-get install php-XML. Or you can use freebsd which gives you the popular options in a menu.
Who the hell cares what is "default" and what is not.
PHP programmers, me, and apparently a few others.
What is default will spread more than what is optional. Recognising this has allowed programmers to rely on features.
You always have to include at least one thing or another or you are going to get a pretty useless php build.
By default PHP is "pretty useless". Heh.
Nobody is the same, but if 50% of people are compiling in GD support then it should be included to save them the effort. Making defaults suit the most people is a great thing.
When did I ever say that I had not installed it? When did I ever say that the issue was with running the software I want on my system alone?
Again, you seem unable to distinguish between your own cliches and my posts - between your imagination and reality.
And you have the gall to call me a moron. Seek help, buddy.
" Who the hell cares what is "default" and what is not.
PHP programmers, me, and apparently a few others."
Man you keep bitching about this. Let me get this straight now. You are bitching and moaning about the fact that you have to type --with-xml when you build it. Is that right? Here let me quote your original post to let the world know exactly how stupid you are.
" One of the problems I'm having is that there's no way in the standard PHP build to deal with XML. I either have to treat it as a string and write regular expressions (which, as anyone who knows the regexp xml problem, isn't reliable) or build my own with some external xml library, meaning that as I want to allow others to use my code I have to get each user to recompile too (which is like asking people to recompile their kernel, some will do it, some won't, and there's _usually_ no good reason why it had to happen in the first place)."
So because you are too dumb to know to type --with-xml and because you are too lazy to actually read the manual and because you are too blind, high and retarded to follow the instructions when you type./configure you have to actually write XML parsers using the built in regular expression functions.
Yes that's exactly what you said!. Hey people look at me I am too stupid to type --with-xml so I bitch and moan about parsing XML with regular expressions.
Man you keep bitching about this. Let me get this straight now. You are bitching and moaning about the fact that you have to type --with-xml when you build it. Is that right?
No. No. No. Read. Comprehend. Post. And I must say how very unlike you it is of you not to read my posts and for you to invent my argument as you go.
Maybe if I repost what I've already said again and again you'll read it. Then again, maybe you're insane...
"What is default will spread more than what is optional. Recognising this has allowed programmers to rely on features."
"...in 90% of the installed PHP base out there there is no XML support"
If I offer PHP software for download then in practice more people will use it and be able to use it (ie. generic php hosts) if I use default features. With your take on it I shouldn't consider what's default and what's not. Your ignorance in saying "Who the hell cares what is 'default' and what is not" states that defaults don't matter. When Redhat includes GLIBC by default, years ago, programmers could finally use it. It's not a problem downloading and configuring software on my box, it's the social situation of releasing software. Your beliefs go against PHP's programmers who decide what should be included by default.
You continue your rude, arrogant, and angry posturing. There won't be any posts responding to you, freak.
"When Redhat includes GLIBC by default, years ago, programmers could finally use it. It's not a problem downloading and configuring software on my box, it's the social situation of releasing software. Your beliefs go against PHP's programmers who decide what should be included by default."
Oh come on now that's a ridiculus argument to make. If you are delivering your application to somebody make the xml module a.dso and have them load it. It's like delivering any other software, if your software a library dependencies then you either ship the library or ask them to download and install it themselves.
People who do not have root access to their machines can not install the vast majority of the software available to them. Why is this any different?
If your php host does not have the XML module installed then find somebody else. What if you wanted the CURL extension or the ming extensions and your provider did not install them? Should those be in the default too? How about the ovrimos database functions let's roll them up as default too who knows somebody might want to write an application using them. Yes roll up everything anybody might want to use and deliver a bloated slow php to everybody.
Oh and by the way you do not have to recompile php to load modules. You can load them dynamically. If your host is not willing to put in the function you want either by compiling or loading dynamically then by all means drop them like a rock and find a host that is more responsive to your needs. Why would you want to host your website with somebody who was "incompetent, impatient, and lazy" anyway?
> Why would you want to host your website with somebody who was "incompetent, impatient, and lazy" anyway?
Well, _Donut_Troll was wrong about both PG and needing to recompile, but he's right in that there are all kinds of situations where a developer might not have control over the server itself. That could be determined by an employer or client -- or the hosting might be locked in by a long-term contract. The poor schlob's supposed to drop his job or the equivalent just to satisfy your worldview? Geeez.
(Another scenario: The developer's obligated to work on IIS, which IIRC doesn't support dl() in ISAPI mode.)
Why do you persist in being such a hard case, anyway? If you don't use MySQL or GD or whatever, that's fine, it's not like somebody's forcing you to, so if it's helpful to (some) other PHP developers, how does this hurt you? Do you also oppose the inclusion of PEAR by default, which most would probably agree is a good thing?
DOnut troll was wrong about a bunch of things but we'll let that go for now.
"but he's right in that there are all kinds of situations where a developer might not have control over the server itself. That could be determined by an employer or client -- or the hosting might be locked in by a long-term contract. The poor schlob's supposed to drop his job or the equivalent just to satisfy your worldview? Geeez."
There are some people with no control over their programming environment. Boo Hoo. I don't want my php bloated to satisfy the needs of the minority.
> No they are the minority they get to fuck off and leave the rest of us alone.
That's really interesting, coming as it does from a member of a minority (alleged *nix user).
I'm starting to understand your sig now -- you aparently believe, just as Bill Gates seems to, that you need to make sure that the next generation doesn't get the breaks you did. And unless you can claim that you wrote all your own software and figured out how to do so with no outside assistance whatsoever, you got them.
Too bad I don't have a "Hypocritical Elitist" list I can add you to.
I am a minority in many many ways and Yes that means that frequently I get to fuck off and deal with it. That's the way life works ya moron. Why don't you get out once in a while and experience it for yourself.
What the hell does the next generatio have to do with compiling your php?
> I am a minority in many many ways and Yes that means that frequently I get to fuck off and deal with it. That's the way life works ya moron.
Only because hardasses such as yourself keep propagating it.
> What the hell does the next generatio have to do with compiling your php?
It means that you'd rather deprive those who don't run their own servers (yet) of the opportunity to make use of increased funcitonality just so you don't have to type --disable-[feature].
In short, you're a self-centered social Darwinist, and I'm not.
If you can't come up with any better response than that, then it's rather questionable whether or not you really had anything to offer the discussion to begin with.
I don't think I'll bother checking this thread for any more replies.
>>OO in PHP isn't great, and that's what most people have been waiting on PHP 4.3 to fix
No, that's what people have been waiting on PHP 5 with Zend 2.0 to fix. Big difference.
However, your comments about XML and string handling have nothing to do with PHP's OO capabilities. I would argue that PHP's string handling and regex are better than the standard ones you find in Java or.NET.
XML support? Well, yes PHP isn't a native XML-handling language, nor is Java (.NET might be another story).
With any standard programming language, though, XML support is not "native". You have to include the appropriate modules or classes. Ditto with Java.
I too would love to see XML natively available for PHP. I've written a module that gives a nice simple API to XML, it's available here [progressiv...ishing.com], but the problem is it needs to come with PHP as standard for it to become widely used.
On Windows, libgd was installed by default, but on *NIX and other platforms, you had to install all the libraries to support GD, and then install GD, and then configure PHP for GD support. With 1.6, 1.8 and 2.0 versions, many things did not work properly between all these versions on *NIX systems, compared to Windows PHP. Plus there were some bugs that couldn't be worked out in PHP because they were in the GD code.
To make it more compatible cross-platform, get a unified libgd version to use, and add functions not normally found and fix bugs, PHP has added GD as a bundled extension. This is a good thing.
Most server side scripting engines nowadays employ opcode caching. Code is compiled the first time executed, but run from memory the rest of the time.
This is different from HTML output caching.
Opcode caching is said to increase performance by 30-200% depending on the cache code you use and your app.
With about 30% of apache installs running PHP, and with more than 50% of the web running apache, I'm surprise the PHP does not include an opcode cache with the install.
That's a lot of wasted cpu cycles:) Just compiling PHP scripts on every page hit.
There are open source caches out there, see the link in my sig.
Why no official PHP Opcode cache [weblogs.com]? 30-200% performance gain
Simply asked, simply answered: there is no "official" PHP opcode caching because PHP relies on the Zend engine and the PHP developers work very closely with the people at Zend, who sell the Zend Performance Suite [zend.com] (formerly Zend Accelerator), and the guys at PHP are not about to cut into Zend's livelihood by bundling a product with PHP which makes the Zend product redundant.
Simply asked, simply answered: there is no "official" PHP opcode caching because PHP relies on the Zend engine and the PHP developers work very closely with the people at Zend, who sell the Zend Performance Suite
That's the main answer I'm hearing. But zend is very expensive.
Maybe there's a compromise. How about a modest PHP opcode cache that has only some of zend's features; ie. a little bit slower and more conservative than zends.
I appreciate the work the zend guys have done, trust me I do. But that's an important feature to leave out.
Ok, lets see, in the same thread there is a post about PHP not having an XML parser of any kind (the author mentions having to use regexp, insane as that sounds), I am assuming that means there is no HTML parser (or an equivalent of HTML::TreeBuilder at that) either.
Call this "informative-flame" bait, but I am trying to figure out why people get upset when PHP isn't refered to as the greatest thing of all time. I personally haven't used it for a couple of years, so I don't know about many of these features.
What does PHP use in terms of a browser agent (a la LWP)? Is there really no support simple filebased db persistence? (by which I mean something along the lines of tieing a hash to BerkleyDB). How well does it hook into the other stages of the Apache request handling pipeline?
Oh and something I'm curious about (too lazy to look it up, I guess) what sort of exception handling does PHP have (ie it's equivalent of 'try {} catch {} finally {}')?
What sort of logging modules are available? (log4PHP?) I'd also be curious to know about how PHP's templating systems measure up, from someone who's had experience with this sort of thing...
Anyway, this is a troll, but I am curious about the answers to those.
"Ok, lets see, in the same thread there is a post about PHP not having an XML parser of any kind (the author mentions having to use regexp, insane as that sounds), I am assuming that means there is no HTML parser (or an equivalent of HTML::TreeBuilder at that) either.'
PHP has both SAX and DOM based XML parsers. It also has an xmltree function to instantly build you an object hierarchy from an XML document. There is also the most excellent phpxpath object available here [sourceforge.net]
"What does PHP use in terms of a browser agent (a la LWP)?"
It supports fetching from URLs the same way as opening and fetching from files. The new version also has streams. Also it has hooks into CURL for more sophisticated stuff. There is also the excellent snoopy [sourceforge.net] object.
"Is there really no support simple filebased db persistence? (by which I mean something along the lines of tieing a hash to BerkleyDB)"
There are hooks into berkley db if you want to sink to that level. If you want to sink even lower then any php variable, array or object can be turned into a string and saved to files or sent to other URLs or what have you.
"How well does it hook into the other stages of the Apache request handling pipeline?"
You don't have that much control over the pipeline but you can hook into auth and such. I never needed anything it did not provide.
"Oh and something I'm curious about (too lazy to look it up, I guess) what sort of exception handling does PHP have (ie it's equivalent of 'try {} catch {} finally {}')?"
PEAR has a pretty good error handling library. Otherwise you basically just test for errors manually. You call a function with @function which surpresses error messages but sets global error indicators which you can test for. Not great but gets the job done. Version five will have try catch. All in all error handling in php is better then perl and worse then java.
"What sort of logging modules are available? (log4PHP?)"
PEAR has a logging class. I know that there are others out there as well. PHP also hooks into syslog if you want that.
" I'd also be curious to know about how PHP's templating systems measure up, from someone who's had experience with this sort of thing..."
smarty [php.net] is an outstanding templating engine with caching. I don't see how you could possibly do better. There are numerous others.
I hope this prevents you from further trolling. Now that you are armed with actual knowledge (which you could have gotten by simple searching) you no longer need to troll here.
Thank you, very informative. And why would I want to search for all this myself when I could just ask knowledgeable people and quickly get a summary of all I wanted to know?:)
All in all error handling in php is better then perl and worse then java.
This I find hard to believe, the only advantage java has over perl in this regard is checked exceptions (and certainly enough arguing has taken place over whether or not this is actually a good thing). So PHP adds a feature over and above perl's Error.pm which insn't quite as good as checked exceptions but enought to make it better?
Anyway, thanks for the answers, this was a very useful troll.
"So PHP adds a feature over and above perl's Error.pm which insn't quite as good as checked exceptions but enought to make it better?"
It's not just that. There is a lot to php error handling. You just have to learn about it and use it to your advantage. I personally think try catch is not that great and in some ways would prefer the existing php error system. A stack trace would be cool thought.
>>Oh and something I'm curious about (too lazy to look it up, I guess) what sort of exception handling does PHP have (ie it's equivalent of 'try {} catch {} finally {}')? What sort of logging modules are available?
>Well it has that. It doesn't have/manual/en/ref.errorfunc.php [php.net] (in summary, it blows)
PHP5 will have try/catch/finally. Yes, these days it still blows.
>>I'd also be curious to know about how PHP's templating systems measure up, from someone who's had experience with this sort of thing...
>Well templating is quite well done. There's FastTemplate and Pear's one. It's difficult to do XHTML templates without XML support. I guess it's not easy.
There are quite a few good templating engines with PHP, including two which are PHP modules (compiled C code), providing good performance.
>But how is it difficult to do xhtml in templates?
That wasn't me saying that. I was responding to the original poster. You are correct; XHTML is completely a client-side thing, so it has nothing to do with PHP support.
By the way, there is a cool PHP class that dynamically generates well-formed, indented XHTML: phpHTMLlib [sourceforge.net].
Is better documentation. Like most CS students I got started with Java. The Javadocs are incredibly easy to read and learn Java from. The PHP docs are anything but easy to read by comparison. Thus far, the only PHP I've learned is from books and source code (it's pretty easy to pick out what most PHP functions do from source examples). Python suffers from a similar problem IMO. I've been trying to get started with a bit of XML parsing and tried Python first. It was a pain in the ass to figure out what classes were being returned by functions among other things.
I think OSS projects working on languages and libraries should commit to including comments like this to help newbies (especially if the language is dynamically typed)/* function name: input parameters: return type: purpose: parameter 1: (purpose) parameter 2: (purpose) */
I can't believe you're saying this.
The PHP docs are brilliant.
You just type in the function name, and there are enough examples to get you running until you actually start understanding the language.
I learnt PHP purely from www.uk.php.net, and I have always found the Java and Perl docs to have too much stuff in them.
The PHP docs are like this:
mysql_connect ([hostname],[username],[password])
Returns true if successful.
What more do you need to know? What goes into a function, what comes out.
I'm genuinely not trolling here, I'm just surprised that anyone could moan about the PHP docs.
This is on the TODO but all the information is included on every man page currently. New parameters and changes to parameters are in the form of notes on each given doc page. So all the information you ask for is already available, just not in a consistant form. Yet. This is a big job, would you like to help?:)
Tip: To get the most out of the documentation, you really need to use the online version. You can query it quite easily from your browser simply by typing php.net/ThingYouWantToKnowAbout into your location window. It'll pull up a function name, list of function names that closely match your search term, or a list of pages containing the search term. Try something like php.net/integers (returns a list of 52 documents, most of which relate to integers in one way or another) or php.net/file (returns the manual page for the file() function) and you'll see what I mean. Also check the user-contributed notes. I've found a lot of good tips and hacks in those.
Well the online docs seem to be written for someone with a programming background. If you have no idea how a if, for, while, switch, etc control structures work, you might have a hard time. I've learned php from the web docs, and a few random examples and now I'm a wiz. It also helps when programming php to know how the web works since writing a php program is nothing how you'd write a c program. Once you get in this mode of thinking it all becomes very easy.
I never, ever wanted anything more than the existing web docs, but I came from a solid c/c++ background, and I already had been using html for 3 years.
Maybe it would help if there was a web primer to bring people up to speed where the function listing help would be of more using and make much more sense.
This is fine and dandy and all.. but for all of us Ensim users.. we are still stuck on outdated PHP and apache.. Ensim still relies on their own versions oh PHP and Apache.. THIS SUX..
GD library is now bundled with the distribution and it is recommended to always use the bundled version
Why recommend the use of their bundled library? Why is this any different from their MySQL support (IE, a "mini" bundled MySQL library is included, but can (and should be) overridden by the normal MySQL libraries if they exist on the system). I can understand that many machines don't have GD libraries, but why "recommend" that their own code be used as opposed to the system libraries if available?
As with all PHP.0 releases, be wary about installing this release on production servers, even though this release has gone through a lot more testing than usual. I know of at least a few annoying bugs which were not fixed before the 4.3.0 release, such as a memory leak in a string handling function, and the fact that all PHP error messages are output to the global Apache error log even if they're only supposed to be displayed on the page itself. Also, I noticed that if you have older PHP3 classes lying around which mistakenly redeclare a function, the entire script which uses the class will now fail under 4.3.0, where it would not trigger an error under previous versions. This is not a bug, but beware of it since it could break older applications.
is that you need to get the Zend Performance suite, or at least the Code Accellerator, if you want the best performance from your scripts. Spend the bucks, then your code will run 15-20 times faster. [zend.com]
So am I missing something? The early releases of 4.3.0 talked about passing objects by reference, static/private members, etc. Did this get pulled and moved back to 5.0?
no, but hosting companys that can't be arsed to compile the good versions of GD won't have to anymore with this new PHP so any hosting company with the latest PHP will be fine for GD users from now on.
* The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work (whether or not OO is all that great is another discussion.) Hopefully Perl will be patched up so it supports such must-have OO features like introspection, reflection, self-replication and ontological data-points.
How is this? PHP's OO is weak and kludged together ( but will be much better come Zend 2/ PHP 5 ).
I'm not sure if either (a) Smalltalk is horrible ( which from my understanding isn't ) or (b) the parent should be modded +1 Funny. Seriously, putting PHP in the same OO ranks as Smalltalk is like putting a Ford Escort in the same offroad handling ranks as a F-150 truck.
On a side note, is it just me or is/. really slow right now?
>> FYI, Java's object model is very close to that of SmallTalk.
> I'd say it's closer to C++, which uses a Simula 67-style OO.
Java, like C++, Java and PHP use class-based inheritance.
JavaScript (aka ECMAScript), on the other hand, uses prototype-based inheritance, which is more like that of Smalltalk. Perhaps this is what the first poster was thinking of...?
by Anonymous Coward writes:
on Friday December 27, 2002 @03:34PM (#4968540)
While I wouldn't use its to code the new Doom (VB would be a better choice)
*ROTFL*
Ahh, an excellent post. I'll give you a solid B+.
But, if I may give you some advice. The VB comment gives you away. You must make your trolls highly subtle, even more so than they are now. They must balance lightly on a fine edge between Trolldom and NonTrolldom. People in a hurry should be able to scan your message and be 100% convinced you are an idiot, and have no idea you are really in control. Then they will post, and when the troll is discovered, THEY will look like idiots, and you will be revealed as a genius because of your gentle entrapment. This is the true genius of a troll. To ensnare and to incite the unwary.
One metric I use in my own efforts is the dynamic of up/down moderations. A "perfect troll" should look like this:
First the comment should be modded up +3 or +4 insightful immediately, since your post will no doubt be long, and in the early stages, all long posts are considered insightful because nobody bothers to read them.
Next, people who disagree with you will come by and mod it down to +1 flaimebait (a few humourless souls will actually mod it as a troll).
Next, people who get the joke will come and raise it to +3,+4 funny. Now your Troll is gaining steam.
It should waffle about between Troll and Funny for several minutes, hours if you're good. Hitting zero is a bad sign, your post might get lost. If this happens, you made your troll too inflammitory.
When things settle, you should have "total=16" or better in the mod point summary.
Finally, it should stablize at +4 funny. +5 means you made the joke too obvious. +4 is perfection. If you make it this far, congratulations!
Excellent troll all around, well done. I especially like the points about database access and data structures.
Of course you forgot to mention PHP's new command line mode which makes it more versatile than perl. The vast resources available from CPHPAN, and more specific projects, such as BioPHP. And PHP's tighter integration with client side DHTML technologies such as JavaScript, CSS, DOM and XML which allow you to do DHTML natively in PHP.
Well since someone modded up the troll I suppose I should reply to it.
* Ease of use.
I started with Perl, I was writting web pages in a day with it. Maybe it depends on the teacher.
* The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work
I use PHP, I have yet to see a reason to do much OO in what is primarily a web scripting language to embed in an HTML page. What I have seen seems incomplete and difficult to use. Contrast to Perl which while it may not be as feature complete as say Java or Smalltalk it is certainly easy to use and I think it has the right principles behind it. Especially after Perl 5.6. As far is PHP being as good as Smalltalk at OO, I have my doubts but I can't say for sure as I don't program in Smalltalk.
* Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later. I've heard that this will be fixed in upcoming versions of Perl though.
This is simply untrue, Perl supports tons of databases through the DBI (which is also fairly simple to write new drivers for if you need them) and even if there isn't a native DBI driver, DBI supports ODBC and you can use any database that has it. That's certainly far more than just MySql and Postgres. I think your description of databases in Perl fits better for databases under PHP especially before PHP 4.
* Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl requires that much rewriting.
FUD. It depends on what you do. Last I saw Perl has been ported to every major platform except Palm. Contrast to PHP which is on what Linux and Windows? Okay maybe some other Unixes. Perl is on dozens of Unixes, OS/2, Windows, MacOS (Before OSX), and I even had a friend using it on VMS and I also think there's even a DOS version. Some networking features used to have issues on windows but that's been fixed now with emulation
* Speed. PHP is one of the fastest languages I've ever used. While it won't be replacing assembly or C, its definitely faster than Perl in almost every case, particularly in regex which has long been Perl's strongest point. I'm sure there are cases where Perl is equal to PHP, but I can't think of any at the moment.
If your using if for administration scripts and text processing I don't know if Perl is faster or not, but for that sort of thing I doubt there is enough difference to care and i can't imagine how annoying it would be to try writting that sort of thing in PHP. (That's just personal preference though)... On the web PHP beats a CGI script written in Perl because PHP is normally compiled into the server. Using mod_perl fixes this problem and gives you the power of Perl with equal or greater speed... I'm not going to say one is faster than the other because benchmarks are very subjective. Finally as I understand it, mod_perl scales better.
* Graphics. PHP comes with a nice little graphics library. While I wouldn't use its to code the new Doom (VB would be a better choice) its adequate for most web pages, and should be considered as a substitute for Flash for certain things. Perl lacks a graphics library of any kind.
More FUD: How about OpenGL [cpan.org] or maybe the GD library [cpan.org] (which is what PHP uses). Oh yeah there's even a Gimp Perl interface [cpan.org]. Not to mention SDL tie in and several others. In fact if you go to CPAN Search [cpan.org] frontpage there is a link that says "Graphics" which lists several common ones. The fact that these are not in the core language is a good thing. PHP's braindead way of putting everything_in_the_same_namespace() gets really old.
* Data Structures. Perl has references which can point to sub routines, arrays hashes or other contants or scalars. You can also muck around with the underlying GLOBS and there are a bunch of B::* modules for mucking around with internals as well. I certain that you can probably accomplish the same things using those tools. However even if you can't when do you need that sort of thing in a website? I think that if I need a data structure that complex I'll write it in C.
IMHO PHP will be good when the developers stop dumping one hacked subroutine after another into the core of the language. When they fix interpolation which is a nightmare (works sometimes and other times doesn't???), when new versions quit breaking existing code and when they build in better support for system wide modules and add ons.
If Perl has nothing else it still has CPAN [cpan.org] nothing PHP has even comes close to the amount of add-ons and extras that are easy to find and just work.
Last I saw Perl has been ported to every major platform except Palm. Contrast to PHP which is on what Linux and Windows? Okay maybe some other Unixes. Perl is on dozens of Unixes, OS/2, Windows, MacOS (Before OSX)
Some correXions for you: PHP runs on about as many Unices as Perl, including Mac OS X. Perl 5 has been included with Mac OS X from its inception.
PHP's braindead way of putting everything_in_the_same_namespace() gets really old.
Actually PHP has a few different namespaces. There's the global namespace, of course. There's the function-local namespace. There's an object-local namespace. The various global arrays, such as $_REQUEST and $_SERVER can be treated as their own namespaces in a manner of speaking.
Perl has references which can point to sub routines, arrays hashes or other contants or scalars.
PHP also has references, as in $myRef =& $myObject; or $myRef =& $myVar;. You can refer to functions by name and call functions through a variable, as in $val = $myFunctionRef();. PHP's unified method of handling arrays, scalars, hashes, and references is pretty nice IMHO, whereas perl's funky way of referring to members of hashes/arrays as scalars versus the hashes/arrays themselves with % @ designators is fairly pointless and the source of many bugs.
When they fix interpolation which is a nightmare
Silly rabbit. Interpolation in PHP is very simple and it just works: print "Interpolate $thevar"; print "Interpolate $thearr[itemhash]"; print "Interpolate {$arr['itemhash']}"; print "Interpolate {$thevar}yukyuk"; print "Interpolate $arr[5]";
First... almost no professional web programmer puts HTML in their code anymore (PHP or Perl), we tend to use OOP based templating systems. Makes it much easier to separate content and code in non trivial web applications.
Yes and being a proffesional developer I do that. For me its a lot easier to do in Perl than it is in PHP. Granted I haven't used PHP as long as I have Perl, so its a matter of personal preference.
Second... OOP makes it tons easier to write, again, non-trivial apps and libraries. snip... Plus, there's the added benefit of you not having to be a slave to CPAN for the tiniest bit of additional functionality.
Most of CPAN is reusable OO code so your statement is a contridiction. Perl includes many modules in its default install and its easy to add them. That doesn't make one a slave, it allows one to build programs that has only the things they need in them. If my program doesn't need a graphic interface or a mysql backend why should it be in my namespace at all??? With PHP there isn't anyway to take that out.
Finally I'm not trying to start a "my language is better war" my post was intended to refute untrue claims by a troll. Statements that Perl has no graphics interface or bad database interfaces just aren't true. The fact that they aren't in the core language doesn't make a difference, they are still availible if needed, and many people including myself feel that is a better way to do things.
If you like PHP that's fine. I like Perl and i"m sticking with it.
Please mod the parent down. I don't want to see this crap. I'm surprised people fell for such obviously wrong statements from someone named "eggtroll". I try to refrain from calling people trolls when there's any doubt, but there's none here.
* Ease of use. After about a day I had an excellent understanding of both PHP and SQL. I was able to get a stable, useable and presentable website up within 24 hours of reading the basics of PHP. Learning Perl
took me weeks and I'm still not even as good with it as I am with PHP. I would definitely not recommend anyone new to programming begin with Perl.
That's a nebulous statement. I think Perl is not a hard language to learn. Furthermore, I don't see anything in this post that leads me to believe eggtroll has ever used either language, so this isn't even good anecdotal evidence.
* The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work (whether or not OO is all that great is another discussion.) Hopefully Perl will be patched up so it supports such must-have OO features like introspection, reflection, self-replication and ontological data-points.
Perl's OO support does need work. But it does support introspection. (Reflection is another term for introspection.)
Real problems with Perl's OO: it does not statically check anything. It does not enforce encapsulation. It feels like a kludge in general to me. From what I've been reading of Perl 6, I think it will be much better. I'm looking forward to it.
Self-replication? Ontological data-points? These are not OO terms.
I do not use PHP, but I would be shocked if its OO support rivalled SmallTalk's. You'd need to provide a lot of evidence for me to accept that.
* Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later.
I regularly use Perl with Oracle. There are many [uwinnipeg.ca] different database drivers.
* Speed. [...] Its [sic] definitely faster than Perl in almost every case, particularly in regex which has long been Perl's
strongest point.
I assert otherwise. Prove it. In fact, I think PHP uses the PCRE - Perl-compatible regex library, intended to be like Perl's but somewhat less complete.
* Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl!
I do regularly, with success.
* Graphics. [...] Perl lacks a graphics library
of any kind.
* Data Structures. [...] Under Perl you're extremely limited in what you can do. This is because Perl isn't OO (so you can't create Node classes, for example, usefull in a linked list) and because it lacks pointers. Some of you may notice that PHP lacks pointers, but look deeper! Behind the scenes, hidden from the user pointers are used.
Perl has references. As in Java, they are essentially safe pointers with automatic memory management (though the GC is less sophisticated). And it does have OO support, at least to the extent required to make a Node class. There is no limit to the data structures possible in Perl.
Actually, using mod_php with Apache is an order of magnitude faster than mod_perl, particularly if you're using the Zend Performance Suite [zend.com] (nee' Zend Cache) -- it's a cached byte compilation system using shared memory for blazing speed.
We used it at my company and was able to reduce the number of servers used for the given load by 75%. Amazing stuff.
sorry but you're the one who looks stupid, it was a troll, dont take it so seriously. the whole purpose of thought out trolls is to bait people like you into getting angry - and well, he did;-)
Uh, I think you missed the point. PHP now has the potential for much broader use a a general shell scripting language, instead of mainly as a server-side web scripting language
While MS continues to innovate visual solutions to problems, the open-source community keeps returning to outdated ways of doing things... The idea that you should have to learn the command line interface to a language will end up coming back to bite PHP it the ass.
Not sure if this is a troll or just a misfire. The optional CLI is an addition to PHP, not something that changes how you use it from web pages. The CLI is a valuable feature. It lets you use PHP as a shell scripting language, rather than being restricted to CGI processing.
Using the CLI, you can write a wrapper that dumps a PHP-created web page to a static HTML file. Now you can use PHP as an authoring tool for statically served web pages. Nifty!
"Using the CLI, you can write a wrapper that dumps a PHP-created web page to a static HTML file. Now you can use PHP as an authoring tool for statically served web pages. Nifty!"
Yeah, that does sound handy. I've been doing it for quite a while using wget and apache+php anyway.
Okay, I'm an idiot -- kind of. I figured it out about thirty seconds after I posted, but the reason why still kind of puzzles me. Basically, it appears you have to build it with either the --disable-dynamic or --disable-static option. It just doesn't want to build both versions at the same time. I can kind of see why this is the case (I mean, that's why I guessed at it) but it does bother me a bit that it's not in the documentation anywhere. It may be OS X - specific, but even so, it's a pretty big problem.
Umm... You don't have to escape a double quote if you use a single quote around the echo. However, if you want to include variables ($foo) then you will have to use the double quotes and yes escape them. I don't see this as a usability flaw, its just the way it has to be for the interpreter to read what your trying to program. Would you rather it try to guess what you are trying to accomplish; Or would you rather make PHP harder to learn by using obscure charicters around echo statements?
Even more fun; you can use the Perl 'heredoc' format, in which you don't need to escape either set of quotes:
echo <<<END_OF_STRING
anything you 'want' here, except the "token" above, including $variable interpolation, even with some nice ${embed}ding methods, even with some more {$complex->expressions()}.
Well, of course 4.3.0 is more "optimized" for Apache 2 than the previous version, but as said before it is still marked as experimental. Just look at the PHP 4.3.0 release notes [php.net].
If you can break into the process (buffer overrun's etc. all the encryption in the world won't do you a bit of good because the key will be accessible to you.
The only real security if you don't trust the administrator is to use the session only as a reference to the real information stored elsewhere. Or if you are storing login and password, split them up and have one in a cookie and the other in the session...
That's great (Score:5, Insightful)
It's a pity though that Apache 2 support is still experimental. I hope the Apache and the PHP team get the work done fast so that Apache 2 can spread faster!
Re:That's great (Score:2, Interesting)
I can't wait to use Apache2 but I need PHP support to be stable before I can upgrade.
later,
ajay
Re:That's great (Score:2)
Last time I tried php with apache (4.2.2 + 2.0.43 IIRC), apache would segfault when it received a SIGHUP after log rotation. It seems libphp4 was not handling the signal correctly.
This may have been solved by now, but I'm not going to use PHP with Apache 2.x until it gets better than this.
Re:That's great (Score:2, Informative)
But does it have the Power (Score:2, Funny)
Best New Feature (Score:5, Interesting)
Re:Best New Feature (Score:3, Interesting)
Yes I'm an elitist. Leave computing to the real guys.
Re:Best New Feature (Score:2)
Re:Best New Feature (Score:2)
PGSQL support problem? (Score:3, Informative)
I really do enjoy having Postgre and MySQL support on the same machine, but for now I guess I'll have to stick with MySQL until I figure this one out.
But above all, CONGRATS on the changes, PHP team, and please keep up with the good work! It's a great software and a great asset to server administrators, programmers and scripters around.
In a related note.... (Score:5, Informative)
XML? (Score:2, Interesting)
Does this release change what's bundled in the base XML support? They mention function call changes but usually those functions are useless without a recompile.
PHP is still mostly a web page language. XML support should be just bread and butter to it. I need it to deal with RSS or RDF. I need it to deal with user input (if I want to do XHTML I don't want a user typing posts that are malformed - right now I have no way of knowing that).
//
Php has strip_tags() which, naturally, strips tags from a string. But as there's little functional difference between tags and attributes it seems strange that I'm unable to strip attributes with as easy a syntax (yes, I have to use regexps again).
//
I hope this doesn't sound too down on PHP. It's a good language. It's just not a great language like Java or .NET (lets face it, OO in PHP isn't great, and that's what most people have been waiting on PHP 4.3 to fix)
Re:XML? (Score:3, Informative)
Re:XML? (Score:2)
php apache windows install
Make sure you have "must contain all words" checked. There you will find some installers which will set it up for you with no problems.
Re:XML? (Score:2)
Re:XML? (Score:2, Informative)
There also is a nice wrapper called XML_parser [php.net] in PEAR. That package is installed by default in PHP 4 I believe.
If you are going to deal with RSS and RDF stuff, then I definately recommend you check out the PEAR XML_RSS package [php.net]
I see nothing lacking with PHPs XML support.
Re:XML? (Score:2)
Expat/SAX in PHP rocks. XSLT is pretty good. The PEAR XML parser isn't bad, either.
However, XML-DOM (DOMXML, whatever) sucks because, well, can you say, "Shifting APIs"? On the one hand, I appreciate the fact that it's getting fairly close to W3 specs now, and that's a Very Good Thing(tm); on the other, the function names and definitions (along with some of the interfaces themselves) have changed in very non-trivial ways with nearly every single bloody point release since 4.0.0 and it's a royal pain in the arse. I'm working on a project right now that would be much better done if we could depend on consistent DOM support.
My pet peeve aside, the new release looks pretty good.
(Before you flame, please consider the possibility that there might be other uses for the Document Object Model besides making stuff fly around in browser windows. Thank you.)
Re:XML? (Score:2)
You can compile SAX or DOMXML function into php or you can load them as modules. Same with mysql and postgres. As a rule PHP can load any set of functions dynamically or it can compile them statically.
Having external libraries is no different then PERL having modules, or VB having dlls, or java loading classes.
All the libraries you need are included in the distribution. Get the source code and do a
Please do yourself a favor and actually install the thing before you start rambling about things you know nothing about.
Re:XML? (Score:2)
I didn't. You're an obnoxious git who argues against cliches of his own invention.
However, I did say "there's no way in the standard PHP build to deal with XML" because in 90% of the installed PHP base out there there is no XML support. As AC said,
The PHP programmers obviously recognise the distinction between being included in the standard build and being an optional extra. You insult me for making the same distinction. Not including it by default means it won't be available on 90% of the installed PHP hosts out there, meaning that those offering (OSS) PHP software for download can't rely on others having those libraries. Notice the distinction?
I'm not saying include everything by default - as I'm sure you'll extrapolate my point to. I am saying that XML support should be default, like GD.
You can't even talk respectfully to strangers. You're a freak.
Re:XML? (Score:2)
Once again go and actually install the thing before you make ignorant comments like this. You have to configure the thing before you make and install it. Have you ever compiled a unix app before? Who the hell cares what is "default" and what is not. You always have to include at least one thing or another or you are going to get a pretty useless php build.
If you are really too stupid and lazy use the debian system. They have separately compiled each and every php option into loadable modules so you can do things like apt-get install php-XML. Or you can use freebsd which gives you the popular options in a menu.
Moron.
Re:XML? (Score:2)
What is default will spread more than what is optional. Recognising this has allowed programmers to rely on features.
By default PHP is "pretty useless". Heh.Nobody is the same, but if 50% of people are compiling in GD support then it should be included to save them the effort. Making defaults suit the most people is a great thing.
When did I ever say that I had not installed it? When did I ever say that the issue was with running the software I want on my system alone?
Again, you seem unable to distinguish between your own cliches and my posts - between your imagination and reality.
And you have the gall to call me a moron. Seek help, buddy.
Re:XML? (Score:2)
PHP programmers, me, and apparently a few others."
Man you keep bitching about this. Let me get this straight now. You are bitching and moaning about the fact that you have to type --with-xml when you build it. Is that right? Here let me quote your original post to let the world know exactly how stupid you are.
" One of the problems I'm having is that there's no way in the standard PHP build to deal with XML. I either have to treat it as a string and write regular expressions (which, as anyone who knows the regexp xml problem, isn't reliable) or build my own with some external xml library, meaning that as I want to allow others to use my code I have to get each user to recompile too (which is like asking people to recompile their kernel, some will do it, some won't, and there's _usually_ no good reason why it had to happen in the first place)."
So because you are too dumb to know to type --with-xml and because you are too lazy to actually read the manual and because you are too blind, high and retarded to follow the instructions when you type
Yes that's exactly what you said!. Hey people look at me I am too stupid to type --with-xml so I bitch and moan about parsing XML with regular expressions.
MORON.
Re:XML? (Score:2)
Maybe if I repost what I've already said again and again you'll read it. Then again, maybe you're insane...
If I offer PHP software for download then in practice more people will use it and be able to use it (ie. generic php hosts) if I use default features. With your take on it I shouldn't consider what's default and what's not. Your ignorance in saying "Who the hell cares what is 'default' and what is not" states that defaults don't matter. When Redhat includes GLIBC by default, years ago, programmers could finally use it. It's not a problem downloading and configuring software on my box, it's the social situation of releasing software. Your beliefs go against PHP's programmers who decide what should be included by default.
You continue your rude, arrogant, and angry posturing. There won't be any posts responding to you, freak.
Re:XML? (Score:2)
Oh come on now that's a ridiculus argument to make. If you are delivering your application to somebody make the xml module a
Re:XML? (Score:2)
Re:XML? (Score:2)
If your php host does not have the XML module installed then find somebody else. What if you wanted the CURL extension or the ming extensions and your provider did not install them? Should those be in the default too? How about the ovrimos database functions let's roll them up as default too who knows somebody might want to write an application using them. Yes roll up everything anybody might want to use and deliver a bloated slow php to everybody.
Oh and by the way you do not have to recompile php to load modules. You can load them dynamically. If your host is not willing to put in the function you want either by compiling or loading dynamically then by all means drop them like a rock and find a host that is more responsive to your needs. Why would you want to host your website with somebody who was "incompetent, impatient, and lazy" anyway?
Re:XML? (Score:2)
Well, _Donut_Troll was wrong about both PG and needing to recompile, but he's right in that there are all kinds of situations where a developer might not have control over the server itself. That could be determined by an employer or client -- or the hosting might be locked in by a long-term contract. The poor schlob's supposed to drop his job or the equivalent just to satisfy your worldview? Geeez.
(Another scenario: The developer's obligated to work on IIS, which IIRC doesn't support dl() in ISAPI mode.)
Why do you persist in being such a hard case, anyway? If you don't use MySQL or GD or whatever, that's fine, it's not like somebody's forcing you to, so if it's helpful to (some) other PHP developers, how does this hurt you? Do you also oppose the inclusion of PEAR by default, which most would probably agree is a good thing?
Re:XML? (Score:2)
"but he's right in that there are all kinds of situations where a developer might not have control over the server itself. That could be determined by an employer or client -- or the hosting might be locked in by a long-term contract. The poor schlob's supposed to drop his job or the equivalent just to satisfy your worldview? Geeez."
There are some people with no control over their programming environment. Boo Hoo. I don't want my php bloated to satisfy the needs of the minority.
Re:XML? (Score:2)
Then compile it without the stuff that you don't need. There -- problem solved.
Re:XML? (Score:2)
Re:XML? (Score:2)
That's really interesting, coming as it does from a member of a minority (alleged *nix user).
I'm starting to understand your sig now -- you aparently believe, just as Bill Gates seems to, that you need to make sure that the next generation doesn't get the breaks you did. And unless you can claim that you wrote all your own software and figured out how to do so with no outside assistance whatsoever, you got them.
Too bad I don't have a "Hypocritical Elitist" list I can add you to.
Re:XML? (Score:2)
I am a minority in many many ways and Yes that means that frequently I get to fuck off and deal with it. That's the way life works ya moron. Why don't you get out once in a while and experience it for yourself.
What the hell does the next generatio have to do with compiling your php?
Re:XML? (Score:2)
Only because hardasses such as yourself keep propagating it.
> What the hell does the next generatio have to do with compiling your php?
It means that you'd rather deprive those who don't run their own servers (yet) of the opportunity to make use of increased funcitonality just so you don't have to type --disable-[feature].
In short, you're a self-centered social Darwinist, and I'm not.
Re:XML? (Score:2)
Re:XML? (Score:2)
I don't think I'll bother checking this thread for any more replies.
Re:XML? (Score:2)
No, that's what people have been waiting on PHP 5 with Zend 2.0 to fix. Big difference.
However, your comments about XML and string handling have nothing to do with PHP's OO capabilities. I would argue that PHP's string handling and regex are better than the standard ones you find in Java or
XML support? Well, yes PHP isn't a native XML-handling language, nor is Java (.NET might be another story).
With any standard programming language, though, XML support is not "native". You have to include the appropriate modules or classes. Ditto with Java.
Re: (Score:2)
There is XML module available (Score:2)
Phillip.
silly (probably) question (Score:2)
Re:silly (probably) question (Score:2)
To make it more compatible cross-platform, get a unified libgd version to use, and add functions not normally found and fix bugs, PHP has added GD as a bundled extension. This is a good thing.
Student suspended over suspected use of PHP (Score:5, Funny)
consider running an opcode cache (Score:4, Informative)
This is different from HTML output caching.
Opcode caching is said to increase performance by 30-200% depending on the cache code you use and your app.
With about 30% of apache installs running PHP, and with more than 50% of the web running apache, I'm surprise the PHP does not include an opcode cache with the install.
That's a lot of wasted cpu cycles :) Just compiling PHP scripts on every page hit.
There are open source caches out there, see the link in my sig.
Re:consider running an opcode cache (Score:4, Interesting)
Simply asked, simply answered: there is no "official" PHP opcode caching because PHP relies on the Zend engine and the PHP developers work very closely with the people at Zend, who sell the Zend Performance Suite [zend.com] (formerly Zend Accelerator), and the guys at PHP are not about to cut into Zend's livelihood by bundling a product with PHP which makes the Zend product redundant.
Re:consider running an opcode cache (Score:3, Interesting)
That's the main answer I'm hearing. But zend is very expensive.
Maybe there's a compromise. How about a modest PHP opcode cache that has only some of zend's features; ie. a little bit slower and more conservative than zends.
I appreciate the work the zend guys have done, trust me I do. But that's an important feature to leave out.
Re:consider running an opcode cache (Score:3, Interesting)
Ok, lets see, in the same thread there is a post about PHP not having an XML parser of any kind (the author mentions having to use regexp, insane as that sounds), I am assuming that means there is no HTML parser (or an equivalent of HTML::TreeBuilder at that) either.
Call this "informative-flame" bait, but I am trying to figure out why people get upset when PHP isn't refered to as the greatest thing of all time. I personally haven't used it for a couple of years, so I don't know about many of these features.
What does PHP use in terms of a browser agent (a la LWP)? Is there really no support simple filebased db persistence? (by which I mean something along the lines of tieing a hash to BerkleyDB). How well does it hook into the other stages of the Apache request handling pipeline?
Oh and something I'm curious about (too lazy to look it up, I guess) what sort of exception handling does PHP have (ie it's equivalent of 'try {} catch {} finally {}')?
What sort of logging modules are available? (log4PHP?) I'd also be curious to know about how PHP's templating systems measure up, from someone who's had experience with this sort of thing...
Anyway, this is a troll, but I am curious about the answers to those.
Re:consider running an opcode cache (Score:3, Informative)
PHP has both SAX and DOM based XML parsers. It also has an xmltree function to instantly build you an object hierarchy from an XML document. There is also the most excellent phpxpath object available here [sourceforge.net]
"What does PHP use in terms of a browser agent (a la LWP)?"
It supports fetching from URLs the same way as opening and fetching from files. The new version also has streams. Also it has hooks into CURL for more sophisticated stuff. There is also the excellent snoopy [sourceforge.net] object.
"Is there really no support simple filebased db persistence? (by which I mean something along the lines of tieing a hash to BerkleyDB)"
There are hooks into berkley db if you want to sink to that level. If you want to sink even lower then any php variable, array or object can be turned into a string and saved to files or sent to other URLs or what have you.
"How well does it hook into the other stages of the Apache request handling pipeline?"
You don't have that much control over the pipeline but you can hook into auth and such. I never needed anything it did not provide.
"Oh and something I'm curious about (too lazy to look it up, I guess) what sort of exception handling does PHP have (ie it's equivalent of 'try {} catch {} finally {}')?"
PEAR has a pretty good error handling library. Otherwise you basically just test for errors manually. You call a function with @function which surpresses error messages but sets global error indicators which you can test for. Not great but gets the job done. Version five will have try catch. All in all error handling in php is better then perl and worse then java.
"What sort of logging modules are available? (log4PHP?)"
PEAR has a logging class. I know that there are others out there as well. PHP also hooks into syslog if you want that.
" I'd also be curious to know about how PHP's templating systems measure up, from someone who's had experience with this sort of thing..."
smarty [php.net] is an outstanding templating engine with caching. I don't see how you could possibly do better. There are numerous others.
I hope this prevents you from further trolling. Now that you are armed with actual knowledge (which you could have gotten by simple searching) you no longer need to troll here.
Re:consider running an opcode cache (Score:2)
All in all error handling in php is better then perl and worse then java.
This I find hard to believe, the only advantage java has over perl in this regard is checked exceptions (and certainly enough arguing has taken place over whether or not this is actually a good thing). So PHP adds a feature over and above perl's Error.pm which insn't quite as good as checked exceptions but enought to make it better?
Anyway, thanks for the answers, this was a very useful troll.
Re:consider running an opcode cache (Score:2)
It's not just that. There is a lot to php error handling. You just have to learn about it and use it to your advantage. I personally think try catch is not that great and in some ways would prefer the existing php error system. A stack trace would be cool thought.
Re:consider running an opcode cache (Score:2)
>None. They've had a long time to do something.
Umm... http://php.net/curl [php.net] (this is only one of several methods you can use)
>There's no treebuilder or concept of nodes or anything like that in PHP. They're still thinking in flat structures.
http://php.net/dom-xml [php.net] (admittedly experimental, but it's been around for almost 3 years)
>> Is there really no support simple filebased db persistence? (by which I mean something along the lines of tieing a hash to BerkleyDB)
>It doesn't.
BerkelyDB? Who uses that thing anymore?
>>Oh and something I'm curious about (too lazy to look it up, I guess) what sort of exception handling does PHP have (ie it's equivalent of 'try {} catch {} finally {}')? What sort of logging modules are available?
>Well it has that. It doesn't have
PHP5 will have try/catch/finally. Yes, these days it still blows.
>>I'd also be curious to know about how PHP's templating systems measure up, from someone who's had experience with this sort of thing...
>Well templating is quite well done. There's FastTemplate and Pear's one. It's difficult to do XHTML templates without XML support. I guess it's not easy.
There are quite a few good templating engines with PHP, including two which are PHP modules (compiled C code), providing good performance.
Re:consider running an opcode cache (Score:2)
That wasn't me saying that. I was responding to the original poster. You are correct; XHTML is completely a client-side thing, so it has nothing to do with PHP support.
By the way, there is a cool PHP class that dynamically generates well-formed, indented XHTML: phpHTMLlib [sourceforge.net].
Most needed feature for newbies...... (Score:2, Insightful)
I think OSS projects working on languages and libraries should commit to including comments like this to help newbies (especially if the language is dynamically typed)
function name:
input parameters:
return type:
purpose:
parameter 1: (purpose)
parameter 2: (purpose)
*/
Re:Most needed feature for newbies...... (Score:5, Informative)
The PHP docs are brilliant.
You just type in the function name, and there are enough examples to get you running until you actually start understanding the language.
I learnt PHP purely from www.uk.php.net, and I have always found the Java and Perl docs to have too much stuff in them.
The PHP docs are like this:
mysql_connect ([hostname],[username],[password]) Returns true if successful.
What more do you need to know? What goes into a function, what comes out.
I'm genuinely not trolling here, I'm just surprised that anyone could moan about the PHP docs.
Re:Most needed feature for newbies...... (Score:2, Informative)
Re:Most needed feature for newbies...... (Score:2)
Tip: To get the most out of the documentation, you really need to use the online version. You can query it quite easily from your browser simply by typing php.net/ThingYouWantToKnowAbout into your location window. It'll pull up a function name, list of function names that closely match your search term, or a list of pages containing the search term. Try something like php.net/integers (returns a list of 52 documents, most of which relate to integers in one way or another) or php.net/file (returns the manual page for the file() function) and you'll see what I mean. Also check the user-contributed notes. I've found a lot of good tips and hacks in those.
Re:Most needed feature for newbies...... (Score:2)
Original Post: I read the Java and PHP docs, and java is better documented.
You: No, Javadoc sucks, go read the PHP docs. And java sucks too!
Correct me if I'm wrong, but PHP doesn't seem to have a "self documenting" framework, a la Javadoc or even Perl's POD?
Re:Most needed feature for newbies...... (Score:2)
I never, ever wanted anything more than the existing web docs, but I came from a solid c/c++ background, and I already had been using html for 3 years.
Maybe it would help if there was a web primer to bring people up to speed where the function listing help would be of more using and make much more sense.
Now If ENSIM would Get Off Their asses... (Score:2, Interesting)
*now watch the flames from under me* hehe
Re:Now If ENSIM would Get Off Their asses... (Score:2)
http://forum.rackshack.net/showthread.php?s=&th
already done! (ofcourse, not by ensim, but this dude puts out lots of quality fixes/updates as simple as rpm -Uvh file.rpm)
Why use the bundled GD libraries? (Score:2)
GD library is now bundled with the distribution and it is recommended to always use the bundled version
Why recommend the use of their bundled library? Why is this any different from their MySQL support (IE, a "mini" bundled MySQL library is included, but can (and should be) overridden by the normal MySQL libraries if they exist on the system). I can understand that many machines don't have GD libraries, but why "recommend" that their own code be used as opposed to the system libraries if available?
Don't rush to install it on production servers (Score:2, Insightful)
Also, I noticed that if you have older PHP3 classes lying around which mistakenly redeclare a function, the entire script which uses the class will now fail under 4.3.0, where it would not trigger an error under previous versions. This is not a bug, but beware of it since it could break older applications.
The thing that bugs me about PHP (Score:2)
I'm surprised more people haven't mentioned this.
Anyone else having problems installing? (Score:2)
checking for cURL 7.9.8 or greater... configure: error: cURL version 7.9.8 or later is required to compile php with cURL support
yet
[root@server php4]# curl -V
curl 7.10.2 (i686-pc-linux-gnu) libcurl/7.10.2 OpenSSL/0.9.6b zlib/1.1.3
Anyone else having the same problem?
Re:Anyone else having problems installing? (Score:2)
(Ignore this if you already have it or use sources/gentoo/slackware/etc).
Where are the OO improvements? (Score:2)
- Scott
Re:Nice (Score:2)
Re:lame (Score:2)
Re:Why I prefer PHP to Perl (Score:2, Offtopic)
Re:Why I prefer PHP to Perl (Score:2, Informative)
Re:Why I prefer PHP to Perl (Score:2, Informative)
How is this? PHP's OO is weak and kludged together ( but will be much better come Zend 2/ PHP 5 ).
I'm not sure if either (a) Smalltalk is horrible ( which from my understanding isn't ) or (b) the parent should be modded +1 Funny. Seriously, putting PHP in the same OO ranks as Smalltalk is like putting a Ford Escort in the same offroad handling ranks as a F-150 truck.
On a side note, is it just me or is /. really slow right now?
Re:Why I prefer PHP to Perl (Score:2)
And being home on a modem makes the best site around seem slow. Agh, I miss DSL.
Re:Why I prefer PHP to Perl (Score:2)
> I'd say it's closer to C++, which uses a Simula 67-style OO.
Java, like C++, Java and PHP use class-based inheritance.
JavaScript (aka ECMAScript), on the other hand, uses prototype-based inheritance, which is more like that of Smalltalk. Perhaps this is what the first poster was thinking of...?
Re:Why I prefer PHP to Perl (Score:2)
--
Evan "it's a joke"
Re:Why I prefer PHP to Perl (Score:5, Funny)
While I wouldn't use its to code the new Doom (VB would be a better choice)
*ROTFL*
Ahh, an excellent post. I'll give you a solid B+.
But, if I may give you some advice. The VB comment gives you away. You must make your trolls highly subtle, even more so than they are now. They must balance lightly on a fine edge between Trolldom and NonTrolldom. People in a hurry should be able to scan your message and be 100% convinced you are an idiot, and have no idea you are really in control. Then they will post, and when the troll is discovered, THEY will look like idiots, and you will be revealed as a genius because of your gentle entrapment. This is the true genius of a troll. To ensnare and to incite the unwary.
One metric I use in my own efforts is the dynamic of up/down moderations. A "perfect troll" should look like this:
I wish you luck in your further efforts.
Re:Why I prefer PHP to Perl (Score:2)
hypocrite (Score:2)
Anyone reading this site would be better off outdoors.
Re:SHUT THE FUCK UP, MORON (Score:2)
Re:Why I prefer PHP to Perl (Score:2)
Of course you forgot to mention PHP's new command line mode which makes it more versatile than perl. The vast resources available from CPHPAN, and more specific projects, such as BioPHP. And PHP's tighter integration with client side DHTML technologies such as JavaScript, CSS, DOM and XML which allow you to do DHTML natively in PHP.
Re:Why I prefer PHP to Perl (Score:2)
* Ease of use.
I started with Perl, I was writting web pages in a day with it. Maybe it depends on the teacher.
* The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work
I use PHP, I have yet to see a reason to do much OO in what is primarily a web scripting language to embed in an HTML page. What I have seen seems incomplete and difficult to use. Contrast to Perl which while it may not be as feature complete as say Java or Smalltalk it is certainly easy to use and I think it has the right principles behind it. Especially after Perl 5.6. As far is PHP being as good as Smalltalk at OO, I have my doubts but I can't say for sure as I don't program in Smalltalk.
* Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later. I've heard that this will be fixed in upcoming versions of Perl though.
This is simply untrue, Perl supports tons of databases through the DBI (which is also fairly simple to write new drivers for if you need them) and even if there isn't a native DBI driver, DBI supports ODBC and you can use any database that has it. That's certainly far more than just MySql and Postgres. I think your description of databases in Perl fits better for databases under PHP especially before PHP 4.
* Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl requires
that much rewriting.
FUD. It depends on what you do. Last I saw Perl has been ported to every major platform except Palm. Contrast to PHP which is on what Linux and Windows? Okay maybe some other Unixes. Perl is on dozens of Unixes, OS/2, Windows, MacOS (Before OSX), and I even had a friend using it on VMS and I also think there's even a DOS version. Some networking features used to have issues on windows but that's been fixed now with emulation
* Speed. PHP is one of the fastest languages I've ever used. While it won't be replacing assembly or C, its definitely faster than Perl in almost every case, particularly in regex which has long been Perl's
strongest point. I'm sure there are cases where Perl is equal to PHP, but I can't think of any at the moment.
If your using if for administration scripts and text processing I don't know if Perl is faster or not, but for that sort of thing I doubt there is enough difference to care and i can't imagine how annoying it would be to try writting that sort of thing in PHP. (That's just personal preference though)
* Graphics. PHP comes with a nice little graphics library. While I wouldn't use its to code the new Doom (VB would be a better choice) its adequate for most web pages, and should be considered as a substitute for Flash for certain things. Perl lacks a graphics library
of any kind.
More FUD: How about OpenGL [cpan.org] or maybe the GD library [cpan.org] (which is what PHP uses). Oh yeah there's even a Gimp Perl interface [cpan.org]. Not to mention SDL tie in and several others. In fact if you go to CPAN Search [cpan.org] frontpage there is a link that says "Graphics" which lists several common ones.
The fact that these are not in the core language is a good thing. PHP's braindead way of putting everything_in_the_same_namespace() gets really old.
* Data Structures. Perl has references which can point to sub routines, arrays hashes or other contants or scalars. You can also muck around with the underlying GLOBS and there are a bunch of B::* modules for mucking around with internals as well. I certain that you can probably accomplish the same things using those tools. However even if you can't when do you need that sort of thing in a website? I think that if I need a data structure that complex I'll write it in C.
IMHO PHP will be good when the developers stop dumping one hacked subroutine after another into the core of the language. When they fix interpolation which is a nightmare (works sometimes and other times doesn't???), when new versions quit breaking existing code and when they build in better support for system wide modules and add ons.
If Perl has nothing else it still has CPAN [cpan.org] nothing PHP has even comes close to the amount of add-ons and extras that are easy to find and just work.
Re:Why I prefer PHP to Perl (Score:2)
Last I saw Perl has been ported to every major platform except Palm. Contrast to PHP which is on what Linux and Windows? Okay maybe some other Unixes. Perl is on dozens of Unixes, OS/2, Windows, MacOS (Before OSX)
Some correXions for you: PHP runs on about as many Unices as Perl, including Mac OS X. Perl 5 has been included with Mac OS X from its inception.
Some more corrections 4 U (Score:2)
PHP's braindead way of putting everything_in_the_same_namespace() gets really old.
Actually PHP has a few different namespaces. There's the global namespace, of course. There's the function-local namespace. There's an object-local namespace. The various global arrays, such as $_REQUEST and $_SERVER can be treated as their own namespaces in a manner of speaking.
Perl has references which can point to sub routines, arrays hashes or other contants or scalars.
PHP also has references, as in $myRef =& $myObject; or $myRef =& $myVar;. You can refer to functions by name and call functions through a variable, as in $val = $myFunctionRef();. PHP's unified method of handling arrays, scalars, hashes, and references is pretty nice IMHO, whereas perl's funky way of referring to members of hashes/arrays as scalars versus the hashes/arrays themselves with % @ designators is fairly pointless and the source of many bugs.
When they fix interpolation which is a nightmare
Silly rabbit. Interpolation in PHP is very simple and it just works:
print "Interpolate $thevar";
print "Interpolate $thearr[itemhash]";
print "Interpolate {$arr['itemhash']}";
print "Interpolate {$thevar}yukyuk";
print "Interpolate $arr[5]";
Re:Why I prefer PHP to Perl (Score:2)
Yes and being a proffesional developer I do that. For me its a lot easier to do in Perl than it is in PHP. Granted I haven't used PHP as long as I have Perl, so its a matter of personal preference.
Second... OOP makes it tons easier to write, again, non-trivial apps and libraries. snip
Plus, there's the added benefit of you not having to be a slave to CPAN for the tiniest bit of additional functionality.
Most of CPAN is reusable OO code so your statement is a contridiction. Perl includes many modules in its default install and its easy to add them. That doesn't make one a slave, it allows one to build programs that has only the things they need in them. If my program doesn't need a graphic interface or a mysql backend why should it be in my namespace at all??? With PHP there isn't anyway to take that out.
Finally I'm not trying to start a "my language is better war" my post was intended to refute untrue claims by a troll. Statements that Perl has no graphics interface or bad database interfaces just aren't true. The fact that they aren't in the core language doesn't make a difference, they are still availible if needed, and many people including myself feel that is a better way to do things.
If you like PHP that's fine. I like Perl and i"m sticking with it.
Re:Why I prefer PHP to Perl (Score:2)
* Ease of use. After about a day I had an excellent understanding of both PHP and SQL. I was able to get a stable, useable and presentable website up within 24 hours of reading the basics of PHP. Learning Perl took me weeks and I'm still not even as good with it as I am with PHP. I would definitely not recommend anyone new to programming begin with Perl.
That's a nebulous statement. I think Perl is not a hard language to learn. Furthermore, I don't see anything in this post that leads me to believe eggtroll has ever used either language, so this isn't even good anecdotal evidence.
* The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work (whether or not OO is all that great is another discussion.) Hopefully Perl will be patched up so it supports such must-have OO features like introspection, reflection, self-replication and ontological data-points.
Perl's OO support does need work. But it does support introspection. (Reflection is another term for introspection.)
Real problems with Perl's OO: it does not statically check anything. It does not enforce encapsulation. It feels like a kludge in general to me. From what I've been reading of Perl 6, I think it will be much better. I'm looking forward to it.
Self-replication? Ontological data-points? These are not OO terms.
I do not use PHP, but I would be shocked if its OO support rivalled SmallTalk's. You'd need to provide a lot of evidence for me to accept that.
* Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later.
I regularly use Perl with Oracle. There are many [uwinnipeg.ca] different database drivers.
* Speed. [...] Its [sic] definitely faster than Perl in almost every case, particularly in regex which has long been Perl's strongest point.
I assert otherwise. Prove it. In fact, I think PHP uses the PCRE - Perl-compatible regex library, intended to be like Perl's but somewhat less complete.
* Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl!
I do regularly, with success.
* Graphics. [...] Perl lacks a graphics library of any kind.
Wrong. It has image libraries [uwinnipeg.ca] and windowing libraries [uwinnipeg.ca].
* Data Structures. [...] Under Perl you're extremely limited in what you can do. This is because Perl isn't OO (so you can't create Node classes, for example, usefull in a linked list) and because it lacks pointers. Some of you may notice that PHP lacks pointers, but look deeper! Behind the scenes, hidden from the user pointers are used.
Perl has references. As in Java, they are essentially safe pointers with automatic memory management (though the GC is less sophisticated). And it does have OO support, at least to the extent required to make a Node class. There is no limit to the data structures possible in Perl.
Perl has its flaws, but these are not they.
Re:Why I prefer PHP to Perl (Score:2)
We used it at my company and was able to reduce the number of servers used for the given load by 75%. Amazing stuff.
Re:Why I prefer PHP to Perl (Score:2)
Re:Command Line Interface? (Score:2)
uh (Score:2)
I'm totally unclear regarding your "point and click interface" dilemma. Are you talking about visual php editors [zend.com]?
Anyway, I agree that someone like you is probably better off with a "full-feature" language like ASP. Dig that full, elegant interface!
Re:Command Line Interface? (Score:3, Informative)
While MS continues to innovate visual solutions to problems, the open-source community keeps returning to outdated ways of doing things... The idea that you should have to learn the command line interface to a language will end up coming back to bite PHP it the ass.
Not sure if this is a troll or just a misfire. The optional CLI is an addition to PHP, not something that changes how you use it from web pages. The CLI is a valuable feature. It lets you use PHP as a shell scripting language, rather than being restricted to CGI processing.
Using the CLI, you can write a wrapper that dumps a PHP-created web page to a static HTML file. Now you can use PHP as an authoring tool for statically served web pages. Nifty!
Re:Command Line Interface? (Score:2)
Yeah, that does sound handy. I've been doing it for quite a while using wget and apache+php anyway.
Re:Dynamic extensions for MacOSX (Score:2)
make: *** [libs/libphp4.bundle] Error 1
at the end of the make process.
Re:Dynamic extensions for MacOSX (Score:2)
Re:built for the web? (Score:2)
Re: (Score:2, Informative)
Re:built for the web? (Score:2)
echo <<<END_OF_STRING
anything you 'want' here, except the "token" above,
including $variable interpolation, even with some
nice ${embed}ding methods, even with some more
{$complex->expressions()}.
END_OF_STRING;
(http://www.php.net/manual/en/language.types.s tring.php#language.types.string.syntax.heredoc)
Re:built for the web? (Score:2)
so long as we're talking about being built for the web, shouldn't it be more like this?
echo "PHP is "built for the web".";
Re:built for the web? (Score:2)
Re:built for the web? (Score:2)
For example:
echo "this is an "example" quote";
echo 'this is an "example" quote';
echo "this is an \"example\" quote";
echo 'this is an 'example' quote';
echo "this is an 'example' quote";
echo 'this is an \'example\' quote';
It's actually better than ASP IMHO. ASP requires you escape all double quotes, since that is all you can encapsulate strings in to begin with.
Re:built for the web? (Score:2)
See here, Doc [php.net].
Re:I'm waiting for php.NET (Score:2)
Great, isn't it?
Re:never mind (Score:2)
Re:PHP is INSECURE! (Score:2)
The only real security if you don't trust the administrator is to use the session only as a reference to the real information stored elsewhere. Or if you are storing login and password, split them up and have one in a cookie and the other in the session...