PHP 5 RC 1 released 388
An anonymous reader writes "PHP just released the first release candidate of PHP 5 after 4 beta releases. It is considered stable and feature-complete -- so get testing!"
Talent does what it can. Genius does what it must. You do what you get paid to do.
Power Power Power (Score:2, Interesting)
As Perl seems to fade more into irrelevence, languages that hold onto a strong central theme like PHP, Python, Ruby, and Dylan are coming to the fore to take its place. Whenever I see a story about PHP, I think more about the death throes of Perl than about PHP i
Re:Power Power Power (Score:5, Insightful)
Try something complicated. You'll change your tune right quick.
Re:Power Power Power (Score:2, Insightful)
Re:Power Power Power (Score:5, Informative)
Yep. And if you inline presentation and data in a complicated web app, that's bad design.
The "good design" police... have fun with it! (Score:4, Interesting)
(I see plenty of Windows users adding PHP to systems that already support ASP)
In any case, all the talk of "good" design ignores all the new and not hardcore coders who can play with something like PHP (as well as ASP) but not so much Perl.
(note aslo that Apple includes PHP on their OSX boxes)
My point is that, in my opinion, one of the things so nice with PHP is that it's just fun to play with. If some coders want to "inline" their code, let them, and let them have some fun, eh.
It's like the pre-Web days when "designers" got into scripting with HyperCard and Lingo.
Everybody's welcome.
Re:Power Power Power (Score:4, Insightful)
Keeping data and presentation separate is still the best thing to do. But that's why we have CSS. So unless you're still using tables, font tags or whatnot, you're not integrating data and presentation.
XML/XSLT for humans? (Score:4, Insightful)
Firstly, it required that PHP be recompiled with the Sablotron module, which would have made the software inaccessible to most of its current user base.
Secondly, writing the XSL stylesheets was complicated as hell. The learning curve associated with them would have made the software inaccessible to ~96% of its current user base, probably including me. (it now uses its own templating system which allows designers to create the templates.)
Has any of this changed? For example, are there any WYSIWYG editors which make it easier to write stylesheets? Will PHP 5 have XSLT capabilities built-in?
Or am I missing something? Is XSLT really not as hard to get started with as I think? (If I'm just a dumbass, I'm sure someone on
Re:XML/XSLT for humans? (Score:3, Informative)
Yeah, that blows. But XSLT is probably the most powerful and quickest templating systems available.
We use XSLT to serve up all of our stories. We wrote an apache module which is passed two IDs, one ID is the story, the other is the xslt. The module fetches the xml from a database, and loads the xslt from disk. Applies the two, and returns the output.
Re:Power Power Power (Score:2)
When I am forced to use php, I am relying on templating tools all the time (no different then when I am using perl or any other language in the end..)
Re:Power Power Power (Score:2, Insightful)
PHP can be written as OO or Speghetti; inline with presentation or seperate... the choice is yours...
(if you know what you are doing... PHP can be incredibly flexible)
Re:Power Power Power (Score:5, Informative)
There [php.net] are [php.net] several [php.net] templating [php.net]
engines [php.net] available [php.net] that effectively separate the application
layer and the presentation layer for PHP applications.
These engines are quite heavily used also (check the source code of most large
open source projects and commercial applications...)
Re:Power Power Power (Score:2)
Now which one[s] do you recommend, and why?
Re:Power Power Power (Score:5, Interesting)
If you are looking for a full-fledged templating that has all the bells and whissles, I would recommend Smarty because it has a massive amount of feature and seems to be quite endorsed by official PHP developers.
If you are looking for something a little simpler to bring more speed and less overhead to your presentation layer, I do like the approach of the Sigma templating engine (in the links posted above) as it brings only what you really need and does it very quickly.
Re:Power Power Power (Score:3, Insightful)
None, other that everybody who needs to use your system has to learn another language.
For a php-product of ours, we have chosen to simply use php as the template language. The codebase itself is OO and seperate from the html, but somewhere you just have
Re:Power Power Power (Score:3, Interesting)
Re:Power Power Power (Score:4, Insightful)
That's possibly the most ridiculous thing I've ever read here (above -1 anyway). Why on Earth would you want to keep hammering the database for HTML markup, let alone CSS text?!! You'll find there's this thing known as a "filesystem" that does a better job at returning such content, much more quickly and more efficiently.
If you really are using the method you suggest above, then I can only imagine you don't have a very busy site...
Re:Power Power Power (Score:3, Interesting)
Or are we going to add another few thousand functions into the core language. Again.
Damn, you're clueless (Score:5, Interesting)
- PHP supports this kind of separation. google for template libraries.
Re:Power Power Power [where's my perl!?!] (Score:5, Insightful)
Having been a big PHP fan, let me assure you that PHP has a strong central theme like a kleptomaniac with ADD has a strong attention span.
Having been a big PHP fan, every story about PHP releases reminds me of the page long list of vulnerabilities and issues under it's entry in netbsd's package listing.
Having since moved to perl, I'm wondering if those death throes you're talking about are the same ones that haven't arrived on my BSD machine yet...
Re:Power Power Power (Score:3, Informative)
That tenet is still true. If this were not true there wouldn't be some 112 projects on sourceforge [freshmeat.net] with "PHP" and "template".
I personally use PHPLib [slashdot.org] templates, something I've discussed quite publicly [devshed.com].
Mixing logic and presentation is a no-no for effective softw
Re:Power Power Power (Score:2)
Well... (Score:3, Informative)
Any language that has a 4000 page Help document that is extremely easy to use and find information, is an excellent programming language.
Re:Power Power Power (Score:5, Insightful)
Re:Power Power Power (Score:3, Insightful)
Different horses for different courses. The great thing about ever popular use of computing languages the sheer diversity and the speciality of niches.
Don't try to compare a high level rendering and application logic language like PHP against the toolbox data manipulating kitchen sick included lanaguage of perl.
Re:Power Power Power (Score:2)
in perl it would be "kitchen sink required". if you want to include or include_once your kitchen sink, stick with perl. as a java fan i, of course, prefer my kitchen sink to be imported.
no domestic sinks for me!
Re:Power Power Power (Score:5, Informative)
Somewhere down the line you are going to have a person working on design that doesn't understand PHP and breaks something. Then you can either spend who knows how long to figure out what is broken or throw out their work and just roll back to what's under revision control (you use revision control, right?). Either way you wasted time. Or worst case, nobody notices the logic is broken and it makes it to production.
Go find a template engine that you like and use it. You'll be happy in the long run.
Here's a couple to get you started.
PHPLib [sourceforge.net]
Smarty [php.net]
Re:Power Power Power (Score:2)
Then I started looking at what it can do for me. Granted I don't want some template thingy generating HTML for me, but things like date selects, selects in general.
My favorite has to be the date selects...
Will generate Month Day Year drop downs that start in 2000 an
Re:Power Power Power (Score:3, Insightful)
A lot of people using PHP, ASP, JSP, ColdFusion are doing their best to separate data collection and manipulation with the actual presentation of the data.
My particular favourite methodology fusebox [fusebox.org] tries to help programmers separate the model and the view. It is unbelievable how simpler web applications are to write when you do separate data and presentation.
I may be feeding th
Re:Power Power Power (Score:2)
Now I just finished writing a CGI/Perl app that talks to an Opto22 device using a firewire module. Does PHP have a firewire module?
Re:Power Power Power (Score:2)
Re:That IS kind of funny (Score:2, Interesting)
Funny enough though,
Re:Power Power Power (Score:3, Insightful)
Oh Really?
Perl is a general purpose progamming language not a simpleton web language such as PHP.
Evidently, you've had no trouble making a comparison... do you need a special badge or licence to make such comparisons?
Safety? (Score:3, Interesting)
I guess because people like me prefer to complain and use other languages instead of fixing unsafe ones...
Re:Safety? (Score:2)
My Commodore 64 with its BASIC interperter way baci in 1982 knew what I meant. My current computer is about a gabizillion times faster, and has more memory then all 64s ever built put together. So dont try to talk to me about efficency.
Re:Safety? (Score:3, Insightful)
Re:Safety? (Score:2, Informative)
Since I only really use my own classes, I'm not overly concerned about hiding internal class members/methods, but I'm really looking forward to exceptions (nothing like doing a big block of queries, ALL of which have the same error checking code).
As for type checking, yes, my partner and I (him a Perl hacker and me a
Re:Safety? (Score:5, Informative)
I've been using PHP extensively for years now and I can't say I've ever run into a problem with its handling of data types. Let's not forget that PHP is, after all, a scripting language.
Re:Safety? (Score:3, Insightful)
Agreed. Why does everybody want to turn PHP into Java? If you want to use Java, then use Java. Diversity is good.
Re:Safety? (Score:3, Informative)
Bruce Eckel explains this quite well:
http://mindview.net/WebLog/log-0051
Re:Safety? (Score:3, Interesting)
...which is handled smoothly with a decent abstraction layer...
Anything else?
Don't take it to school! (Score:3, Funny)
Student Suspended Over Suspected Use of PHP [bbspot.com]
Re:Don't take it to school! (Score:2)
See kiddies, what computers will do to you?
This is your brain, 7h1s 15 y0uR 8r41n 0n 1337. Any questions?
Much improved. (Score:3, Interesting)
Didn't have to jump through any hoops that weren't explicitly mentioned to get it installed, and haven't noticed any problems so far. Hopefully this is a sign that the official PHP5 is soon to arrive.
Did you test PHP5 or have a wine tasting?! (Score:5, Funny)
Riiight. "Crisp". Yeah, that sounds like a very analytical test run you did. Did you also notice PHP5's woody undertones and how it satisfies the spirit without weighing down the heart?
Time for /. to (Score:5, Funny)
Re:Time for /. to (Score:5, Interesting)
Re:Time for /. to (Score:2)
I don't think it'd be possible to write the Slashcode in any new language without risking small features that work now breaking down and upsetting the few users who use that feature. Any gains from switching would be overriden by that unavoidable mess at the conversion.
Re:Time for /. to (Score:3, Interesting)
Personally, I think Slashdot needs to be re-written in C. See my journal for the complete idea.
Re:Time for /. to (Score:3, Informative)
turck-mmcache.sf.net
It caches the compiled op-codes. Makes php MUCH faster. Reduced the load average on my machine from about 8 to 0.56
PHP in comparision to others (Score:4, Interesting)
I guess a lot of PHP user base was once doing mod_perl and CGI. I personally use JSP, but often find it too cumbursome for quick hacks.
Re:PHP in comparision to others (Score:3, Insightful)
I've never used ASP or JSP, but PHP is much easier to pick up than Perl or JavaScript. It's very simple, and uses C/C++-like syntax without the complexity you have to learn to program effectively in C/C++.
Unfortunately, this means that there's huge amount of PHP code that's utter crap out there, because you don't have to think before you code.
Re:PHP in comparision to others (Score:2, Interesting)
Uh, mod down, WRONG! (Score:2, Informative)
If it ran on PHP (or even mod_perl), it probably wouldn't have the scability issues it currently has.
Re:Uh, mod down, WRONG! (Score:2)
Re:Movable Type ain't written in PHP, fucko. (Score:2)
I stand corrected.
-fucko
Re:PHP in comparision to others (Score:4, Informative)
Here you go (Score:5, Informative)
Ease of use:
Classic ASP is pretty close to Perl. ASP.NET is a rather different paradigm, with a slightly steeper learning curve but more than enough added power to make it worthwhile. Unfortunately ASP.NET is a classic "leaky abstraction;" it tries to make things simple that sometimes aren't, and this will bite you.
Perl: it's nearly impossible to maintain a substantial site in perl with multiple developers working on the code. The language works against you here. Again,
JSP: takes a PHP-ish approach but Java is a statically typed language which makes using it for web apps _extremely_ verbose in comparison to the other languages here.
Javascript: poor fit for server-side use. Nobody does anything serious with it that way.
Verdict: They all suck to one degree or another. It's heresy on
Re:Here you go (Score:2, Funny)
Last I knew, it was every Wednesday night. Do you have more recent information?
Re:Here you go (Score:3, Insightful)
Yahoo uses PHP and Perl. Amazon uses Perl. TicketMaster uses Perl. These are some of the biggest sites in existence. The only truly large site using Java is eBay, and they are not using all the standard J2EE stuff. And I can't
Re:Here you go (Score:5, Informative)
Whether a website will scale to cnn like levels is dependent on quite a few factors... two of the main ones that come to mind are:
a) How much work the site has to do to build a page (think basic marketing website vs an online banking site)
b) Sensible overall design (both code and network/hardware).
A well built PHP site (i.e many servers load balanced, well cached page content, intelligently coded to scale from the outset) will scale to whatever you like, at least for cnn type content which is easily cached.
I worked on one of the very few major news websites that coped with Sept11th traffic, and that website was developed using Linux/Apache/PHP/MySQL. (we only just coped mind you!
I remember reading a while back that yahoo use PHP for various bits and pieces too..
Re:PHP in comparision to others (Score:4, Informative)
This really all depends on the sites content, an average ecommerce site probably only needs to hit the database once a day, slash on the other hand could cache the front page for non-logged in users for 5 minutes, which I believe they are doing now with perl.
As usual YMMV.
significant changes (Score:5, Informative)
other than that, looks like version 5 introduces some cool stuff, ala java. abstract classes, exceptions, method visibility, and interfaces to name a few. can't wait to give it a try.
Re:significant changes (Score:5, Insightful)
Sounds to me like the migration to PHP 5 will be a long and painful one. The project I've been working on in PHP for the last couple of years sure could use some of the new features, and if what another poster said about responsiveness translates to higher speed, that's another reason to switch. Then again, looking through megs of PHP code for things that are suddenly ever so slightly broken because of subtle language changes is not exactly fun.
For new projects, OTOH, I don't see much reason to stick with PHP 4, except the horrors of having to instruct users that they need to upgrade their PHP interpreter(s) again.
Re:significant changes (Score:5, Informative)
The nice thing is that it nearly completely models the functions listed in the w3c recomendation for the DOM Level 3 Core [w3.org], which are also nearly identical to the XML::LibXML module in Perl.
So, IHMO PHP5 = Good, Core PHP 3ed = Bad!
Re:significant changes (Score:2, Insightful)
Which is why it may suffer problems with a lot of hosting companies upgrading and adopting PHP5 initially. Its seems like 90% of the borrowed code and available projects out there tend to be class based (even though most small projects don't necessarily need to be done in OOP, but this isn't an argument I'm going to delve in
Apache 2.x safe to use yet? (Score:5, Interesting)
Anybody know if PHP 5.x has overcome this limitation?
Re:Apache 2.x safe to use yet? (Score:3, Interesting)
Re:Apache 2.x safe to use yet? (Score:3, Insightful)
Re:Apache 2.x safe to use yet? (Score:2, Interesting)
I don't remember the exact details of the whole fiasco, but both sides racked up a black eye in my book. It
Re:Apache 2.x safe to use yet? (Score:5, Informative)
You have to use the pre-fork MPM, which is the same condition you'll have when using various modules with mod_perl. Basically, PHP core is thread-safe, but you're likely to use some extensions in your own configuration, and these aren't necessarily thread-safe.
I'm not aware of a list of "who's safe", but such a thing would be nice.
Re:Apache 2.x safe to use yet? (Score:3, Interesting)
Apache 2.x MPM is safe with PHP 4.3.x (Score:3, Informative)
Don't use PHP 5.x yet for production. Wait until it's released (at least), or a few months after the initial release.
I have a webpage on how to build and use PHP with Apache 2.x at http://dan.drydog.com/apache2php.html [drydog.com] 4.3.4
Re:Apache 2.x MPM is safe with PHP 4.3.x (Score:3, Informative)
Re:Apache 2.x MPM is safe with PHP 4.3.x (Score:3, Interesting)
Re:Apache 2.x safe to use yet? (Score:3, Interesting)
PHP is not thread safe and likely never will be. The core is thread safe, but not all the extensions are guaranteed to be thread safe due to the external libraries they use. Thread safe issues likely won't show up during testing, but will show up in production under heavy load. This is the reason Zeus recommends using FastCGI instead of ISAPI f
PHP5 Features (Score:4, Informative)
Php 4 vs php5 (Score:3, Interesting)
running both php 4 and php5 (Score:4, Informative)
PHP Advocacy: presentation layer=application space (Score:2)
PHP has two primary strengths: architecture and standards. The majority of java webspace applications were written before css and xhtml w
Re:PHP Advocacy: presentation layer=application sp (Score:5, Informative)
PHP has two primary strengths: architecture and standards.
Java is a general purpose language build from the ground up as an OOP. Java is used from embedded systems, mobile phones, desktops, webapps to world class enterprise projects. Java has a sound definition as a language and its virtual machine. Java standards are defined by the JCP [jcp.org] with formal methods for approving changes including Apache.
AFAIK PHP is used only in webapps. OOP was added as an afterthought. PHP is a project of the Apache Software Foundation.
Architecturally has native standard access to databases and there are drivers for every db, supports distributed transactions, has message queues, takes advantages of multiprocessors, JIT native compilers in the VM, libraries for every need. Don't know about PHP but for what I know Java has a more advanced architecture.
The majority of java webspace applications were written before css and xhtml were mainstream.
What apps are you talking about? The PHP changelog shows that PHP 4.0 was released in may 2000. The great mayority Java webapps are based on servlet API 2.2 or later which where release on april 2000. Please explain how Java apps are less suportive of css and xhtml than PHP. BTW, how many PHP 3.x webapps are there?
I predict that there will be a need for css and xhtml conversions among the big java web apps and this will be readily delegated to PHP.
If I would have a Java webapp that needs to support css and xhtml it would be ridiculous to rewrite the app in another language, when it could be easily adapted. How would I explain it to my customer? There's nothing in Java or PHP that prevents using css or xhtml or making them automatically supported.
I don't mean that PHP isn't useful, but Java has just a broader scope.
Control vs. Abstraction (Score:4, Interesting)
OTOH, I am a bit more involved in programming in PHP. I think it's fairly nice and simple enough. Haven't gotten into a lot of the OO stuff but it's still fairly powerful with the simple things I do.
From what I've read, ASP.NET abstracts a LOT of the stuff from the programmer. Forms pretty much take care of themselves, validate on their own, and repopulate themselves for the user to correct. Among other things, this helps isolate code from content.
From experience (which may be very limited), PHP doesn't have this feature. This allows for so much more control over what happens to your forms, but also introduces more code into the mix which could get ugly after a while.
Thus we have control vs. abstraction -- a classic debate. Convenience and rapid development would lean towards abstraction (as anyone who coded VB may argue). Would be nice if PHP had that n00b convenience somewhere while still being great for more advanced coders.
Ultimately, control is probably the choice for anyone who wants to get past the abstraction. Besides, in the long run, you'd probably want to write your own data validation code (or at least implement an open-source version) instead of relying on a (closed-source) language to check for you. That's simply a matter of trust.
Seaside (Score:5, Interesting)
No need to learn (Score:5, Funny)
PHP vs. Perl (Score:5, Interesting)
What advantage does PHP have over Perl?
At first, I rejected PHP because of its (apparent) preference for intermingling presentation and logic. As has been thoroughly discussed in another thread, separating the two is not only possible but recommended. That doesn't give PHP any points though -- it just removes a penalty.
Both languages have a wide range of libraries/modules to choose from (although I think the score here goes to Perl). Their syntax is nearly identical. They both run on lots of different platforms. PHP is pegged as a tool for making web sites, while Perl is a general-purpose scripting language that happens to be useful for web sites too.
So, make a business case for me. I manage a development team (I rose from the ranks so save your MBA jokes for another day) and I want to know why I should consider PHP over Perl.
Perl's grammar is too big (Score:5, Interesting)
I use perl often, but I consider it a "fire and forget" language. I use it for sysAdmin type work often, when I'm doing something once, and want to write a quick script that nobody (including me) will ever lay eyes on again. For real development, where I'm trying to create a maintainable piece of software, with input from other developers, I stick to PHP.
Re:Perl's grammar is too big (Score:5, Interesting)
But come on. Once a programmer really gets into perl, only another hard-core perl person can read their scrawl. Don't get me wrong, I love perl. But it's a horrible choice for a large project with many developers.
I've not dug into perl documentation for a while (has it been years?), but last time I checked, it was about 100 man pages. With php, if I think there's a function called split, I type http://www.php.net/split and there's the docs.
Re: perldoc, c'mon! I get the impression you've never had to maintain code written by a hard-core perl programmer (or maybe you are one). For hobby stuff, use any language you want, but for business purposes, I don't want to have to search for developers who are so fucking specialized in perl. With PHP, I can make anybody who learned the basics fo C and make them productive in about 48 hours, working on someone else's code. With a big perl codebase, that same person is going to have to be twice as expensive if they're going to jump in head-first.
Re: too many overlapping core functions - I don't know what you're talking about. There are a few aliases in there (ie: chop or rtrim [php.net] (which actually is annoying, since chop() should work like it does in perl, IMO)), but I don't see a lot of overlap.
I think perl is really neat, but it's overkill. I know that's the tried and true criticism, but I really think it's true. I don't want to give a group of 4-12 developers of varying cluefulness that sort of capacity to create havoc for each other.
Re:PHP vs. Perl (Score:4, Informative)
When I go back and look at my Perl scripts I wrote a couple weeks ago, it takes me a while to get my head back into the script. With PHP, the code is always straight forward. It may be more verbose, but I understand it much more quickly than my Perl.
Besides this, I've found PHP's documentation to be far superior to any other languages'. When I do web programming, give me PHP anyday.
The only thing Perl has over PHP in my mind is that CPAN [cpan.org] is currently far superior to PEAR [php.net]. If you need many special libraries, you may want to consider Perl.
</ramble>Unicode (Score:4, Insightful)
Re:Unicode (Score:4, Informative)
Get to know PHP5 (Score:4, Informative)
Finally clause (Score:4, Interesting)
The main reason I initially dumped PHP was its atrocious error handling. Python and other more elegant languages use exception handling, which is much more elegant than checking return codes and setting error handlers.
I had read earlier than PHP 5 would include exception handling, but wouldn't include the "finally" clause. For programmers that understand and use exceptions, the finally clause is _very_ useful. I try to avoid using C++ simply because it doesn't have a finally clause (and no, the object destruction mechanism is not a good substitute).
So, I became very excited when I read the following:
Note that there is support for "catch all" and for the "finally" clause.
(http://www.php.net/zend-engine-2.php)
However, I couldn't find any examples showing the "finally" clause or the "catch all" clause in use.
So, I went grepping through CVS.
In the changelog for PHP, it is suggested that all exceptions _must_ inherit from a base 'Exception' class, which means that catching and exception of type 'Exception' is a basic "catch all". However, I couldn't find _any_ evidence in CVS that a "finally" clause has been introduced in PHP 5.
Has anyone here found evidence that the "finally" clause exists in PHP 5?
Connection pooling ? (Score:5, Insightful)
Stable my ass! (Score:5, Informative)
It's been fixed now, but I don't see how they can go and say "Oh, it's really really getting there now" after bugs like that have been discovered so recently.
But PHP's development is odd to say the least. In the Betas alone, entire sections of functionality have been rewritten. From scratch. I mean, shit.
Don't get me wrong, PHP is a great language and PHP5 is a step in the right direction but the development of PHP seems, to me at least, so hell for leather.
Re:It is NOT stable (Score:3, Informative)
Re:It is NOT stable (Score:3, Insightful)
Re:It is NOT stable (Score:4, Funny)
Re:It is NOT stable (Score:3, Insightful)
"RC1 != Stable". No fucking shit, Captain Obvious. That's why it's a RELEASE CANDIDATE *gasp*. Nowhere did it state "Put this on your production machines at once." It said "stable enough
Re:It is NOT stable (Score:3, Funny)
Lighten up Francis ;-)
Re:It is NOT stable (Score:2, Interesting)
I've been playing with PHP5 since Beta1 and honestly, I've never noticed any stability issues with it. Of course, that's not to say that it was stable (could have been bugs or security issues).
PHP5 has really great Object Oriented functionality. I'm glad to see that it isn't far from being released.
Re:just too bad (Score:3, Informative)
magic_quotes - you're totally right. Teh are the SuX. But it's not hard to work around. You just have some low-level test that checks the mq setting, and then conditionally addslashes() or not. It's not *that* hard. It's just one of those things you figure out when you realize that, for example, you're writing code that you're going to publish.