Posted by
CmdrTaco
on from the get-your-develop-on dept.
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!"
388 comments
It is NOT stable
by
panic911
·
· Score: 0, Insightful
RC1 != stable
Don't assume it's stable, until PHP 5.0 (stable) comes out. Here's what the article on php.net says:
quite stable - stable enough for everyone to start playing with
(wooo RC1's out!)
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 0
I wouldn't consider it totally stable at 5.0 either, there could still be a few bugs that we missed, look at Linux 2.6.x do you think it is stable enough to run on a production machine, yet?
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 0
2.6.4, Yes
Re:It is NOT stable
by
Trejkaz
·
· Score: 0, Redundant
--
Karma: It's all a bunch of tree-huggin' hippy crap!
Re:It is NOT stable
by
panic911
·
· Score: 2, Interesting
lol, good point.
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:It is NOT stable
by
LostCluster
·
· Score: 3, Informative
A "release candidate", by definition, is thought to be stable, but they're not quite sure enough to declare it in the stable release yet.
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 3, Insightful
You'll know it's stable when porn sites start transitioning to it. Consider the load testing that they are able to throw at any software.
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 3, Insightful
...why do people mod this shit up? It's NOT fucking insigtful, it's redundant. The entire parent post could be removed and no one would think anything different than if it was never posted to begin with. It's just repeating shit that was already said and is so blatantly fucking obvious to anyone who cares enough to use it.
"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 for people to start playing with."
Let me guess, the sun is yellow?
Modding this shit up just encourages people to post brain-dead information and therefore makes everyone stupider in return. So don't do it.
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 0
MOD PARENT UP! This is the kind of straight talk Slashdot needs if it wants to be worth anything to anyone. I feel the parent poster's frustration!
Re:It is NOT stable
by
penguinblotter
·
· Score: 4, Funny
John Lim has also his doubts on PHP 5:) "revolutionary"
php.weblogs.com
Yet, I am glad PHP is maturing to a more stable platform.
Alexandru
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 0
Never fear, we will be soon enough... been looking at it for a while now.:)
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 0
They are karma whores and people that generally are just trying to type 20 seconds worth of crap to get first post or first 'real' post.
To reply to this article: I think i will try out the new PHP after i upgrade my ports since I gotta patch the SSL bug and rebuild the OS anyways.
Re:It is NOT stable
by
footNipple
·
· Score: 3, Funny
...why do people mod this shit up? It's NOT fucking insigtful, it's redundant. The entire parent post could be removed and no one would think anything different than if it was never posted to begin with. It's just repeating shit that was already said and is so blatantly fucking obvious to anyone who cares enough to use it.
Lighten up Francis;-)
Re:It is NOT stable
by
Anonymous Coward
·
· Score: 1, Informative
Of course it is not stable enough for production use - but it's stable enough for start porting your software for PHP5. There's some signifient (and GREAT) improvements in object model which our company has found very useful. With this RC1 release, we'll start new bleeding edge branch to port our 100 000 lined object oriented software to PHP5.
There's some good changes for example that constructor is always ___constructor(), of course drawback in porting is that you need to change it to all of your classes. But in long term it's good since you don't need to change constructor names every time you change name of class (for some reason).
Small tip for making your constructors PHP5 compatible:
function __constructor($foo) {
$this->oldClassConstructor($foo); }
function oldClassConstructor($foo} {
return $foo; }
This makes constructor PHP5 complitant with same time keeping your old PHP4 constructor working.
PHP5 also has private functions,classes,variables and other nifty stuff:-)
Power Power Power
by
ObviousGuy
·
· Score: 2, Interesting
It's funny, I remember when it was a main tenet of programming that data should be separate from presentation. However, PHP has shown just how powerful integrating data and presentation can be through inlining code directly into a webpage layout.
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 itself.
-- I have been pwned because my/. password was too easy to guess.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 5, Insightful
It's funny, I remember when it was a main tenet of programming that data should be separate from presentation. However, PHP has shown just how powerful integrating data and presentation can be through inlining code directly into a webpage layout.
Try something complicated. You'll change your tune right quick.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 4, Insightful
Powerful is one thing, maintainable another.
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.
this is one of the things that I hate about php.. inline into a web page is HORRIBLE, it's hard to read, it's easy to miss a badly spelt variable name..
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
by
Charles+Dart
·
· Score: 3, Interesting
Separating code and content (and style) is what I use php for. If you are putting php in your html you are doing it backwards. Marked up content goes in one database table CSS goes in the other and php puts them together.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0, Flamebait
"As Perl seems to fades into irrelevance?"
Oh please. All you PHP simpletons are all alike. Imbeciles in its truest form. First off you can't even compare Perl to PHP. Perl is a general purpose progamming language not a simpleton web language such as PHP. So if you're going to put something down at least have proof. PHP is a memory hogging inefficient childs toy. And if you're going to compare PHP to Perl, at least compare it to Mason & mod_perl, you know it's bs when you try to make the odds in your favor trying to compare PHP to CGI. Duh obviously it's a better contender there but not when it comes to Mason & mod_perl. So next time, please go do your research instead of babbling.
You know being second to last at http://www.bagley.org/~doug/shootout/craps.shtml is not biased. PHP DBI is a joke too. Perl DBI is a fantastic DBI, unlike bleh PHP's.
Perl > PHP need I say more?
Re:Power Power Power
by
mcrbids
·
· Score: 2, Informative
It's funny, I remember when it was a main tenet of programming that data should be separate from presentation. However, PHP has shown just how powerful integrating data and presentation can be through inlining code directly into a webpage layout.
Separating data and presentation is more powerful in the end. That's why people make things like php.MVC.
--
Karma: It's all a bunch of tree-huggin' hippy crap!
Re:Power Power Power
by
kevin_conaway
·
· Score: 4, Insightful
Umm, Perl is not dead or dying. It may not be used as much as it used to for CGI programming but in the world of system administrators, it is still very much alive and even growing. An admin without perl is making his or her life much worse than it could be
Re:Power Power Power
by
junkymailbox
·
· Score: 2, Insightful
I've tried both simple and complicated. It's in the design. You can easily write incomprehensible code that's not easy to maintain in any language.
Re:Power Power Power
by
w3weasel
·
· Score: 2, Insightful
inline into a web page is HORRIBLE, it's hard to read, it's easy to miss a badly spelt variable name
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)
--
Just as irrigation is the lifeblood of the Southwest, lifeblood is the soup of cannibals. -- Jack Handy
Re:Power Power Power
by
sir_cello
·
· Score: 2, 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.
Yep. And if you inline presentation and data in a complicated web app, that's bad design.
Re:Power Power Power
by
justMichael
·
· Score: 4, Informative
Do yourself a favor and do not mix business and presentation...
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.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
I wonder why Embedded Perl (found at http://www.ecos.de/embperl/) didn't succeed as much as PHP. I picked it up really fast and you could easily separate code from content (having two httpd's running one for static and one for dynamic code). Also, having access to all the perl modules made my programming life easy as well: I didn't have to re-invent the wheel each time.
I knew pearl had a lot of things included, but I am sure I can do without the kitchen sick.
blleeehh
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
wow, it really sounds like you're coding PHP as badly as is possible.
keeping it seperate is still tasty and delicious, even if the language allows you to program like a monkey.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 1, Insightful
Whenever I see a story about PHP, I think more about the death throes of Perl than about PHP itself.
That says a lot more about your attention whoring than either language.
Re:Power Power Power
by
Snoopy77
·
· Score: 2, Insightful
PHP has shown just how powerful integrating data and presentation can be through inlining code directly into a webpage layout.
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 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 the troll but they don't let me feed the aninamls at the zoo anymore.
-- "She's a West Texas girl, just like me" - G.W Bush
Iraqis
Re:Power Power Power
by
loginx
·
· Score: 5, Informative
Whoever said that PHP only uses inline HTML for the presentation layer is a tool.
Thereareseveraltemplating enginesavailable 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...)
I've thought about this a lot, and I'm still not sold on template engines for PHP. PHP already provides the same functionality as template engines (usually in a more readable syntax, IMO).
Note that I'm not saying it's a good idea to mix presentation and app logic, but you don't need a template engine to prevent this. Just use PHP for the display logic in HTML pages, and PHP for the app logic in classes/function libraries.
err Python and Ruby are in the same solution space as Perl where as PHP, ASP and JSP are competitors.
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
by
FyRE666
·
· Score: 3, Insightful
If you are putting php in your html you are doing it backwards. Marked up content goes in one database table CSS goes in the other and php puts them together.
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...
I used to feel the same way, then one day out of boredom I started looking at Smarty, it was really odd at first, funky syntax (at the time, I don't even think about it anymore).
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.
Will generate Month Day Year drop downs that start in 2000 and end 2 years from now.
The biggest selling points for me were output caching and keeping the presentation and business seperate. But a lot of people don't think the extra overhead is worth it.
The best suggestion I can make is take a few pages out a current project of yours and redo them in one of the templating engines (not in your production tree;), you'll figure out withing a few hours if you like it or not.
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.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Fairly Decent Troll. Lots of slashbot bites. Well done.
Re:Power Power Power
by
Rui+Lopes
·
· Score: 2, 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.
I think you are wrong... CSS splits STRUCTURE from PRESENTATION. DATA is what you put between tags. You can have the same structure with diferent data instances, presented in several diferent forms. Oh, BTW, php, asp, jsp are BAD ways of using this kind of design. Try using XML/XSLT/CSS to unleash the true power of web...
-- var sig = function() { sig(); }
Re:Power Power Power
by
loginx
·
· Score: 4, Interesting
I personally use a proprietary templating engine, but if I was to use any of the open-sourced ones, I would first look at what my requirements are.
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
by
sporty
·
· Score: 2, Interesting
Yet it does such a bad job of enforcing it. You'd think for a language who's job that acts as a conduit between your view layer and your model would at least do a good job at it.
Or are we going to add another few thousand functions into the core language. Again.
hmm i tend to inline my form (style being a stylesheet) but i do bring it out if im coding for work (rare now we've hired a new web designer) and try to code logic then display. Ill try to be better infuture after changing my website over to xhtml (lowercase tags, gah).
That was a bastard, as i kept finding random s and things in error-handlers... actually getting a xhtml compliant page worked 90% of the time, but all the weird error handlers and things and particularly things with postdata broke it... and finding that with a xhtml validator is a bugger as you can only pass GET data not POST....
in short, I do when coding code that'll be maintained, for weird throwaway stuff or small stuff, i dont bother (dont look at my house server's code)
Re:Power Power Power
by
Tablizer
·
· Score: 2, Informative
I think the "separate presentation" thing does not work well in practice. One-to-one translations usually don't work, and the frequency of out-right switches to other platforms/UI is not frequent enough to justify the up-front costs IMO.
See the debate at: http://www.c2.com/cgi/wiki?SeparateDomainFrom Prese ntation
Re:Power Power Power
by
oZZoZZ
·
· Score: 2, Informative
Agreed... I wrote a 150k line 'application' for a company's inventory and job control... after a month into the project, I had to scrap the whole project and start again. I ended up using 'module' functions to query databases, another set of 'modules' to format the data as xml, and another set to process the xml data with xslt using sablotron.
The three internal-tiers worked remarkably well, and made changing the application extremely easy. To make changes even easier, all insert functions were selects to postgres stored procs written in pl/pgsql, and all selects were done to views, both of which could be very easily changed without affecting the underlying data structure (or the underlying data structure could be changed without affecting the program).
Re:Power Power Power
by
bonch
·
· Score: 0, Flamebait
Because Anonymous Crowhead has declared such! I mean, even if you code it completely correctly, present it correctly, and the code itself is well-organized and formatted and easy to read...Anonymous Crowhead on Slashdot has decided inlining presentation and data is bad design. Let's all change for him.
I could see where something like this could be useful. It's relatively trivial to cache your queries so that they are stored on the local FS for a while and then refreshed from the database periodically.
-- The best way to support the US war effort is to continue buying American products.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Obviously you wouldn't know dynamic if it bit you in the ass. My site has user editable pages *and* styles via forms. Tell me now how a filesystem is better for that.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
To anyone who modded this up or is considering doing so, take a look at the site given. Particularly the part about the "Completely Random and Arbitrary Point System."
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Umm.... Anonymous Crowhead is correct. MVC is an established design patter for web application development. Nobody designs enterprise-scale web applications with inline code.
Re:Power Power Power
by
Doyle
·
· Score: 2, Informative
It's like that movie: "with great power comes great responsibility."
PHP gives you great power, but your code will only be maintainable if you explicitly take care of that.
(I code my apps to write XML nowadays, then pass that on to some XSLT goodness: separation!)
Would you please bother to make an example of this? I may be getting wet into web programming for my thesis and would really like a simple example, like reading a table from a database and outputting it into a simple webpage with some simple CSS.
As i use macosx, i already have php and apache built in
Re:Power Power Power
by
SnatMandu
·
· Score: 2, Insightful
First off you can't even compare Perl to PHP.
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?
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
"Umm....", of course they do. I can name at least ten major examples.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
You must be new. WHY on earth would you stick everything in a database?
Dynamic Dynamic Dynamic, geez how about some design, some carfully selected logic for a series of includes, small control scripts, and actual ARCHITECTURE to go along with some FLAT content and only go "dynamic" when necessary.
There IS such a thing as over-doing it and bogging down your servers.
I (with 4 other developers) created a GIANT e-commerce system used by thousands of mid-large businesses with LOGIC and ARCHITECTURE and with as little as possible dynamic content.
I would like to see your design hold up to 20+MB/sec usage of php,database calls and barly any images.
if it DID hold up it wouldnt be with out some RETARDED amount of hardware to back itup.
How do you respond to this? I'll avoid anything confrontational, so...
reading a file is ALWAYS faster then running a database query. That is not databases are designed for anyway, so it is a non-issue. I would be happy to discuss implementation and specifications so that you could design around that inherent difference.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
you forgot to name them.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
>
It's funny, I remember when it was a main tenet of programming that data should be separate from presentation. However, PHP has shown just how powerful integrating data and presentation can be through inlining code directly into a webpage layout.
That's sure not the way I use PHP. I am fastidious about separation of algorithms from presentation. The last thing I want is someone to add artwork to one of my pages and mess up my database access classes. I always have at least 2 well-defined tiers.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
you forgot to tell us what your e-Commerce engine is.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Am I the only one who thinks it's completely BIZARRE that a templating system like PHP needs ADD-ON template systems?
How about just using <?=$var?> in your templates, etc?
About the only thing that keeps raw PHP from being 100% perfect is the lack of automatic entity escaping, but you can deal with that.
I think it depends on how often your pages and styles are changed, but I can't really imagine a stituation where it's the best idea to use the database for styles and content. Instead, I would recommend using the database to store the current content/style information, and whenever it's updated by a user, propagate the changes through files stored in the filesystem. Filesystem reads a re a lot quicker and I think you'll find this improves performance by an order of magnitude. Maybe you have constantly changing style sheets, but that just seems weird.
Well apparently you've never developped a large applications in PHP.
If I want to pull some records off the database, escape the results, set some session variables and THEN display the results from the table in HTML, there's going to be about 70% PHP code and 30% HTML code in there... that's really ugly and the designers I work with will probably attempt to poison my food...
For one thing, using short tags will prevent you from working rendering xml files, since the header doesn't get parsed correctly. So you have to use the long version: which is't so bad.
Also, if you need a lightweight template engine that actually deals with php, go with savant, you won't regret it: http://phpsavant.com/
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.
Dylan? Come on, Dylan is pretty much dead. Agree about the other languages though.
-- Save your wrists today - switch to Dvorak
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Don't you know that a relational database has much more "performance" than a simple file system? It's TODAY'S TRUTH(tm).
Re:Power Power Power
by
matt4077
·
· Score: 2, Insightful
The problem with template engines is, of course, that they are either not powerful enough for what you do, or they become a new language by themselves. What good does it do, to replace a php if() { }else {} statement with some uber-xml-template-engine's ? 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 to have a loop through every row of a result making a table with it. And right there you have to mix logic and presentation, because presentation becomes part of the logic.
I'm teaching myself PHP/MySQL by building my own content management system type website. All the tutorials that I've read on the web store their (minimally marked up) content in the DB, which PHP then pulls, pasts in a template (which is a flat file) and the template references the CSS (another flat file) and then sends the resulting page to the client.
I'm no web guru, but it's seems like common web design commandment is "Thou shalt Minimize calls to the DB". Which is understandable. I've heard about some designs that store a copy of the page content in the DB *and* a flat file. (Use the flat file to create the page, but use the DB copy for searches?) Is this the approach you're talking about? But I've yet to see any examples/tutorials that illustrate this design approach and talk about it's pros/cons. Care to provide some links?
Actually, the system I'm developing uses both mechanisms. Initial data entry/editing use data from the database, and when anything is commited, the actual HTML on the filesystem is updated to reflect what's in the database. With this system, you get dynamic, easily modified content, but a very quick presentation layer.
I also have dynamic PHP code that is dynamically built in PHP include files. The menuing system is comprised of PHP arrays declared and defined in the include files, and the menu system engine simply iterates over the arrays.
So far, it looks like the system works pretty well, but at the moment I have no way of testing it under heavy loads. Anyone know of any load-testing mechanisms I can use?
It is relatively easy to retreve/manipulate relatively static content using MySQL over a using a flat database or text file. Assuming a site was having performance issues, couldn't you simply set up the site to write static html files from database content?
On the flip side, I would probably not store design html/css elements of a Web site in a database. I would think that these would be easier to work with as text files.
hmm... i looked at it. There is no real documentation, for instance. They say that J2EE is supported but the link forwards you to PHP...hmmm. Okay, I know PHP so I looked at the basic concepts in the tutorial for the old PHP version of fusebox (membership required, doh!). I haven't see much new, sorry. To me it seems clearly inferior to, for example, Struts.
Sound like an interesting project. I considered doing something like that, 'publishing' the html, but I have a lot of code that does things not related to presentation that made it impractical.
If you want to test the load, get a story posted here on slashdot with a link to your site ; )
Actually, with a high performance database such as Oracle the RDBMS handles disk r/w and memory caching so with a properly tuned and indexed database the performance loss is minimal. The real issue though is that since my navigation is built on the fly to reflect page moves in real time using a database is a must.
You may not think of it this way but to me text is data and my database is designed to handle it.
You are correct, but there is a security issue as well, I let anybody edit pages and styles. What if some joker comes along and figures out a way to post some mal code, it might get executed (I have precautions against that but you never know) Results from db queries are not processed by the php processor so there is less risk.
Besides performance is not an issue, my bandwidth caps well before my server gets taxed.
By the way 90 percent of most page weight is images and my images are stored at the file system level.
Go back and read your first comment. You already are mean. Welcome to my foes list jackass.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Like I'm going to name major company's setups here on/.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Ehm..
"reading a file is ALWAYS faster then running a database query." - Why ? Optimal condition for a database would be to have the entire content in memory, cached. Cant say the same for a filesystem.
"That is not databases are designed for anyway, so it is a non-issue" - They're not ?
...there's going to be about 70% PHP code and 30% HTML code in there
each page of every application i do is 100 percent PHP. i wrote php functions for the html tags that i use so it's extremely easy to read. i realize that it might be a bigger performance hit than raw html, but for sheer code elegance and maintainability, it's worth it. besides, most of my projects are for intranets anyway.
also, the php functions that replace the html tags know idention proper, so viewing source on my pages look very nice, with proper identation for table tags, etc.
I manage a personal website with PHP, and it's also my PHP learning project too. I took your advice and checked out Smarty.
As of now, I'm rewriting the entire site, and the code looks so much better. Before I had a mess of PHP and HTML. Now it's all managable and I might even open the code up since I'm not embarassed that it was such a mess.
Thank you for the heads up!
--
//Blessed are they that run around in circles, for they shall be known as wheels.
Re:Power Power Power
by
Anonymous Coward
·
· Score: 0
Ever heard of a fucking ram disk, Mr. Needle Dick?
I've really never gotten why people use something like Smarty. What's the difference between including my custom functions/classes in a file and referencing them with PHP and using Smarty and doing the same?
I end up with effectively the same thing in either case with different syntax:
Name: {$name}
or Name:
And it just gets worse if one has to manage the output visually, such as alternating table row colors or something. How is this separating code from content?
The problem I have with Perl, though I love the language because it is FUN, is that routing everything back through one or more monster scripts that are the program, especially when most of the code is spotting out XHTML and CSS *anyway* is a such a pita. Not to mention finding a host thast will deal with mod_perl -- why is mod_perl so hard for hosts and mod_php so easy?
I've really never gotten why people use something like Smarty
Personally I use Smarty because of the output caching, it's not the only reason, but it is the biggest.
And it just gets worse if one has to manage the output visually, such as alternating table row colors or something. How is this separating code from content?
It's not seperating code from content, it's seperating business logic from presentation logic. Just as an example directly relevant to your complaint.
Don't get me wrong, I'm not saying that everyone should use Smarty or any other template engine, but for me it works.
I can hand off all of my Smarty templates to an outside contractor, give them my docs and point them at the Smarty docs and be 100% positive that this firm can _never_ break the business logic, no matter how badly they screw up the templates.
As with anything else, use what works best for you and your project, but you should do your best to seperate the business logic from the presentation logic.
why is mod_perl so hard for hosts and mod_php so easy?
It's been a long time since I have used Perl for web dev, but isn't it a lot easier for someone writing crap code to kill an Apacge server with mod_perl than it would be with mod_php? I could be way off base and if I am I'll hear about it;)
Its not just massive switches that take advantage of this. I use the Redhat WAF for Java development and the java/xml/xsl seperation is beautiful. Occasionally a JSP is used for something so simple that it is otherwise silly. But keeping all of the real logic in java and all of the display information in xsl is amazingly simplifying.
Then the real advantage comes when you want two different interfaces for the same program. One for a cell phone and another for a desktop web browser. Just make some new xslt's and choose them based on the client string. Any changes made to the business logic does not have to be rewritten.
Its not really about portability and scalability. Its about simplicity. I can have a graphic design person with soem xsl skills write all of the html output against a sample xml dataset and then join it up with the real web app when its done. The designer doesn't know anything about sql queries or permission checking api's. He just makes the output pretty.
Some people don't understand that the seperation is not UI from Business Logic. Its presentation from UI. Business Logic can be seperated from UI as well, for the most part, but they both need to be seperate from presentation.
Hmm... why do we always get new expressivity features and library extensions, instead of new safety features and ways for statically checking our code (such as type checking, a novel but, admittedly, completely impractical and academic invention that only freak languages use)?
I guess because people like me prefer to complain and use other languages instead of fixing unsafe ones...
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.
Using unit testing in a test-first mode of development can make type problems go away.
Re:Safety?
by
Anonymous Coward
·
· Score: 2, Informative
Well that depends, would you include: private and protected members/methods, abstract classes, class type hints, the "final" keyword, destructors and/or exception handling as safety features?
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 former Delphi designer) have expressed a definite desire for at _least_ a strict mode. PHP is hardly the only language with loose types... and considering that you are often dealing with form input, which is text, it's nice to not have to do explicit casts all the time.
Of course when working with databases (at least if you don't just make every field a TEXT or equivalent type), it's nice to have that kind of type checking. In which case it is possible to check those types. See the !== and === operators, as well as a series of is_() functions (such as is_string(), is_integer(), etc.
Personally, I wish they could have come up with a real date/time type... that's one thing I really miss about Delphi...
PHP is a weakly-typed language by design, not because they haven't gotten around to implementing type checking yet. If you're feeling insecure about your code, you can always explicitly typecast your variables or use the settype function to calm your nerves.
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.
Function declarations may include class type hints for their parameters. If the functions are called with an incorrect class type an error occurs.
function expectsMyClass(MyClass $obj) { }
jbw
Hmm... why do we always get new expressivity features and library extensions, instead of new safety features and ways for statically checking our code (such as type checking, a novel but, admittedly, completely impractical and academic invention that only freak languages use)?
Explain to me how typecasting is a safety feature.
I'm not being sarcastic, or anything. I'm serious!
Give me some examples of where typecasted languages are safer or better, or where it's an advantage.
-- I have no problem with your religion until you decide it's reason to deprive others of the truth.
Re:Safety?
by
Anonymous Coward
·
· Score: 1, Interesting
It minimizes a large class of SQL Injection errors in web applications.
It minimizes a large class of SQL Injection errors in web applications
...which is handled smoothly with a decent abstraction layer...
Anything else?
-- I have no problem with your religion until you decide it's reason to deprive others of the truth.
Re:Safety?
by
Anonymous Coward
·
· Score: 0
After working on a large multideveloper project with a loose-typed language (errm, vbscript), I wouldn't do it again. One was always in the situation where you felt like you should cast input data to force a type, mainly because you didn't trust $random_contractor to always pass you the correct datatype. For smaller stuff where you have a handle on the entire codebase, it's fine.
ways for statically checking our code (such as type checking...
Since PHP types are dynamic, it would be hard to do static checking, no?
PHP allows you to check types at runtime, using functions such as is_string(). For your classes, you are of course free to add a "get_type()" method to a base class and derive everything from that. You can choose your own trade-off of safety versus convenience.
-- Tom Swiss | the infamous tms | my blog You cannot wash away blood with blood
Re:Safety?
by
Anonymous Coward
·
· Score: 0
> I can't say I've ever run into a problem with its handling of data types.
Forget abstraction. It is even more trivially solved by using placeholders with prepared SQL statements, like "select * from table where field1 = ?". The driver should then take a paramater in the execute() function, figure out what type it is supposed to be, and convert the parameter, or error out if it can't. It worries about escaping quotes, newlines, and any other special characters. Inject THAT.
Forget abstraction. It is even more trivially solved by using placeholders with prepared SQL statements, like "select * from table where field1 = ?".
I use something similar. Here's how it'd look using "my tech": (PHP)
$MDB=&New DBLayer('pgsql'); $sql="SELECT * FROM usertable WHERE user_name='[username]'"; $todb=array('username'=> trim($_REQUEST[login])); if (!$res=$MDB->SQ($sql, $todb))
Error($MDB->Error()); else
while ($row=$MDB->Fetch_Array($res))
{// do something with the result...
}
The stuff in the square brackets is parsed with a regex, and the values are matched against same-named values in the input array. If anything doesn't match, it errors gracefully through the error() function.
I stumbled on this about 6 months ago, and it's dropped the number of SQL injection bugs to zero, as well as caught bugs in my SQL statements before they could ever become problems.
-- I have no problem with your religion until you decide it's reason to deprive others of the truth.
Agreed. Why does everybody want to turn PHP into Java? If you want to use Java, then use Java. Diversity is good.
Double agreed! Man, that's the first time I've ever agreed with Tablizer.
-- "First you gotta do the truffle shuffle."
Re:Safety?
by
Anonymous Coward
·
· Score: 0
> you can always explicitly typecast
Typecasting is used to circumvent type-safety. The original poster was asking about enforcing type safety, which is something totally different.
> or use the settype function to calm your nerves
The goal of language safety is not to calm nerves -- it's to reduce the probability of bugs. Settype is a dynamic way of assigning a type of a variable. An important goal of type-safe design is to see if there might be other ways to provide more safety without introducing restrictions that are too inconvenient.
> Let's not forget that PHP is, after all, a scripting language.
So what does this mean? That a scripting language must inherently be an unsafe one? That we shouldn't try to improve the safety of the scripting-language paradigm because scripting languages are somehow inferior to "real" languages, and thus don't deserve all the safety features?
Don't take it to school!
by
DanThe1Man
·
· Score: 3, Funny
This is your brain, 7h1s 15 y0uR 8r41n 0n 1337. Any questions?
You should send that in to Think Geek. It would make a great shirt.
-- US Democracy:The best person for the job (among These pre-selected choices...)
Much improved.
by
Sheetrock
·
· Score: 3, Interesting
A test run of our PHP setup on PHP5 RC1 seems to be more responsive and crisp than it was on PHP4. I've also heard the syntax is being improved in some areas, which would be quite the boon (our site looking somewhat spaghettish as it is.)
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.
--
Try not. Do or do not, there is no try. -- Dr. Spock, stardate 2822-3.
Re:Time for /. to
by
Sheetrock
·
· Score: 5, Interesting
Although you might be kidding (since/. has an established base of well-tweaked high quality/high performance Perl code), not only is PHP and in particular PHP5 is an excellent choice for prototyping because of the integration between display and function, but it's probably the right choice most of the time for people who are seeking to integrate databases with web functionality without delving into high-priced solutions.
/. is in a special situation due to the amount of traffic it receives, and the amount of effort that has gone into making Slash the powerhouse that it is has no doubt driven projects like perl_mod to increase the efficiency on the webserver side. While PHP would only improve on the appearance and capability to add user functionality, there would be issues with stability.
--
Try not. Do or do not, there is no try. -- Dr. Spock, stardate 2822-3.
I'd say that PHP would be the selection to make if somebody were to start/. today, but when this site was started PHP wasn't a viable option and Perl ruled the day.
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
by
Micah
·
· Score: 2, Interesting
For a site like Slashdot, PHP would kill performance. mod_perl caches psuedo-compiled code in the webserver. PHP has to be re-interpreted for every page hit. You can install the Zend Optimizer, but from my limited trials with Xaraya running under it I wasn't all that impressed.
Personally, I think Slashdot needs to be re-written in C. See my journal for the complete idea.
Re:Time for /. to
by
Anonymous Coward
·
· Score: 3, Informative
You don't want Zend Optimiser (pointless) you want Turck MMCache
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
Re:Time for /. to
by
Anonymous Coward
·
· Score: 0
Personally, I think Slashdot needs to be re-written in C.
Come, come, machine code would surely be the preferrd option.
Personally, I think Slashdot needs to be re-written in C. See my journal for the complete idea.
NEWS FLASH: buffer overflow hole found in Slashcode! Quickly taking advantage of this newfound opportunity, a rather clever hacker set a trained Bayesian filter loose on Slashdot's posts, deleting all that got marked as "lame". In one epic few hours, Slashdot was purged of all the accumulated filth of the years, everyone's karma was set to 42, and the "Caldera" section was renamed "SCO: Litigious Bastards". The editors declared this a day of rejoicing, and set the karma of Micah (278) to 43 for suggesting that slashdot be rewritten in C.
Seriously, I'm not knocking the idea, just having fun with it. Although I would prefer a fast language without the usual pointer and buffer problems, like OCaml.
What I can't figure out is that relatively simple GUI-based desktop applications that spend most of their time waiting for the user, something that Python could handle perfectly, tend to be written in C. At the same time, websites on high load webservers are written in PHP, which is horribly inefficient compared to C in processor use.
And writting web apps in C shouldn't be any harder than writting end user apps.
Actually what I *really* want to see (and am sort of thinking along the lines of starting a project to do it) is a new super-high-level Web app language, with a (probably Python) program to translate it into an Apache module in C, taking advantage of threading in Apache 2 to cache virtually all data in RAM, and optimize the DB access for PostgreSQL. Even the display templates would be translated to C functions to eliminate the need for their runtime interpretation. Yeah, you'd have to recompile the thing for even simple changes to the site, but think of how fast it would be!
It also has a "persistence" API that let you save variables in shared memory. Perfect for caching pieces of web pages and speeding things up some more.
Re:Time for /. to
by
Anonymous Coward
·
· Score: 0
I would prefer a fast language without the usual pointer and buffer problems, like OCaml.
What a good idea. If only someone would write an Apache module... ooh, they have!
What I can't figure out is that relatively simple GUI-based desktop applications that spend most of their time waiting for the user, something that Python could handle perfectly, tend to be written in C. At the same time, websites on high load webservers are written in PHP, which is horribly inefficient compared to C in processor use.
I think a large part of that is distribution---C may not be the best language for GUI programs, but it sure is easy to distribute. You don't have to worry about whether or not your user has Python installed, or if you should bring along python23.dll, or what; you just have to send some binaries over.
Of course, it is simpler in the Linux/BSD/MacOSX worlds, where various scripting languages are generally installed by default or easily installed by a dependency manager. Python 2.3's release date was actually changed to coincide with a new version of OS X, so you can count on support there. But on Windows, C/C++/.NET/who-knows-what-else reigns supreme.
Re:Time for /. to
by
Anonymous Coward
·
· Score: 0
> has no doubt driven projects like perl_mod to increase the efficiency on the webserver side
Likewise, major PHP sites have driven projects like mod_php to increase the efficiency on the webserver side.
How does PHP comapre in terms of speed and ease of Use to other scripting languages like ASP, perl, JSP, or serverside Javascript.
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.
-- for the last time people, I am "frodo from middle eaRTH", not "middle eaST".
Re:PHP in comparision to others
by
Anonymous Coward
·
· Score: 0
JSP is NOT a "scripting language"!
Re:PHP in comparision to others
by
Phexro
·
· Score: 2, Insightful
Not sure about speed. It seems fast enough for most stuff, but I'd do some careful benchmarking and optimization if I was writing/designing a big app.
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
by
protohiro1
·
· Score: 2, Interesting
PHP is insanely easy to use. I think that is one of its biggest draws. I tried using JSP back in the day but it was really over the head of this artist. In terms of speed...well you're asking the wrong guy but I can't detect any difference between static pages and php pages (but my scripts are very simple). Products like vBulletin and Moveable type are very popular and seem to run at a decent speed and scale, so I think php is battle tested. Although the two web developers I know use ASP and JSP respectivly and don't seem to take PHP to seriously.
-- Sig removed because it was obnoxious
Re:PHP in comparision to others
by
Charles+Dart
·
· Score: 4, Informative
PHP is very fast and easy to use. The php.net website has great documentation. With the PEAR extension database abstraction is possible making all your data functions totally portable. As for quick hacks php can be run on the command line which is very quick and very hackey. I have been using it for years in tandem with MySQL and find that it meets all my needs (except for the fact that MySQL doesn't have nested queries but that is coming in the next release and I will be a happy man!) I also know JSP and Oracle but prefer PHP/MySQL by far.
Re:PHP in comparision to others
by
justMichael
·
· Score: 3, Informative
If you put a site together with a little planning and a properly setup cache and then use a template engine that supports output caching you can rival static pages depending on how often the page "needs" to hit the DB.
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.
Re:PHP in comparision to others
by
nickos
·
· Score: 1
I want to know if there's a sensible way of writing web applications using C/C++. It would have to have a way of seperating out the HTML so that designers don't have to pick through code. Any ideas?
Re:PHP in comparision to others
by
Anonymous Coward
·
· Score: 0
PHP has been purposely handicapped in regards to its performance so that Zend can sell a PHP Accelerator. PHP will not be considered in the big leagues until Zend stops this practice.
Re:PHP in comparision to others
by
Anonymous Coward
·
· Score: 0
PHP is much slower than Perl. Plus it's less secure (Perl has taint mode, etc.). The language syntax is very similar, except for the much larger standard library in Perl.
Re:PHP in comparision to others
by
mokeyboy
·
· Score: 1
I came into the computer game as a physics researcher in the late 1990's looking at CGI mechanisms to facilitate online data sharing/analysis methods (C at that time was the only option for NSCA daemons). I am now a sysadmin looking after Solaris/Tru64/Redhat/win32 servers with a 3000+ user base. I would recommend without hesitation that PHP should be your language of choice for web development because:
1) it is cross platform compatible
2) it talks to databases with less trouble than enything else
3) it is more likely to be available (or can be made available) than any other choice imaginable
My experience as a sysadmin at a UNI is that newbies want to use.NET because that is what they are hearing about, more mature players want to try PERL (yes you can but why?) and the rest just want something that works they don't have to code. PHP is the solution to all these problems:
1) no special firewall ports to be opened (.NET admins will know what I am talking about with socket connections)
2) talks to everything (my old PHP/SHTML/ASP template worked fine for all systems - a new corporate JSP system sucks for everything, including JSP)
3) don't know how it will be deployed. OS and other system details unknown or irrelevant.
4) extensive range of free software offering real solutions to customer issues.
PHP is also reasonably easy to develop for in comparison to JSP or other languages. Type casting can be loose without losing security (in a development environment) and the system calls to access external data repositories is much simpler than other alternatives.
The only thing that might be better is JAVA but that has a high local system resource cost and may invoke a lax IP security model for DB access. It is ALWAYS better to have a resource cost incurred at the server side, than the client side, where security is an issue (when is it not?). With this in mind, PHP and pure HTML interfaces are suggested as the best approach to multi-client access issues for resource constrained scenarios.
Regards
Mark (my opinion; not enterprise. within workgroup, my opinion holds some sway)
Not quite...
by
Anonymous Coward
·
· Score: 1, Informative
Actually, PHP folks seem to think mixing business and display logic is a bad idea (like the rest of the world):
smarty.php.net
Hate to say it but thats what php seems to do. Mix.
Php is embedded into the presentation layer via html and also runs in the application layer when it does things like run core logic and database access.
significant changes
by
berkleyidiot
·
· Score: 5, Informative
be careful upgrading, as the semantics regarding object assignment have changed from copy to reference. i know some of my code would make use of the old copy-on-assignment semantics.
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
by
Carl+T
·
· Score: 5, Insightful
the semantics regarding object assignment have changed from copy to reference
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.
--
This signature is not in the public domain.
Re:significant changes
by
T3kno
·
· Score: 4, Informative
All of the XML stuff has changed as well, I found that out while going through the Core PHP, which has been *cough* updated *cough* to cover PHP5. They forgot to mention that they were talking August 2003 PHP5, AKA PHP5 before libxml2.
The nice thing is that it nearly completely models the functions listed in the w3c recomendation for the DOM Level 3 Core, which are also nearly identical to the XML::LibXML module in Perl.
So, IHMO PHP5 = Good, Core PHP 3ed = Bad!
-- (B) + (D) + (B) + (D) = (K) + (&)
Re:significant changes
by
qlippoth
·
· Score: 2, Insightful
be careful upgrading, as the semantics regarding object assignment have changed from copy to reference. i know some of my code would make use of the old copy-on-assignment semantics.
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 into), which may subsequently become broken if said hosting company were to upgrade to the new version. Then again, one could always compile both versions to use different extensions like.php4,.php5...
We are doing production for php5 (yeah its risky - but we need the added features) - the dom models is level 2 not 3, and it's so sweet to work with. However if you have been using xml in php4 and upgrade your site will be f*cked beyond recognition afaik.
The only thing in php5 I don't like is the clone method for copying an object - It usually segfaults (bug reported, wasn't listed in the changelog, but might have been fixed with the object pointing to itself fix) and doesnt seem to copy objects referenced within. (it was needed to do a copy of a dom xml object - but we just dump and reload it untill its fixed). Nuf rambling.
PHP5 isn't just good, its great!
Re:significant changes
by
Anonymous Coward
·
· Score: 0
just run your unit tests!
you ARE using PHPUnit, aren't you??
Damn, you're clueless
by
jbellis
·
· Score: 5, Interesting
- for all but the most trivial sites, separating code & presentation is a Good Thing - PHP supports this kind of separation. google for template libraries.
That IS kind of funny
by
Anonymous Coward
·
· Score: 0, Troll
Funny that a site using "death throe" Perl could take down a site running PHP.
Death throe - whatever.
Paul Seamons
Re:That IS kind of funny
by
smack_attack
·
· Score: 2, Interesting
I think you are referring to sites that get killed from too many connections to MySQL (due to the poor defaults in MySQL). As someone who programs for high traffic adult sites, I can attest that PHP can handle loads of traffic with ease, it's the databases that usually fuck up first. And even then that's usually just due to retarded coding practices.
Funny enough though,/. uses MySQL without apparent problems, but then again there's a lot of page caching.
Re:That IS kind of funny
by
Anonymous Coward
·
· Score: 0
That's only half the story -- if PHP & Perl had a database connection pooling system, you wouldn't see this problem nearly as often.
Re:That IS kind of funny
by
larry+bagina
·
· Score: 1
"slashdot" is 5 or 6 boxes. With *lots* of caching thrown in. not exactly a fair comparison.
-- Do you even lift?
These aren't the 'roids you're looking for.
Re:That IS kind of funny
by
Anonymous Coward
·
· Score: 0
Yeah it's a shame there is no *_pconnect calls in PHP.
Re:Power Power Power [where's my perl!?!]
by
Telastyn
·
· Score: 5, Insightful
Huh?
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...
I just think about how easy it is to create something with PHP. Not necessarily the death throws of Perl. I started with CGI and Perl, and did quite a lot of it many years ago. I've worked with ASP too; I liked the flow of it, but it was too microsoft centric. When I came to doing web programming again, PHP was what was available, and I LIKE IT! Very powerful.
Any language that has a 4000 page Help document that is extremely easy to use and find information, is an excellent programming language.
(since/. has an established base of well-tweaked high quality/high performance Perl code),
Is this a troll? Every couple of weeks, I am plagued with "Internal Server Error" messages on this site, or I am plagued with the inability to view anything but the front page.
Thats not even mentioning all the bugs and HTML issues that are plaguing Slash.
Slash is OK code, but by no means is it the polished professional code you make it out to be.
Apache 2.x safe to use yet?
by
Anonymous Coward
·
· Score: 5, Interesting
I remember reading within the PHP docs about how unsafe it was to use the 2.x release branch of Apache with PHP...something to do with thread safety if I recall.
Anybody know if PHP 5.x has overcome this limitation?
Re:Apache 2.x safe to use yet?
by
Wonko42
·
· Score: 2, Interesting
I've been using PHP 4.x with Apache 2.x (as a module) for over a year now, on both FreeBSD and Windows, with no problems. I haven't tried PHP 5 yet, but I imaginine it works fine too.
Re:Apache 2.x safe to use yet?
by
QuasiEvil
·
· Score: 2, Interesting
The only thing I remember was a problem relating to multiple includes of PHP scripts. The PHP people pointed at Apache, Apache people pointed at PHP. Something about apache filter vs. something-or-other, blah blah blah. Suffice to say they finally got things together a while back, and I run PHP 4.3.x on a handful of production servers (some with quite high load and mostly PHP pages) without issue.
I don't remember the exact details of the whole fiasco, but both sides racked up a black eye in my book. It was a very basic piece of functionality that they didn't seem to be moving too quickly to fix. It delayed my upgrade to A2 for about eight months and annoyed me every time I thought about it.
That said, PHP absolutely rocks. Fast, efficient, and concise. I just view it as improved C, which in my world (a world sans objects), is a very good thing.
Re:Apache 2.x safe to use yet?
by
shiflett
·
· Score: 4, 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?
by
mattdm
·
· Score: 2, Insightful
My understanding (and I don't actually use PHP, so maybe I'm out of date) is that with PHP 4.x, at least, it worked fine with the traditional fork-based Apache model, but br0ke with threads. (And for this reason, the threaded binary is installed at/usr/sbin/httpd.worker and/usr/sbin/httpd is the old-fashioned way on Red Hat's distro.)
Re:Apache 2.x safe to use yet?
by
Anonymous Coward
·
· Score: 0
I was at a conference where this question was asked, and I forget who answered it, but someone with a fair bit of insight. The response was basically, it works, but we don't have any volunteers to test everything and certify it thread safe, so no guarantees.
Re:Apache 2.x safe to use yet?
by
gabe
·
· Score: 2, Interesting
Re:Apache 2.x safe to use yet?
by
Electrum
·
· Score: 2, Interesting
I remember reading within the PHP docs about how unsafe it was to use the 2.x release branch of Apache with PHP...something to do with thread safety if I recall.
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 for PHP, and the reason the recently released Zend WinEnabler uses FastCGI.
I strongly recommend using the FastCGI interface to PHP, even under Apache. The FastCGI interface is much faster than mod_php4 under Zeus and will likely faster under Apache too. It has the advantages that you can control resource usage better (no bloated PHP environment in every Apache process), run PHP as a different user than the web server and even run PHP on a different machine than the web server.
FastCGI rocks. It is a shame that many things are written as Apache modules and not FastCGI. The trend of "compiling everything into the web server" is bad engineering.
Re:Apache 2.x safe to use yet?
by
gid
·
· Score: 1
I just view it as improved C
Here here, I've written some crazy stuff in php, a few daemons etc, that fork off into the background, listen on ports for incoming connections, etc. Fun stuff, it's easy as heck to program in and it's rock solid. I've had daemons up and running for at least a month a time, handling hundreds of thousands of socket connections over the time, and not a sign of any memory leaks, or at least nothing noticeable. The only reason the daemons don't stay up for long is because of deploying newer versions.
I wish more people would take php more seriously as a non-web scripting language. It's so much nicer than perl. I just wish php has support for calling threads. Maybe it does and I just haven't looked hard enough.
Keep the presentation and code SEPARATE, please!
by
Anonymous Coward
·
· Score: 1, Insightful
PHP5 is an excellent choice for prototyping because of the integration between display and function,
What the hell?! If you've been involved in any kind of app deployment followed by its maintenance (especially web apps), you'll know that keeping presentation and code separate is extremely desirable. Integration of these two is a weakness, if anything.
Having said that, PHP itself is no worse or better than say mod_perl in that regard. If you use a template library with PHP, you can accomplish some nice separation of presentation and code. But them mod_perl has excellent and mature template libraries also.
Once again, it's not about the language. Use a language you enjoy and then surround yourself with appropriate tools and libraries.
Speed: they're all "fast enough." All of these scale well enough that for most sites you won't care, and none of them really scale well enough to support something like cnn.com. [Read through the archives to get a feel for the pain/. has to go through to serve its audience, for instance. And/. isn't even THAT big.] No flame; just that all these options are low/middle end.
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,/. is a case in point. There's a reason/. doesn't upgrade to the latest & greatest very often.
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/. I know, but of these, ASP.NET is probably the best choice. If you want a toolkit/language that won't make site maintenance hell, OpenACS (tcl) or Zope (python) is probably a better bet. If you want something that will scale to absolutely huge levels (like the aforementioned CNN), J2EE is about the only game in town. (But a living hell to code for -- not recommended for smaller projects!)
Re:Here you go
by
perrin_harkins
·
· Score: 3, Insightful
All of these scale well enough that for most sites you won't care, and none of them really scale well enough to support something like cnn.com.[...]If you want something that will scale to absolutely huge levels (like the aforementioned CNN), J2EE is about the only game in town.
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 believe you are claiming that Tcl is more maintainable than Perl.
Mind you I do loath the language, and only learned it to do an interview there, and when I didn't get the job refused to touch that abomination ever again, but the point still stands that there are people doing large things in TCL
and none of them really scale well enough to support something like cnn.com.
Being that sites like CNN are mostly static content, couldn't mass replacation take care of that? In other words, have a "master" server, and replicate the content to all the other servers which are used to break up the work-load.
To some extent you can just throw more machines at the problem in many cases. It is a matter of weighing the effort to keep all the machines coordinated versus picking a faster language that scales better, but takes more programming time/effort. I wonder if the offshoring push will tilt things back toward efficient languages, since programming is getting cheaper.
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.
Some Perl fans will say otherwise. It is a matter of having a brain that fits perl. If perl-heads work things out with other perl-heads, then it is perfectly maintainable to them. The trick is to only hire people who actually like perl.
Re:Here you go
by
flocculent
·
· Score: 5, Informative
While I agree with the rest of your comments it's not really true to say that ASP/PHP/etc won't scale to the size of a site like cnn.com. They may not always be your best choice of language, but they do fit certain niches rather well. In general, for a website to scale well, the overall system/software design is much more important than choice of language/environment. (Though it's true that j2ee app servers give you a big headstart here)
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:Here you go
by
Anonymous Coward
·
· Score: 0
Ugh
I worked in TCL for a [short] while
Hated it so much I won't even use TCL/TK in Python
It was supposed to be an automated transaction processing system by the langauge encouraged such bad programming practices that the scripts were so carelessly written that they needed to have 24 developer call support for the frequent times the db (sleepycat...another product I won't touch) crashed and took out he scripts and frelled up the processing
None of these sites use the languages you specify for more than a small fraction of their pages. With the possible exception of TicketMaster, for which I'm not sure. (And in any case isn't in the same league as Yahoo and Amazon.)
TCL is far more maintainable than perl; you are obviously not very familiar with at least one of these languages.
Re:Here you go
by
Anonymous Coward
·
· Score: 0
If you use php for grabbing stuff from the database, you're a goner. You simply won't scale because it has no connection pooling mechanism.
I wouldn't lump ASP and Perl together. Especially since you can use Perl in ASP....
That said, comparing VBScript to Perl is like comparing Brainfuck to Smalltalk. VBScript is an unholy beast. It's like it was designed to make you do as much kludging as possible to get the simplest job done. It may just be my experience, but I enjoy programming in Perl. VBScript on the other hand, feels like building a house with a hacksaw and a hammer.
Re:Here you go
by
Anonymous Coward
·
· Score: 0
Javascript: poor fit for server-side use. Nobody does anything serious with it that way
A fair number of ASP sites are in Javascript. Like the old version of www.microsoft.com
Speed: they're all "fast enough." All of these scale well enough that for most sites you won't care, and none of them really scale well enough to support something like cnn.com.... If you want something that will scale to absolutely huge levels (like the aforementioned CNN), J2EE is about the only game in town.
That's simply not true. Many sites that deal with lots of traffic (adult sites, for example) use PHP. With a good web server (i.e. Zeus) and FastCGI PHP, you can scale very easily. Simply add more web servers or more PHP servers (FastCGI PHP can run on a different machine than the web server). A good load balancer like the Zeus Load Balancer could also help, especially if you need session affinity.
The bottleneck is often the database, not the web server or the web application. J2EE isn't going to magically solve this, but good design will. For example, if you are using MySQL, you might replicate the database and have all SELECT queries go to the slaves.
If you use php for grabbing stuff from the database, you're a goner. You simply won't scale because it has no connection pooling mechanism.
Connection pooling doesn't help if every PHP script hits the database since you will need a connection for every PHP process anyway. PHP allows for persistent connections.
If you are running PHP as an Apache module and end up with too many connections than your database can handle, then that's your fault. Either fix the Apache and database config, or switch to FastCGI (you will still need to configure it properly, but FastCGI greatly decreases the required number of PHP processes). You could have the exact same configuration error with connection pooling.
Javascript: poor fit for server-side use. Nobody does anything serious with it that way.
Actually, in a 'classic' ASP environment, server-side JavaScript (JScript) is a vastly superior option to VBScript. I have used it extensively in the past for small-to-medium sized corporate intranet apps at my job. You get identical access to the ASP, COM and Windows-scripting object models, and much better object-oriented support to boot. JavaScript is damn solid; I wish it had a server-side presence in the Unix world.
Plus, in a Windows environment JScript is probably the closest thing to PHP, in terms of syntax and relative complexity.
Unfortunately ASP.NET is a classic "leaky abstraction;" it tries to make things simple that sometimes aren't, and this will bite you.
Agreed completely. With this stated, I'm surprised you would rate ASP.NET the best choice. What you pointed out is a significant issue, especially when one relies on Visual Studio. Too many web developers don't understand how a lot of their code works; VS.NET takes that problem to a frightening new level.
If you want something that will scale to absolutely huge levels (like the aforementioned CNN), J2EE is about the only game in town. (But a living hell to code for -- not recommended for smaller projects!)
No argument.
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.
Totally disagree. Put *good* Perl programmers on a team, make them adhere to sane coding/documentation standards, and give them Mason or HTML::Template (depending on preference); you'll get maintainable site. The catch with Perl is that it punishes seat-of-pants code slinging more harshly than the other languages mentioned. I know it's a mantra around here, but you CAN write clear Perl code. (Disclaimer: I mostly use Perl nowadays.)
I really like Python, but I usually run back to Perl for CPAN and the quality/volume of the documentation available. I don't have enough real-world experience with it to fairly judge against the others. Ditto Tcl.
and none of them really scale well enough to support something like cnn.com.
I'm not sure if this is quite true. Neopets, the company I work for, has all our servers running PHP/Oracle/Linux. We do about 230 million page views a day, and every page is PHP with at least a couple of SQL queries. PHP seems to scale pretty well, unless you meant something else.
-- "Destroy science and religion. Science would re-emerge exactly the same; but not religion." - Penn Jillette, paraphrased
Re:Here you go
by
Anonymous Coward
·
· Score: 0
No, Amazon uses Perl quite a bit. While that link doesn't give you much of an idea (although they've been on that site for a couple years now), I interviewed with them and Perl (and C and Linux) was most definitely an asset. (Unfortunately I turned them down for a dot-com and the rest is a lot of self-kicking.) I also had friends that were CS students at Seattle University who did projects in Perl for Amazon while in school (they were pissed about having to learn Perl).
Amazon uses Perl. A lot.
Ticketmaster uses Perl a lot too, so much so that they sponsor mod_perl development and have hired one of the main mod_perl developers full-time. And in that link you'll see that citysearch.com also uses mod_perl exclusively. Salon.com uses Bricolage as its CMS, which is mod_perl-based. The Register uses Bricolage too.
So it's possible to write large-scale and maintanable Perl projects.
I abandoned PHP several years ago after having to deal with its many warts. It's not like you can't get things done in PHP, but it's often kludged and awkward.
If you want a toolkit/language that won't make site maintenance hell, OpenACS (tcl) or Zope (python) is probably a better bet.
I discovered Webware, which is an application server, framework and toolkit. It's python, but doesn't force an ideology on you (like Zope does). I've been using it for 3 years and I haven't looked back.
Before there was ASP or J2EE there was WebObjects (http://www.apple.com/webobjects). MVC, object relational mapping. It's a beautiful thing.
Now it's 100% Java and projects can be built in Eclipse with Ant (http://www.objectstyle.org/woproject). You can deploy to your favorite J2EE server or just use Apache (or even IIS:-p)
Scalability? It runs the iTunes music store.
Re:Here you go
by
Anonymous Coward
·
· Score: 0
...and you simply haven't red the PHP documentation very well.
I have friends who work for AOL. They do the hardcore stuff in C, and a lot of other stuff in Java. Tcl is used for certain large web properties of theirs, but certain not for "everything."
Perl is Amazon's main web development language now, and their last few stores (clothing, for one) are entirely perl. Yahoo uses lots of perl, python, and PHP. You can't always tell from their URLs, but they have discussed this at conferences. TicketMaster is all perl, and it is in the top three retailers on the web in terms of revenue (along with Amazon and Dell).
Re:Here you go
by
Anonymous Coward
·
· Score: 1, Interesting
Java is a statically typed language which makes using it for web apps _extremely_ verbose in comparison to the other languages here.
I'm really getting tired of seeing that particular bit of nonsense trotted out in every discussion here.
To set the record straight: STATIC TYPING HAS NOTHING TO DO WITH VERBOSITY.
Java is verbose, and Java is statically typed, but that does not mean that all statically typed languages are verbose, any more than it means that all statically typed languages are Java.
Consider Haskell, where the quicksort algorithm can, famously, be written in two lines of code:
qsort [] = [] qsort (x:xs) = qsort [e | e <- xs, e < x] ++ [x] ++ [e | e <- xs, e >= x]
Note the total absence of type declarations. In fact, this function will work on values of any type that can be sorted. And it's also completely statically typed.
Welcome to the world of modern programming, where convenience doesn't have to mean flinging safety to the winds.
I was on to post exactly the same thing. Programming php without using templates is not an unefficient solution, but quasi impossible practice.
It will lead to a complete disaster once redesign time has come.
The "good design" police... have fun with it!
by
turnstyle
·
· Score: 3, Interesting
For starters, I'd say that PHP is more a challenge to ASP than Perl.
(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.
This post is -5 Troll BUT:
by
Anonymous Coward
·
· Score: 0
Problem is, a lot of these +5 Insightful and +5 Interesting comments are coming out of the mouths of people who have played with one or both languages. Just because you were succesful in creating a shitty little web page in PHP and had trouble in Perl does not make you an expert (note: by you I don't mean parent poster.)
Not sure about speed. It seems fast enough for most stuff
I can testify that PHP (4.x) is fast enough for most situations where it'd typically be used (though I don't really know how well it'd do on a high-traffic server compared with other solutions). However: the interpreter feels pretty slow once you start handling megabytes of data at a time. For instance, I have a web app where the user can define file formats (defining how a few tens of things (different db columns) are taken from the columns of a tab-separated file) and then upload data to the database. Uploading, parsing and adding a ~10 MB file with 50000 lines (typical numbers, really) takes on the order of a few minutes. If I did it in C, the bottleneck would be the database and it would probably take 10 seconds or so instead.
In fact, I've resorted to running small C programs from PHP in some places just because PHP is too slow at that sort of thing. Serves me right for using the wrong tool for the job. And yet I'm pretty sure I've saved a lot of development time by choosing PHP over the alternatives (which mostly involved learning new stuff first) for that project.
--
This signature is not in the public domain.
Re:Speed (of PHP, that is)
by
MS_is_the_best
·
· Score: 1
In my experience if you load the file in an array and using only array functions (http://www.php.net/manual/en/ref.array.php), without using loops!!, parsing a 10 MB file and do something useful with it takes about 20-30 sec.
But yes, C is faster.
Re:Movable Type ain't written in PHP, fucko.
by
Anonymous Coward
·
· Score: 0
tone it down asshole, everybody makes mistakes (your mother made one when she made you)
testing?
by
Anonymous Coward
·
· Score: 0
If its a release candidate and "stable", shouldn't the testing already be done?
PHP Advocacy: presentation layer=application space
by
ubiquitin
·
· Score: 1
The upcoming release of PHP5 will create a wave of comparisons to Java. When that happens, remember that it isn't a zero sum game. The two languages work reasonably well side by side. There will come a point when the industry pundit ashclowns start repeating what you're about to read to the enterprise upper echelons. When that happens, it will get really interesting.
PHP has two primary strengths: architecture and standards. The majority of java webspace applications were written before css and xhtml were mainstream. 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. PHP handles "the presentation layer" meaning the application layer that actually integrates what's necessary for your browser to present a nice page (cross-platform, cross-browser) better than any tool out there. That's why Sun wanted to partner with PHP-creator-company Zend.
So architecture-wise, PHP is at the heart of the presentation layer. Standards-wise, PHP will help to bring about what CSS and XHTML promise.
Oracle is aware of PHP, IBM is aware of PHP, Macromedia is aware of PHP. Now the hiring managers get to start looking for PHP coders.
-- http://tinyurl.com/4ny52
Control vs. Abstraction
by
Eberlin
·
· Score: 4, Interesting
Having browsed only a few ASP.NET howtos but not having had the opportunity (or misery -- since this IS slashdot) to code in it, I'm not too familiar with ASP.NET
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.
Re:Control vs. Abstraction
by
skiflyer
·
· Score: 1
Or you can use the Pear library and add most of that abstraction to PHP.
Just as you can not use those libraries in ASP.NET (I assume you can just force it to output HTML code, no?)
My belief, abstraction is beautiful, when it's an option.
Re:Control vs. Abstraction
by
Anonymous Coward
·
· Score: 0
Yeah, I keep forgetting about the PEAR library. Haven't used it, actually, but I hear it's damn brilliant stuff. Between database abstraction (a bit like ADO), authentication, and this flexy template stuff, it's high-powered (yet standard) stuff.
Re:Control vs. Abstraction
by
enkafan
·
· Score: 1
I'm a little late to the party, but I just felt compared to clear up some points about ASP.NET. I still where my PHP t-shirt with pride, but I simply love ASP.NET now.
What you bring up about the validation code is pretty true. In fact, the built in.NET validators are known for not being friendly with non-IE browsers (go figure). I'd recommend checking out the DOM compliant.NET validation controls.
Also, nothing is really stopping someone from using the custom validator. All you do is specify the javascript validation logic, and a server-side function to be called to do the validation on the server too. Not too bad if the built in (compare, regular expession, etc) controls don't accomplish the task.
That being said.NET is still kinda an adventure. Getting some things like post backs to be XHTML compliant output just is too much trouble right now when using things like the post back mechinisms, so you'll find lots of web developers excited about ASP.NET 2.0 which hopefully will make XHTML output much easier.
Re:Control vs. Abstraction
by
Anonymous Coward
·
· Score: 0
Actually, I've had some level of success in implementing objects that have the ASP.NET form functions. The code undoubtedly looks nicer that way.
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.
By that argument, you're better off not trusting that close sourced language too. It could be possible that even a simple " if a = b " statement for validation has bugs too, you know.
Re:Control vs. Abstraction
by
Anonymous Coward
·
· Score: 0
>Actually, I've had some level of success in implementing objects that have the ASP.NET form functions.
In PHP.
running both php 4 and php5
by
ubiquitin
·
· Score: 3, Informative
For people who think there must be something better to write web-based applications than PHP, I invite you all to take a look at Seaside by Avi Bryant, a web framework available for Squeak and, I think, VisualWorks Smalltalk. It uses continuations to make programming a web application basically the same as coding a desktop application. It features many, many things that PHP cannot do.
Re:Seaside
by
Anonymous Coward
·
· Score: 0
Thanks, I haven't tried Seaside. I usually use either VisualWorks (Smalltalk) or Python for websites
PHP just to me looks syntactically like a C/C++ mixed with Perl/TCL/SomeOther$ObessedScriptingLanguage
PHP just to me looks syntactically like a C/C++ mixed with Perl/TCL/SomeOther$ObessedScriptingLanguage
Precisely. I love it.
PHP reminds me of what a CIS professor told me in college (tongue only slightly in cheek): There's only one thing you can't do with C that you can with other languages. Write legible code.
PHP may approach the definition of "write-only code", but its leniency in structure makes it very easy to throw a short script together quickly.
--
Sleep is just a poor substitute for caffeine, anyway. -Bob Lehmann
Re:Seaside
by
Anonymous Coward
·
· Score: 0
I would jump at the chance to program my web apps in this way. I live in hope someone will come up with a similar framework based around mod_python, but I'm not sure if python's continuations are quite good enough, or how well that or Seaside would scale.
Seaside would be all be fine and good if they only implemented it as an apache module rather than for some obscure Smalltalk-based webserver that nobody beyond a hobbyist with their own webserver is going to get a chance to use for real work. What are the chances of persuading a web host or the company you work for to install & use Seaside?
Re:Seaside
by
Anonymous Coward
·
· Score: 0
PHP may approach the definition of "write-only code", but its leniency in structure makes it very easy to throw a short script together quickly.
Which is why I use Python for small stuff like that. I can throw stuff together pretty quickly, but it has much cleaner readibility
Re:Seaside
by
Anonymous Coward
·
· Score: 0
Seaside would be all be fine and good if they only implemented it as an apache module rather than for some obscure Smalltalk-based webserver that nobody beyond a hobbyist with their own webserver is going to get a chance to use for real work
FWIW, for one hosted site I used my own Smalltalk web server but running on a different port, and then a small Python script running as a CGI to go from the host's Apache front end back to my server on the back. I asked them for permission to start a server on a different port, first
I hear this alot and I don't get it. I find PHP code very legible. In fact, I find every language that I have a good knowledge of to be quite legible.
Now if I have a lower level of knowledge of a language I often have trouble reading it, but that's usually because I didn't know that syntax X could be used to accomplish the task, I always used syntax Y. This happens to me alot in Perl, I can make it do alot, but since I'm not as familar with it, there are always ways I don't know to accomplish the tasks.
Of course this assumes the author is a somewhat reasonable individual, knows to use the proper control structures and the like.
So I genuinely ask, what is it about the syntax of this language that gets people? Is it too many curly braces or what?
Re:Seaside
by
Anonymous Coward
·
· Score: 0
So I genuinely ask, what is it about the syntax of this language that gets people? Is it too many curly braces or what
Well, one example is the use of $ in front of variable names. I find that such an artifact works very well for inlining text and data such as
"put the $thing down"
where $thing is a variable whose value gets substitued into the string.
However, as a program or script grows more complex, then the amount of that kind of coding tends to go down and you start doing much more manipulation of and logic of $thing itself, and lots of other objects and variables. So the density or propensity of lost of $ throughout the code goes up but the usefullness of a special character to indicate to the compiler that it's a variable goes down. The more complicated the code, the more noise in the code.
Python, for contrast, is a scripting language that doesn't use $ for variable names so it doesn't support inline string substituion like Perl, TCL, etc.. so it's not quite as succint for those tasks. On the other hand, a page full of complicated Python code has less visual noise then a page full of complicated Perl,TCL,PHP, so it's easier to read, maintain, debug. In that way it 'scales' better in how easier it is to deal with a more complicated problem set.
I've always thought that Perl worked much better as a glue between systems where it was taking the output of one system and feeding it to te input of another system (such as database->web server). But the more complicated the probelm grows, the more Perl has to *think* about what it's doing, the more the syntax becomes cumbersome. TCL and seemingly PHP share this at the syntactical level
PHP, like most languages, is Turing-complete; what exactly is there that it can't do, or that it can't be modified to do (since the source is available)?
-- "Destroy science and religion. Science would re-emerge exactly the same; but not religion." - Penn Jillette, paraphrased
I would jump at the chance to program my web apps in this way.
Ditto -- and I'm delighted to see others jumping first;-)
I live in hope someone will come up with a similar framework based around mod_python, but I'm not sure if python's continuations are quite good enough...
Seems likely. The meme is spreading, and it's funny how much sense continuations suddenly make when you consider the browser's "back" button and "open link in new window".
Here are some other languages and projects being discussed; note that (1) Python is mentioned as probably having good enough continuations, (2) You don't strictly need full continuations; Paul Graham metions this in his BBN talk about Viaweb.
That's a better question. But you can definitely do replication as long as your proxy server keeps session affinity (and since this is an easy-to-spot part of the URL, that's very doable). Also, one flavor of lisp (SISC?) can persist continuations to disk, so you could share them across servers.
Seaside would be all be fine and good if they only implemented it as an apache module rather than for some obscure Smalltalk-based webserver that nobody beyond a hobbyist with their own webserver is going to get a chance to use for real work.
Competitive advantage, baby. Wait, why am I posting this!?^U
Seriously, if they can build Viaweb and sell it to Yahoo (as Yahoo Stores) using a similar technique, I think you should be able to sell it to clients/bosses.
Re:Seaside
by
Anonymous Coward
·
· Score: 0
is that the one that caches *continuations* on disk?
*twitch*
that's just wrong... seems like one of those things that make you go "wow a cool mental model" and then it flops in reality.
Re:Seaside
by
Anonymous Coward
·
· Score: 0
Python doesn't have continuations. It's also kinda hard to square up the elegance of Smalltalk with the clumsiness of python in my mind...
Re:Seaside
by
Anonymous Coward
·
· Score: 0
[i]It's also kinda hard to square up the elegance of Smalltalk with the clumsiness of python in my mind...[/i]
Interesting take. I find Python pretty elegant compared to others in the same niche (Perl, TCL, PHP). While I love Smalltalk, I find Python works pretty well for the scripting domain stuff I do. *Anything* is a step down from Smalltalk, but Python's not as big a step as most
is that the one that caches *continuations* on disk?
No -- Seaside keeps the continuations in memory (just like lisp, ruby, python, perl6 [will], etc...). SISC Scheme and Kali Scheme are the ones that can persist continuations to disk. Or send them over the network to be invoked by a remote client. *bamf* ok, my brain just exploded.
For those of you who don't know PHP, just wait a version or two. It already supports VB, C, C++, Javascript and Perl style coding. Version 5 is basically Java. Expect Intercal, Unlambda, and BrainF*** support by version 7 or 8. If you know a Turing-complete language, chances are you'll be able to use it to code PHP by the end of the decade.
It sounds like they basically have added all the syntax and OO features of Java. I'm not sure whether that's cool or what...
It is kind of handy, but I'm finding it hard to shifting my thinking to using php for full OO applications like one would do with servlets/JSP. PHP is certainly easier to code in than JSP, so I guess this is good.
ALso a new engine and better object oriented database access will make things nice. You can fully seperate the presentation and application layers more as another posted noticed.
Its not complex like Java but at least you can scale it better which is the strength of object oriented programs.
PHP vs. Perl
by
transient
·
· Score: 4, Interesting
I swear I'm not trying to start a flamewar with this, so please respond appropriately.
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.
Re:PHP vs. Perl
by
The_DOD_player
·
· Score: 2, Insightful
First, the two languages are very similar, with PHP biased towards web-programming, mostly by the absense of particular libraries. But PHP is also emerging as a general purpose language. There has been some experiments to get a GTK capability to PHP.
But, if you already have a staff trained in perl, there's IMO not any real reason for you to switch to PHP.
I have, however, developed a preference for PHP, it has a simpler syntax, and better naming conventions. PHP has more text and perl have more meta-characters when defining arrays, doing string manipulation ect. PHP is simply more readable, to beginners at least. What is the point for example for an array to be prefixed by % or @ or $, depending on the context?
Well, how are you using Perl now? Are you coding mod_perl, using Mason, writing scripts that suck up template content from the file system and replacing tokens, putting HTML into your scripts...?
Without knowing how you work it's hard to give any decent advice.
Re:PHP vs. Perl
by
Gerner
·
· Score: 2, Informative
So my background is C, C++, and Java ( 10+ years ) and about three years ago I needed to start writing some web based applications. I tried both Perl and PHP and they both did the job. Eventually PHP won out for most all of my web development because it is so familiar to use for someone with my background. This is PHP's big win, it is easy to be very productive very quickly because the syntax is so familiar for a lot of developers. The available third party libraries and the online documentation alse keep developers productive.
My bet is that anyone who has never used either Perl or PHP will choose PHP, if they've already developed in one of the languages I mentioned above.
you manage the team. Isn't it -your- job to pick the best tool for the job?
I don't know either language well enough, but it seems obvious to me that a tool designed from the ground up to be a server side web app language must be better suited to some web apps than perl, which pretty much was designed to do damn near anything.
Re:PHP vs. Perl
by
claar
·
· Score: 4, Informative
Well, if you rose from the ranks, then you should be able to perform a simple test:
Think of a task that will take about 20 minutes to program
Program it in both Perl (use perldoc as another poster suggested) and PHP (use php.net/manual/en)
Wait 2 weeks
Attempt to add a simple feature to each script. Time yourself and compare
???
Profit!
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 is currently far superior to PEAR. If you need many special libraries, you may want to consider Perl.
[...]because the syntax is so familiar for a lot of developers.
That's my impression as well. A somewhat simplistic description of PHP 4's syntax is that it's similar to Perl, but is resembles 'C-like' syntax more than Perl does. A lack of things like implicit variables in PHP seems to make it a little easier to come back to a project months later or look at someone else's code and follow the program logic a little more easily than Perl is. (PHP 5 is adds syntax features that resemble Java more, as well).
PHP has a fair amount of strength in the text-handling area, similar to Perl, but PHP is a bit more 'focussed' on talking to network servers (database servers, webservers, network sockets, ftp servers...).
On the other hand, PEAR and PECL don't have nearly the mind-boggling breadth of add-on modules that Perl's CPAN does...
(As usual, I'm compelled to note that PHP is no longer 'just for web pages' any more than Perl is 'just for generating reports'. I've found it handy for a lot of small system administration tasks that Perl is also good for. You can even use Ncurses or GTK - or, conceivably, Java GUI classes to build standalone apps with it, if you feel the urge...)
Yes, it is my job to pick the best tool for the job. And in order to do so, I need to draw on all available resources. Slashdot is one of those resources. I can either mull over the languages on my own or I can ask a bunch of people who use them to offer their unique perspectives. Which do you think is a better decision-making process?
Which do you think is a better decision-making process?
Oh, I don't know... how about picking a project manager in the first place who is familiar enough with the technology to make an informed decision about it?
I don't think anyone should consider any language over another unless the decision is about the task at hand. PHP has it's place, and so does Perl. PHP is great for small - medium sized websites that you want to develop fast and use a database to a reasonable degree with. Perl is great for building that too; however, I think using a scripting language that's designed for the web would likely be a better choice.
Now, if you wanted to build an enterprise level application, I would tell you to dump both of those in favour of Java Servlets/JSPs or ASP.NET. I get really tired of hearing people talk about this language over that language. They all have their benefits, and their places. I wouldn't build a GTK+ app in PHP, and I wouldn't build a website with C++ CGI software. Don't choose a "default" programming language for all tasks, choose a language for the task at hand. I think that's the best way to approach it.
-- "It's here, but no one wants it."
- The Sugar Speaker
Not to mention the command line interface php added. It makes it similar but not as powerful as perl's CLI. Also running cronjobs is much more straightforward than fetching a webpage each time.
I'd say this comes down to using the right tool for each job. I learned perl well before PHP and resisted using php for a while. Didn't consider it a real programming language, and didn't want to waste time learning a language that was so one-sided (web scripting).
But I was put in a pinch when a clients web host wouldnt let me install perl's dbd::mysql. So used php for the job, saw how few lines were necessary for quick little DB queries and dynamic content, and haven't looked back for jobs like that.
That said, I still think perl is a superior language. It's much more well-rounded. Great for text manipulation and command line jobs. Also, better for larger application development.
With some thought the seperation of presentation and logic can be achieved using PHP. I have done just that - I have developed in PHP a set of libraries and a framework for seperating design, the presentation layer and business objects - this is not some toy code; I am using this extensively on multiple websites on the net.
The framework which I call PFC (short for Php form classes) that I have developed draws inspiration for ASP.NET and FunFormkit libraries (Python) to achieve this layered seperation.
The framework supports multiple fields types, chained validations with multi-language validation error reporting, compound fields...and can be easily customized (within an hour or two) to support specialized user agents such as browsers running on cellphones..
I am in the process of determining how to open source the code - but right now I need the money.
Apache 2.x MPM is safe with PHP 4.3.x
by
dananderson
·
· Score: 2, Informative
Apache 2.x is safe if you use the MPM (process) model, not the thread model. The problem isn't PHP, but multiple underlying libraries used by PHP. YMMV.
Don't use PHP 5.x yet for production. Wait until it's released (at least), or a few months after the initial release.
Re:Apache 2.x MPM is safe with PHP 4.3.x
by
ergonal
·
· Score: 2, Interesting
Here's what Rasmus said 6 days ago in a bug report:
We are not talking about just Apache2 here. We are talking about Apache2+an MPM+PHP+3rd Party Libs. The folks at apache.org are only concerned with Apache2 itself, and for serving up static files it is better than Apache1 in many respects. However we have to worry about a lot more stuff here. In fact, we couldn't care less about serving up static files. The main issues as I see them are: <p> 1. Thread safety issues. - It is very difficult to track down threading problems and we don't have decent tools to help us.</blockquote> - The thread safety of many 3rd party libraries are unknown quantities and can depend on the OS, libc and even compile flags. - Many distributions seem to ship with the Worker MPM as the default and that is the MPM that gets the most attention. This is a hybrid multi-process, multi-threaded MPM.
2. You can eliminate the threading problem by running the prefork MPM which effectively makes Apache2 behave just like Apache1 in the way it forks processes and serves one request at a time per process. Issues here: - Apache2 itself is rather fringe still. It has approximately a 5% marketshare vs. 65% for Apache1 at the time of this and out of that I would guess the majority are running the Worker MPM. So we are talking about a fringe MPM in a fringe server. This means it has not had anywhere near the attention from people running large production web server farms that it needs for me to comfortably say that this is a solid piece of code with all the kinks worked out. - The benefits of moving to Apache2+prefork are questionable. The new filter API would be one of the benefits, but it still has some issues and by default we run PHP as a handler, not a filter currently. You can optionally run it as a filter but people have had problems with that.
Until such a time when enough clueful PHP people think there are enough realworld useful features in Apache2-prefork or even Apache2-threaded to actually sit down and bang away at PHP and the majority of the PHP extensions under Apache2. Or if enough regular users report back that they tried it and had absolutely no problems then we will change our reccomendation, but for the time being I don't think that we in good faith can tell users that Apache2+PHP is something they should be putting into production.
Did you test PHP5 or have a wine tasting?!
by
Anonymous Coward
·
· Score: 5, Funny
A test run of our PHP setup on PHP5 RC1 seems to be more responsive and crisp than it was on PHP4.
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?
I aggree with you, XML/XSLT/CSS is the best approach. Also use AxKit to get backward compability!!!
Cold Fusion MX?
by
Anonymous Coward
·
· Score: 0
Hi,
Anyone have thoughts on Cold Fusion vs php? Is it worthwhile to move from COld Fusion to PHP (other then Cold Fusion is dieing).
Thanks!
Re:Cold Fusion MX?
by
togofspookware
·
· Score: 0, Troll
No. PHP sucks just as much. Just in a different way. If you want to move to something else, try mod_perl. I switched from PHP a while ago and am happier, now.
-- Duct tape, XML, democracy: Not doing the job? Use more.
I started coding apps for the web in CF back around v4, when I was still a student. I've been primarily developing in PHP (with Perl, ASP, and C) for a few years now, and rarely touch CF code (I have two fairly inactive clients that have CF-based apps that I support).
I prefer PHP because it's C-like (which was used in most of my college coursework), and because it's Free.
CF is interesting, as the syntax and structure make you think in a non-c-like sort of fashion. I'm too drunk to think of an example, but I developed some very strange patterns in CF, which was fun. Not nearly as different as functional programming in Lisp, mind you, but "different"
In the end, I'd start playing with PHP. There are several good reasons:
It's Free.
It's free (as in beer). You can get pretty cheap hosting
No. PHP sucks just as much. Just in a different way. If you want to move to something else, try mod_perl. I switched from PHP a while ago and am happier, now.
I have written many large applications in PHP and for several years it was my overwhelming language of choice. I switched to Cold Fusion MX when it came out a couple years ago and couldn't be happier. It's definitely a big switch from the C-like syntax of PHP and in the beginning I missed it...I guess it's like that with any language change. You yearn for what is most familiar and comfortable. But the very important and main reason I like CF is it's Java underpinnings. Granted it's not free and there aren't as many good free CF libraries to use, but you can use java libraries and the J2EE capabilities of CF are pretty wonderful. It's like having the development speed of PHP with the power of a full blown, certified J2EE server. I have run into a few small problems, most notiably, difficulty consuming web services that require complex variables but because of the Java base, I was able to write the component in Java and pull it seamlessly into CF as a Java custom tag. Best language ever!
-- I know this is./ and CF is not on the list of "things we like", but c'mon...cut me a break...it really is just Java. And we like Java, right?
Speed along is one thing. I used to use Perl and even compiled perl, until I tried PHP and was blown away by the speed-up of my apps. Perl is nice because of it's regular expressions and such... but PHP has all that and more.
Benchmarks, including ones published by Yahoo, show that mod_perl is typically faster than mod_php. You were probably comparing Perl running as a CGI to PHP running inside the server.
reminds me of webobjects
by
rm+-rf+/etc/*
·
· Score: 1
WebObjects was a similar type deal, only it had a graphical GUI builder. Programming web apps with WebObjects was pretty much identical to desktop apps, with the addition of some new objects for web based functionality. Objective-C is also quite similar to smalltalk. It was a really cool dev environment, unfortunately apple price it was out of reach for too long and never got around to actually trying to market it...
Re:reminds me of webobjects
by
bnenning
·
· Score: 1
It was a really cool dev environment, unfortunately apple price it was out of reach for too long and never got around to actually trying to market it...
No need for the past tense; it's alive and kicking. Unfortunately you're right about the lack of marketing.
-- How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
Re:reminds me of webobjects
by
Anonymous Coward
·
· Score: 0
VisualWorks also has VisualWave which lets you use their normal Canvas Builder GUI designer to do your UI except it serves the UI as HTML.
Re:Power Power Power [where's my perl!?!]
by
MooCows
·
· Score: 1
Why is this 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.
And does Perl have a 'strong central theme' ? Note: I don't particularly like PHP nor Perl, but if there's any language that's built for everything and then some, it's Perl.
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.
There's a good reason why most sensible stable package trees don't release every latest-and-greatest version, and instead opt to patch vulnerabilities on current 'stable' versions.
So yes, while I don't like the whole inline system, I consider PHP pretty safe to use.
--
The path I walk alone is endlessly long.
30 minutes by bike, 15 by bus.
I'm mostly of that opinion as well. The author of bTemplate wrote an essay on using PHP as its own template engine. That said, I actually prefer to use Smarty since I do coding and design for our intranet. I've found it easier to switch hats when I have to switch syntax as well.
You got to be kidding. 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 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.
--
"I think this line is mostly filler"
Get to know PHP5
by
gabe
·
· Score: 3, Informative
If you're wanting to learn about all the wonderful new features in PHP5, then grab this book. It covers more advanced topics (hence the name Advanced PHP Programming) but it's an absolute must for serious PHP developers. If you're a beginner, learn PHP in general first, then grab that book.
All right, i have never used either, but would like someone to summarize what are these 3 languages about.
Perl syntax is obscure and complicated, php seems to be only used for small pages, and asp, well i haven't seen much people talk about it especially here, but i do see it getting used in big sites.
Also, there is jsp/servlets.
I am one of the guys that think that everything has it uses and that there are things in which a tool excels at. So can one explain me what would be a proper use for all these technologies?
Re:PHP vs ASP vs Perl
by
Anonymous Coward
·
· Score: 0
For 90% of projects, any will suffice. It comes down to what you know and what you need to do.
Perl has the benefit of being reasonably speedy and has a wealth of modules available.
PHP has the advantage of having an easy to learn c like syntax, now with a complete java like OO interface.
ASP, I dunno, that runs on that other OS.
JSP has huge advantages when you have a large number of developers, or you need an application to seriously scale, mostly for serious enterprise applications (think worldwide billing system for multi-national stock brokerage or something).
PHP is definatly not only used for small pages, it scales quite well and I think is taking steps in the JSP direction. Honestly php is a better choice than JSP for all but the most demanding enterprise apps because it offers most of the advantages of JSP with easier development.
Re:PHP vs ASP vs Perl
by
Anonymous Coward
·
· Score: 0
Perl: if you need to ask this then you should use as I do: quick hack scripts 10-20 lines at most to process text files. Don't use for web.
PHP: use if you like quick hacks. For small-medium projects.
Jsp/Servlets: More strict, more enterprise features, more power, more providers, more choices, more verbose. Use for medium-large projects. May get in the way if you are in the quick hack line of development, but if you accept to exchange a little more typing for more clear code it may be for you.
ASP: use if you do only Microsoft and like to have an easy to use IDE. The language is VBscript so it's not very featured or powerfull, but is legible.
Perl's grammar is too big
by
SnatMandu
·
· Score: 4, Interesting
PHP has a smaller syntactical (is that a word?) footprint. As you said that you manage a development team, this is important. The Perl motto of "There's more than one way to do it" becomes an issue when you've got multiple developers working on the same codebase. You can write and (attempt to) enforce code style rules in your organization, which mitigates this a little bit, but it takes time to write those guidelines, get buy-in, and enforce.
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
by
Ender+Ryan
·
· Score: 1, Insightful
Oh please... Perl's syntactical footprint isn't nearly that bad. Surely any competent programmer woudn't have a difficult time. Christ, perldoc comes with perl and is arguably the most useful language documentation that exists. Don't understand a bit of syntax, if you're using perl, you've got a huge reference right there.
As for PHP, it's an awful language. There are entirely too many core functions that all do way too similar things. How many regular expression functions are there, and separate functions for case (in)sensitivity? What the fuck were they thinking? Worse yet, they don't seem to follow any naming conventions for their functions. Sometimes words are separated by underscore, sometimes not. Some functions use a similar naming convention for case sensitivity, sometimes not.
PHP looks as if it was designed by beginning Perl programmers who hadn't even finished reading Learning Perl... You know the kind; they use all global variables, create libraries that pollute your namespace, mix logic and presentation, etc.
Meh, to each his own I guess.
-- Sticking feathers up your butt does not make you a chicken - Tyler Durden
Re:Perl's grammar is too big
by
SnatMandu
·
· Score: 4, Interesting
Most of your criticisms of PHP are totally on the money.
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 (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:Perl's grammar is too big
by
Anonymous Coward
·
· Score: 2, Interesting
Here's an example of what the parent poster was talking about:
ereg()/ereg_replace()
eregi()/eregi_replace()
split()/spliti()
C'mon! Just make the "i" part another argument! Sheesh!
Some functions are split with underscores (mysql_connect, ereg_replace, file_exists()) others are just mashed together words (fgetcsv(), all standard POSIX calls, etc.). It's polluted with dozens, if not hundreds, of in-core functions!
Perl, on the other hand, derives its real strength from libraries (CPAN!). Like Java, C++, Python or any other language.
Which is harder? Learning hundreds of built in functions or figuring out a library? Dunno, hard to say, but libraries seem a lot more popular than throwing hundreds of core functions into a language.
Documentation? Sure, you have www.php.net/[function], I've got "perldoc -f [function]". I don't need net access to do a quick lookup. Not to mention all module documentation is available through perldoc on the commandline as well.
And if you have a problem with unreadable, unmaintable code, fire the programmer and get someone who can stick to coding standards, comment their code, and keep the cutesy one-liner hacks out of their code.
Give any group of 4-12 developers a big project, and they'll create chaos if you don't have them stick to coding standards. Especially if they don't know the language inside and out - Perl OR PHP!
Re:Perl's grammar is too big
by
hattmoward
·
· Score: 1
You're far underestimating an experienced perl programmer, who is smart enough to know about the tradeoff between tersity and readability. The short, unreadable syntax is meant for when you're doing those one-off scripts, or using perl like an old unix guy uses awk. As usual, the onus is on the programmer. Have you visited Perl Monks? We try to thelp perl developers create maintainable and descriptive code. Any experienced developer who creates really complex code in a project will at least put an explanation in the comments. Think about it: the same person who trys to look good (all developers are prima donnas:) by using unreadable perl code, is probably also mixing business logic with presentation in their PHP apps too. If you visit my home page or google my user name, you'll see my favorite.
My personal opinion (Flame on!): I am also unconfortable with the number of builtin functions, especially with extensions added. I feel PHP needs to focus more on quality, and less on features, and needs to support real namespaces, not just what's in the new OO system. Does PHP have a good, high-quality templating system bundled yet? I think it would be in their best interests, considering the web is its largest use.
Re:Perl's grammar is too big
by
consumer
·
· Score: 1
You consider PHP more maintainable? What about the lack of namespaces for variables and functions? That's a real problem for use in teams. There are other interesting issues raised in this article.
Re:Perl's grammar is too big
by
Saeed+al-Sahaf
·
· Score: 1
The short, unreadable syntax is meant for when you're doing those one-off scripts, or using perl like an old unix guy uses awk. As usual, the onus is on the programmer.
Many of those one-off scripts end up with lengthy lives all their own. PHP has a long way to go in many areas (namespaces, library vs. core functions) but many of the old arguments are just out of date. Also, Perl has a bad rep for ugly unreadable code because a significant number of Perl programmers write ugly unreadable code.
Does PHP have a good, high-quality templating system bundled yet?
-- "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
Re:Perl's grammar is too big
by
Anonymous Coward
·
· Score: 0
In the interest of open discussion, would any PHP developers like to refute any of the ideas put forth in this document: Experiences of Using PHP in Large Websites
I have a lot of gripes with PHP, and I imagine there are more to be had. However, this article contains none of them. It builds up some poorly constructed straw men then tears them down while gloating that Perl's better.
This shit really is getting to be like the whole BSD/Linux thing. If you don't like PHP, then for fuck's sake, don't use it, but how about spending more time building apps in the language of your choice and less time claiming that I can't do the things I do every day in mine? Christ, it's pathetic.
Re:Perl's grammar is too big
by
Bromrrrrr
·
· Score: 1
Yes, gladly, any and all. But in the interest of keeping comments brief (as opposed to the document) would you like to name one you wish refuted?
--
What a rotten party, have we run out of beer or something?
Re:Perl's grammar is too big
by
Bromrrrrr
·
· Score: 1
Try to think for yourself and read the article again!
--
What a rotten party, have we run out of beer or something?
Perl and even better?
by
xot
·
· Score: 0, Redundant
The thing i like about PHP is that it derives a lot from a lot of scripting and programming languages.
Wonder whats new about PHP5 though that will help the average web scripter....? The changelog doesnt show anything sensational.
-- Lord of the Binges.
Re:Perl and even better?
by
C_Kode
·
· Score: 2, Informative
Most of our company's web applications are written in PHP, but that isn't where php has the heaviest use in our company. I have the CGI version of it installed on all of our Windows servers, and use it as the *shell scripting language* for our Windows boxes. It's like batch files that can use complexed logic, network protocols, database connectivity, and best of all. It's absolute ease of use. It has made alot of my Windows jobs a breeze to automation and manage.
Re:Perl and even better?
by
TheInternet
·
· Score: 1
Wonder whats new about PHP5 though that will help the average web scripter....
I haven't kept real close tabs on PHP recently, but I think the most significant change is that the object model is vastly improved. I get the impression this is at least partially an adaption to the Java-centric market.
Perl is the Mother of PHP
by
Anonymous Coward
·
· Score: 0
The first version of PHP was written in Perl. PHP is an ASP/JSP-like Perl spinoff. PHP-like functionality is just one of the many things Perl does. Perl is the Mother of PHP.
Re:Power Power Power [where's my perl!?!]
by
Telastyn
·
· Score: 1
Oh, Perl doesn't. But my PHP Lotus Notes client says neither does PHP...
Except PHP hasn't had an unexploited release in *3 major revisions* now to my knowledge. [ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/w ww/php4/README.html has a good listing of the various remote code execution exploits over the years...] It's not about using bleeding edge code, it's that the stuff has been patched upon patched upon patched, and it's not worth the headache to keep patching the damned software.
Heh... this scintillating commentary comes to us from someone whose site is hosted on Geocities.
-- It's not my fault! It was this way when I got here.
Re:Power Power Power [where's my perl!?!]
by
NewWaveNet
·
· Score: 1
That's interesting because it's only insecure as you make it. If one loads any base package up with a dirty mix of extensions which are never utilized and put no real thought into the PHP installation...well, that leaves tons of room for problems. Any extensible language is at the whim of the packages beyond the host.
Re:Faith based programming...
by
Anonymous Coward
·
· Score: 0
I don't know, but possibly, The Kernel, occasionally known as Linux, works so well that we don't need Yet Another Case Of Open Source Effort Duplication (YACOOSED) (tm).
PHP could easily stand YACOOSED of being such. We need it about as bad as Groovy.
Thanks for fragmenting efforts, y'all. BeelzeBill loves you.
Yeah, that's my other website. Geocities doesn't support any server-side scripting at all, AFAIK. Fortunately, the one hosting togos.dhs.org also supports mod_perl, so I'm not completely screwed:)
-- Duct tape, XML, democracy: Not doing the job? Use more.
Finally clause
by
BlueLabel
·
· Score: 4, Interesting
I used to be a PHP developer, but switched to python-based content management systems due to the elegance and ease of programming in python. However, I was interested to see how PHP had progressed since the last version, and read the article linked by Slashdot.
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?
In the changelog for PHP, it is suggested that all exceptions _must_ inherit from a base 'Exception' class
Hmmmm....
"Even though the above example shows that it is possible to define exception classes that don't inherit from Exception it is best to do so. This is because the internal Exception class can gather a lot of information otherwise not available."
* Changed exceptions so that they must now inherit from the built-in
Exception class. This allows for a general catch(Exception $e) statement
to catch all exceptions. (Andi, Zeev)
Re:Keep the presentation and code SEPARATE, please
by
Safety+Cap
·
· Score: 1, Interesting
If you've been involved in any kind of app deployment followed by its maintenance (especially web apps), you'll know that keeping presentation and code separate is extremely desirable. Integration of these two is a weakness, if anything.
Script kiddie programmers fail to understand this lesson, which is why PHP/MySQL shitsites are a bear to maintain (that, and tryting to normalize these databases is a laughable exercise, at best).
Hell, just try porting a P/M site to a nice DB so you can push more of the data manipulation functionality to the DB layer where it belongs and you're in for a real tear-jerker. My main frustrations with OSS is that most of the work is done 1) where the work is easier, 2) where most people (unwashed masses) congregate, and 3) with little regard to lessons learned and best practices.
Hehe, guess that didn't work so well... Trying again:
<?="This is <b>great</b> news!"?>
And if this doesn't work, I'm going to apply for a job in management.
Re:just too bad
by
SnatMandu
·
· Score: 2, Informative
References work well enough. Show me where you've been constrained.
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.
The upcoming release of PHP5 will create a wave of comparisons to Java. When that happens, remember that it isn't a zero sum game. The two languages work reasonably well side by side.
One apparently-little-used feature I've been wanting to play with lately is the PHP/Java integration. I've been assuming that PHP5 will be more conducive to this.
I've never QUITE managed to get this working on PHP 4 (though since I don't have any specific reason to use it other than 'I want to play with it', I haven't put all that much time into it, either.). Anybody tried this on PHP5 yet? Or know of a fairly thorough explanation of getting it installed and configured?
Re:Cool! BUT does it run
by
Anonymous Coward
·
· Score: 0
More importantly, is it stable under Apache 2?
XML/XSLT for humans?
by
phutureboy
·
· Score: 3, Insightful
OK, I tried using XML & XSLT under PHP a couple years ago, for the CMS system which is linked in my.sig. It was one of the most frustrating experiences of my life.
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/. will quickly point that out:)
Re:XML/XSLT for humans?
by
Anonymous Coward
·
· Score: 0
I don't know if you're a dubmass, but XSLT isn't as hard as that.
I usually say that people should learn to do transformations in their browser (there's a tag you can put at the top of an xml file to reference an XSLT file). Then it's just save XSLT and refresh the browser.
It's not particularly complicated when you realise it's not a general-purpose programming language -- that it's just about matching tags and replacing them.
BTW, for reference, try dpawson.co.uk 's xslt faq
Re:XML/XSLT for humans?
by
prockcore
·
· Score: 2, Informative
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.
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. (It does a lot more, including fetching index pages and building xml search results, both of which have their own XSLTs to be applied)
We then have a PHP front end which basically calls the apache module and then passes the output to the end user.
It is extremely fast, and it makes it very easy to provide multiple versions of a story (HTML, RSS, PDA, WML, Email, and printer friendly version).
In fact, the database is still the slowest piece of the puzzle.
XSLT takes some time to learn, but it's not that hard, and the results are amazing.
Re:XML/XSLT for humans?
by
trianglecat
·
· Score: 2, Informative
Well... XMLSPY is one choice. The enterprise edition comes with "Sylesheet Designer" (which has since been renamed "stylevision" me thinks) in the last update. It is supposed to be a WYSIWYG editor which includes tags to your xml schema. My experience is with stylesheet designer...its buggy, it takes lots of tweaking, but again its a helluva lot better than doing it by hand.
Connection pooling ?
by
vlad_petric
·
· Score: 4, Insightful
All the OO features are nice, but what's really missing in PHP are some critical "enteprise" features, like true connection pooling (and no, pconnect doesn't count).
--
The Raven
Re:Connection pooling ?
by
TheInternet
·
· Score: 1
All the OO features are nice, but what's really missing in PHP are some critical "enteprise" features, like true connection pooling (and no, pconnect doesn't count)
I don't know offhand, but I wonder if any of the Zend stuff does that kind of thing.
Death throes my ass. Have you seen the traffic on comp.lang.perl.misc? Have you seen the perlmonks website? Have you seen the journals and publications (both online and offline) that deal with Perl? Have you seen the new Perl books that come out every year? Have you checked out CPAN lately? It seems to keep on growing and growing... And let's not forget the Activestate folks (the main Win32 Perl distro) who still find it worthwhile to support Perl and sell related development tools. Yeah, none of this would happen if Perl was have "death throes". If you like PHP, fine, use PHP. No need to lie or troll or act like a jackass.
Stable my ass!
by
krumms
·
· Score: 4, Informative
I reported a showstopper bug two days ago that crashed Apache 2 hard.
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.
Sys Admin stuff with PHP? Really?
by
walterbyrd
·
· Score: 1
I have never known anybody to use PHP to do sys admin stuff. Is it really commonly done? In not, why not?
Re:Sys Admin stuff with PHP? Really?
by
C_Kode
·
· Score: 1
I do. Mainly on my Windows servers to replicate shell scripting of *nix boxes. Just install php, and add php's CLI executable to your PATH. Write your scripts, and just prepend "php" to the beginning of the script:) You know like that old filthy "runcbl" of Slowbol err Cobol;)
Re:Sys Admin stuff with PHP? Really?
by
ZenBased
·
· Score: 1
i do it from time to time on a linux box. it handles a lot of users and their websites and the php scripts handle website/mysql related things for me (CLI/crontab). Works great.
-- http://www.virtualconcepts.nl/
Re:Sys Admin stuff with PHP? Really?
by
solidox
·
· Score: 2, Interesting
i got a few php scripts on a cronjob to do database backups and such things. i also use it for quick admin type hackie scripts. personally i recon it's far superior to bash/perl/etc for shell scripting
--
Re:Sys Admin stuff with PHP? Really?
by
mdfst13
·
· Score: 1
PHP outputs web pages. If that's what you want, great. If not, then why use it? There are plenty of languages that just run and don't bother to produce output unless requested (*shell, Perl, C, Java, etc.).
I tried using PHP from the command line to do some database manipulation because I had never worked with the Perl MySQL libs. I played with it for a while and then took a day to figure out the Perl syntax instead. No extraneous output (e.g. <html><head>junk</head><body>mor e junk</body></html>) that way.
Re:Sys Admin stuff with PHP? Really?
by
destiny_uk
·
· Score: 0
PHP outputs whatever you tell it to. Not webpages. Unless you, er, tell it to.
I use it to send SMS messages from the cli in a cron job. Easy to write, and a lot of decent libraries.
This is stupid
by
Anonymous Coward
·
· Score: 0
You're both full of shit. And the moderators are on crack.
I understand what you're saying, but I feel that you're wrong. Case in point, I am certainly not a hard-core perl programmer. I've been using perl for about 7 years, so I know the language well, but I haven't had difficulty maintaining other peoples' code for a long time. I have more trouble with say, C or C++. Sure, you can write some ugly one-liners in Perl, but I rarely see production code that is too difficult to figure out.
It's all about good coding practice. You can even write maintainable code in that nasty language people call PHP:)
Like I said though, to each his own. Some people worry that PHP is "killing" Perl, and other ridiculous nonsense... Frankly, there's more than enough room for both, and plenty more too.
I'm not religious though; if someone paid me to write PHP, I'd write PHP. But I won't touch VB though, that's the devil.
Heh, if you want to feel better about the language you have to use, just compare it to VB; "Well, at least I'm not writing this in VB..."
-- Sticking feathers up your butt does not make you a chicken - Tyler Durden
Re:PHP for Web Perl to replace shell scripts
by
acomj
·
· Score: 1
I use both perl and php. My motto, choose the tool based on the job you need to do.
PHP in my mind works much much better than perl for web sites. The syntax is neater, its really easy to template a site in php.
That being said the scripts that I run to prep my photo library for the web run perl from the command line. Shell scripting is way too limiting and perl is fairly cross platform and php doesn't really work as a scripting language.
either way lots of comments in code make it better..
Re:Power Power Power [where's my perl!?!]
by
Anonymous Coward
·
· Score: 0
That's what I used to think.. then I tried writing a medium-sized app in Perl.
YOW!
Just having to deal with arrays v. array refs, undef v. empty arrays, perl's strong typing with numbers v. strings.. I nearly went insane.. the app was always on the verge of being impossible to understand.
I have since switched to PHP, written in a java-like style (objects, etc), and keep perl for the quick hacks.
Perl just doesn't scale, and PHP is getting better every day.
I see lots of people starting to grumble about Perl and moving to other languages.
the best php template engine around
by
SailFly
·
· Score: 1
I know this is only slightly related...but while looking at improvements with PHP, check out this powerful template engine written in PHP: Smarty.php.net now at version 2.6.2 with improved cache ability.
Agreed, that's what MVC and MVC2 are for
by
Anonymous Coward
·
· Score: 0
Too bad lots of PHP/Mysql coders never heard about them. And if I had to make a site site fast, easy to maintain and with good code/presentation separation, I'd go with Java servlets and Apache Velocity. And probably some kind of framework too.
--Coder
SOAP support?
by
Anonymous Coward
·
· Score: 0
The SOAP/Web Services support is pretty week, not well documented, hardly any examples.
PHP5 had namespace-support at one point in the development cycle. It was later dropped, dunno why.
How are java web apps hell to code?
by
Anonymous Coward
·
· Score: 0
I've coded java web applications for several years now, and I ENJOYED it. I personally HATE weak typed languages- maybe I could get used to them, but I make too many bugs that could be avoided by compilation/type checking that is lacking in PHP.
If you stay away from the 'advanced' j2ee stuff, like EJB and other crap, web applications are a breeze, and FAST. Personally, I prefer using templates (like Apache Velocity) to JSP. And noone in his right mind would make JSP-only web site. There are some web application frameworks that make job even easier.
By doing this this you get very good code/design serparation (cheap maintenance), all the advantages of OOD/OOP. And a strong typed language.
--Coder
PHP's libraries and OOP
by
Anonymous Coward
·
· Score: 1, Interesting
I'll look at PHP again when its massive function library is refactored into functions.
There should be no need to write:
$arr = array(); array_push($arr, 42);
When it could be:
$arr = new Array; $arr->push(42);
Re:PHP's libraries and OOP
by
solidox
·
· Score: 1
OO is not the be all and end all of software design. For very simple (i.e. linear) scripts OO adds unnecessary complexity and distracts the maintainer from the actual purpose of the script. As another poster has pointed out - it is possible to do what you want on one unambiguous line, as either:
$arr[] = 42;
$arr = array ( 42 );
Obviously if you're writing a complex system - use a more sophisticated design method (and another language). But for quick and simple scripts the functional approach both works, and is more obvious to non-expert programmers.
Huh? PHP doesn't enforce (X)HTML or CSS correctness. As far as PHP is concerned, all you have is a sequence of bytes. (Not even Unicode characters!!!) PHP spaghetti code is used for generating tag soup all over.
Also, PHP-driven sites usually don't use MVC but have an intertwined mess of presentation and app logic.
OTOH, non-JSP Java solutions such as XMLC actually enforce some stardard constraints.
And don't tell me to turn them off in my configuration file.
Then turn them off in your.htaccess . If that's also not an option, you can still turn them off with a PHP command that you could include at the beginning of every script.
PHP is becoming like Windows...
by
Diplo
·
· Score: 1
The fact there are many different templating engines for PHP nicely illustrates PHPs major weakness - it's become a sprawling, bloated mess of a language that has no properly defined standards and no clear structure.
Every time I look at the PHP manual there seems to be 20 new (inconstantly named) functions, 3 new beta libraries and 5 subtle changes to the syntax (that will bite you later on). Instead of having one clear set of standards that people can learn and adhere to you have dozens, making integrating other peoples' code a nightmare.
PHP is becoming like Windows - more and more functionality is being bolted on whilst trying to maintain backwards compatability and the end result is a complete mess. It needs re-thinking and re-writing from scratch.
Re:PHP is becoming like Windows...
by
loginx
·
· Score: 1
Right... this is probably why a search for "perl template engine" in google returns 98,000 results...
The reason why there are so many template engines available for PHP is because they are all different in their own way and there is a need for variety.
I would be pretty pissed off if PHP only had one single template engine available.
Also, for the functions available in PHP, if really you can't handle too many functions, maybe it's time for you to get back to write your apps in assembly... there's a LOT less instructions there...
Re:PHP is becoming like Windows...
by
Diplo
·
· Score: 1
There's nothing wrong with lots of functions per se if they are consistantly named and logically organised (within namespaces or classes, for example). However, in PHP there is no internal organisation of functions whatsoever, only that which the manual decides.
Can anyway really remember the difference between, for instance, the following badly named PHP functions:
strpos, strripos , strrpos and stripos ?
Why is it that you need different functions for case-insensitive string searches and case-sensitive ones? Wouldn't it be better to have overloaded functions that took an extra optional parameter to indicate whether it was, say, case-sensitive or binary-safe? But no, PHP just add yet another similarly named function and, if you don't read the manual every day, you probably miss half of them!
The whole lanuage is disorganised, loose and indisciplined. If I take over someone else' code I don't want to have to learn the templating system they have been using, I want to learn just one, and use that always. If a language is OOP orientated then I expect it to have been designed that way, not hacked on as an after-thought (see C++).
I've used PHP for over 5 years now, and was a great fan, but now I'm more and more tempted by the lure of Java/J2EE and (god forbid) ASP.NET with C#, both of which are far more elegant and solve many of the problems that are inherent in PHP (ie. they are properly type-safe, OOP frameworks that clearly separate content from design and are compiled at run-time for performance).
Re:Power Power Power [where's my perl!?!]
by
mcocke
·
· Score: 1
With every release, PHP introduces incompatabilities with previous releases. I've written the same application three times - and counting. When has perl done something that brainless? PHP is a nice niche langauge - very useful for certain applications. Perl is generally much more useful and the development team doesn't keep shooting us all in the foot!
Good enough for YAHOO.
by
michaelhood
·
· Score: 1
I think Yahoo! would object to being described as a small site. Devshed network runs on a slightly customised version of the Mambo Open Source CMS (PHP/MySQL).
not any longer lazy types
by
Anonymous Coward
·
· Score: 0
While the new Zend engine does a very good job at being compliant to earlier specifications, the PHP guys have managed to make PHP5 incompatible to older versions - unnecessarily. The new version will introduce a lot of senseless errors and failures were previous versions mangaged to automatically convert varaible types as needed and expected.
So the lazy type evaluation seems to become history for PHP, as the new versions is out to get rid of its scripting language state.
Re:Power Power Power [where's my perl!?!]
by
scambaiter
·
· Score: 1
hehe, just wait until perl6 will be ready:) i bet matts perl4 scripts will be completely be broken then and vanish completely... hm, so this might be a really good thing:)
and i guess its the old line: use the tool that fits the task best. perl is the swiss knife, php a more focused language for web apps. go for what you actually need.
-- sick of sigs... *sigh*
PHP better for LARGER projects? Come on...
by
Brother52
·
· Score: 1
"I love perl. But it's a horrible choice for a large project with many developers"
This is a common misconception among the people who use Perl only for quick hacks. I personally moved to Perl after using PHP for 4 years mainly because it became difficult to use as the projects grew.
Perl has a lot of tools to help you deal with project complexity. Various "strict" and "warnings" pragmas help to fight sloppy code, *plethora* of usefull development support modules, great testing frameworks, embedded documentation standard, etc.
PHP's best quality is simplicity, and therefore fast learning curve. And that's a big win for a beginner or occasional programmer. But larger stuff isn't done by those.
"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"
Oh, please. People without substantial experience in software development don't get to work on large projects. If they do at your place, you're having an HR problem. The kind of code people with "basics of C" and 48-hour training tend to produce has no place in any system of even a moderate size and complexity. Unless you're talking about 100th PHPNuke clone done by school boys for kicks.
RC1 != stable
Don't assume it's stable, until PHP 5.0 (stable) comes out. Here's what the article on php.net says:
quite stable - stable enough for everyone to start playing with
(wooo RC1's out!)
It's funny, I remember when it was a main tenet of programming that data should be separate from presentation. However, PHP has shown just how powerful integrating data and presentation can be through inlining code directly into a webpage layout.
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 itself.
I have been pwned because my
Hmm... why do we always get new expressivity features and library extensions, instead of new safety features and ways for statically checking our code (such as type checking, a novel but, admittedly, completely impractical and academic invention that only freak languages use)?
I guess because people like me prefer to complain and use other languages instead of fixing unsafe ones...
Old but still funny.
Student Suspended Over Suspected Use of PHP
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.
Try not. Do or do not, there is no try.
-- Dr. Spock, stardate 2822-3.
move to PHP
Indefinitely Detained US Citizen
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.
for the last time people, I am "frodo from middle eaRTH", not "middle eaST".
Actually, PHP folks seem to think mixing business and display logic is a bad idea (like the rest of the world): smarty.php.net
be careful upgrading, as the semantics regarding object assignment have changed from copy to reference. i know some of my code would make use of the old copy-on-assignment semantics.
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.
- for all but the most trivial sites, separating code & presentation is a Good Thing
- PHP supports this kind of separation. google for template libraries.
Funny that a site using "death throe" Perl could take down a site running PHP.
Death throe - whatever.
Paul Seamons
Huh?
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...
I just think about how easy it is to create something with PHP. Not necessarily the death throws of Perl. I started with CGI and Perl, and did quite a lot of it many years ago. I've worked with ASP too; I liked the flow of it, but it was too microsoft centric. When I came to doing web programming again, PHP was what was available, and I LIKE IT! Very powerful.
Any language that has a 4000 page Help document that is extremely easy to use and find information, is an excellent programming language.
http://github.com/gbook/nidb
(since /. has an established base of well-tweaked high quality/high performance Perl code),
Is this a troll? Every couple of weeks, I am plagued with "Internal Server Error" messages on this site, or I am plagued with the inability to view anything but the front page.
Thats not even mentioning all the bugs and HTML issues that are plaguing Slash.
Slash is OK code, but by no means is it the polished professional code you make it out to be.
I remember reading within the PHP docs about how unsafe it was to use the 2.x release branch of Apache with PHP...something to do with thread safety if I recall.
Anybody know if PHP 5.x has overcome this limitation?
PHP5 is an excellent choice for prototyping because of the integration between display and function,
What the hell?! If you've been involved in any kind of app deployment followed by its maintenance (especially web apps), you'll know that keeping presentation and code separate is extremely desirable. Integration of these two is a weakness, if anything.
Having said that, PHP itself is no worse or better than say mod_perl in that regard. If you use a template library with PHP, you can accomplish some nice separation of presentation and code. But them mod_perl has excellent and mature template libraries also.
Once again, it's not about the language. Use a language you enjoy and then surround yourself with appropriate tools and libraries.
Speed: they're all "fast enough." All of these scale well enough that for most sites you won't care, and none of them really scale well enough to support something like cnn.com. [Read through the archives to get a feel for the pain /. has to go through to serve its audience, for instance. And /. isn't even THAT big.] No flame; just that all these options are low/middle end.
/. is a case in point. There's a reason /. doesn't upgrade to the latest & greatest very often.
/. I know, but of these, ASP.NET is probably the best choice. If you want a toolkit/language that won't make site maintenance hell, OpenACS (tcl) or Zope (python) is probably a better bet. If you want something that will scale to absolutely huge levels (like the aforementioned CNN), J2EE is about the only game in town. (But a living hell to code for -- not recommended for smaller projects!)
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
I was on to post exactly the same thing. Programming php without using templates is not an unefficient solution, but quasi impossible practice.
It will lead to a complete disaster once redesign time has come.
1. No sig. 2. ???? 3. Profit!!!
An article discussing some of the new PHP5 features.
MT runs on Perl, (not even mod_perl at that) not PHP.
If it ran on PHP (or even mod_perl), it probably wouldn't have the scability issues it currently has.
I stand corrected.
-fucko
Sig removed because it was obnoxious
I wonder if I can install both so I can play with php5.
http://saveie6.com/
(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.
Here's what I do: Bitty Browser & Andromeda
Problem is, a lot of these +5 Insightful and +5 Interesting comments are coming out of the mouths of people who have played with one or both languages. Just because you were succesful in creating a shitty little web page in PHP and had trouble in Perl does not make you an expert (note: by you I don't mean parent poster.)
I can testify that PHP (4.x) is fast enough for most situations where it'd typically be used (though I don't really know how well it'd do on a high-traffic server compared with other solutions). However: the interpreter feels pretty slow once you start handling megabytes of data at a time. For instance, I have a web app where the user can define file formats (defining how a few tens of things (different db columns) are taken from the columns of a tab-separated file) and then upload data to the database. Uploading, parsing and adding a ~10 MB file with 50000 lines (typical numbers, really) takes on the order of a few minutes. If I did it in C, the bottleneck would be the database and it would probably take 10 seconds or so instead.
In fact, I've resorted to running small C programs from PHP in some places just because PHP is too slow at that sort of thing. Serves me right for using the wrong tool for the job. And yet I'm pretty sure I've saved a lot of development time by choosing PHP over the alternatives (which mostly involved learning new stuff first) for that project.
This signature is not in the public domain.
tone it down asshole, everybody makes mistakes (your mother made one when she made you)
If its a release candidate and "stable", shouldn't the testing already be done?
The upcoming release of PHP5 will create a wave of comparisons to Java. When that happens, remember that it isn't a zero sum game. The two languages work reasonably well side by side. There will come a point when the industry pundit ashclowns start repeating what you're about to read to the enterprise upper echelons. When that happens, it will get really interesting.
PHP has two primary strengths: architecture and standards. The majority of java webspace applications were written before css and xhtml were mainstream. 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. PHP handles "the presentation layer" meaning the application layer that actually integrates what's necessary for your browser to present a nice page (cross-platform, cross-browser) better than any tool out there. That's why Sun wanted to partner with PHP-creator-company Zend.
So architecture-wise, PHP is at the heart of the presentation layer. Standards-wise, PHP will help to bring about what CSS and XHTML promise.
Oracle is aware of PHP, IBM is aware of PHP, Macromedia is aware of PHP. Now the hiring managers get to start looking for PHP coders.
http://tinyurl.com/4ny52
Having browsed only a few ASP.NET howtos but not having had the opportunity (or misery -- since this IS slashdot) to code in it, I'm not too familiar with ASP.NET
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.
Yes, I've run php5 and php4 on the same box for almost a year. There are a handful of howto's for running two modules under apache, for examplea quickl Google gives me: www.schlitt.info/applications/blog/archives/83_How _to_run_PHP4_and_PHP_5_parallel.html
http://tinyurl.com/4ny52
FOAD
For people who think there must be something better to write web-based applications than PHP, I invite you all to take a look at Seaside by Avi Bryant, a web framework available for Squeak and, I think, VisualWorks Smalltalk. It uses continuations to make programming a web application basically the same as coding a desktop application. It features many, many things that PHP cannot do.
For those of you who don't know PHP, just wait a version or two. It already supports VB, C, C++, Javascript and Perl style coding. Version 5 is basically Java. Expect Intercal, Unlambda, and BrainF*** support by version 7 or 8. If you know a Turing-complete language, chances are you'll be able to use it to code PHP by the end of the decade.
WARNING: there is a trojan on your
how is the language working against it? perl development is as maintainable as the developers on a project make it.
with proper modularization, templating, and checking in of versions, it's not a problem.
It sounds like they basically have added all the syntax and OO features of Java. I'm not sure whether that's cool or what...
It is kind of handy, but I'm finding it hard to shifting my thinking to using php for full OO applications like one would do with servlets/JSP. PHP is certainly easier to code in than JSP, so I guess this is good.
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.
irb(main):001:0>
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 4.3.4
A test run of our PHP setup on PHP5 RC1 seems to be more responsive and crisp than it was on PHP4.
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?
So does PHP5 have proper Unicode support, or are we still supposed to pretend that you can treat UTF8 as ASCII and that it will 'just work'?
I aggree with you, XML/XSLT/CSS is the best approach. Also use AxKit to get backward compability!!!
Hi, Anyone have thoughts on Cold Fusion vs php? Is it worthwhile to move from COld Fusion to PHP (other then Cold Fusion is dieing). Thanks!
Speed along is one thing. I used to use Perl and even compiled perl, until I tried PHP and was blown away by the speed-up of my apps. Perl is nice because of it's regular expressions and such... but PHP has all that and more.
Meh.
WebObjects was a similar type deal, only it had a graphical GUI builder. Programming web apps with WebObjects was pretty much identical to desktop apps, with the addition of some new objects for web based functionality. Objective-C is also quite similar to smalltalk. It was a really cool dev environment, unfortunately apple price it was out of reach for too long and never got around to actually trying to market it...
Why is this 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.
And does Perl have a 'strong central theme' ?
Note: I don't particularly like PHP nor Perl, but if there's any language that's built for everything and then some, it's Perl.
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.
There's a good reason why most sensible stable package trees don't release every latest-and-greatest version, and instead opt to patch vulnerabilities on current 'stable' versions.
So yes, while I don't like the whole inline system, I consider PHP pretty safe to use.
The path I walk alone is endlessly long.
30 minutes by bike, 15 by bus.
I'm mostly of that opinion as well. The author of bTemplate wrote an essay on using PHP as its own template engine. That said, I actually prefer to use Smarty since I do coding and design for our intranet. I've found it easier to switch hats when I have to switch syntax as well.
You got to be kidding.
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 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.
"I think this line is mostly filler"
If you're wanting to learn about all the wonderful new features in PHP5, then grab this book. It covers more advanced topics (hence the name Advanced PHP Programming) but it's an absolute must for serious PHP developers. If you're a beginner, learn PHP in general first, then grab that book.
Gabriel Ricard
What are you talking about? Java already has jsp (among other technologies) for presentation layer.
Have you ever stopped to wonder why Oracle 9iAS is a J2EE application server and not a php application server?
Where do you come up with this stuff?
All right, i have never used either, but would like someone to summarize what are these 3 languages about.
Perl syntax is obscure and complicated, php seems to be only used for small pages, and asp, well i haven't seen much people talk about it especially here, but i do see it getting used in big sites.
Also, there is jsp/servlets.
I am one of the guys that think that everything has it uses and that there are things in which a tool excels at. So can one explain me what would be a proper use for all these technologies?
Open Source Java Web Forum with LDAP authentication
PHP has a smaller syntactical (is that a word?) footprint. As you said that you manage a development team, this is important. The Perl motto of "There's more than one way to do it" becomes an issue when you've got multiple developers working on the same codebase. You can write and (attempt to) enforce code style rules in your organization, which mitigates this a little bit, but it takes time to write those guidelines, get buy-in, and enforce.
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.
The thing i like about PHP is that it derives a lot from a lot of scripting and programming languages.
Wonder whats new about PHP5 though that will help the average web scripter....? The changelog doesnt show anything sensational.
Lord of the Binges.
The first version of PHP was written in Perl. PHP is an ASP/JSP-like Perl spinoff. PHP-like functionality is just one of the many things Perl does. Perl is the Mother of PHP.
Oh, Perl doesn't. But my PHP Lotus Notes client says neither does PHP...
w ww/php4/README.html has a good listing of the various remote code execution exploits over the years...] It's not about using bleeding edge code, it's that the stuff has been patched upon patched upon patched, and it's not worth the headache to keep patching the damned software.
Except PHP hasn't had an unexploited release in *3 major revisions* now to my knowledge. [ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/
Heh ... this scintillating commentary comes to us from someone whose site is hosted on Geocities.
It's not my fault! It was this way when I got here.
That's interesting because it's only insecure as you make it. If one loads any base package up with a dirty mix of extensions which are never utilized and put no real thought into the PHP installation...well, that leaves tons of room for problems. Any extensible language is at the whim of the packages beyond the host.
;)
Oh, and someone better let Yahoo in on this
I don't know, but possibly, The Kernel, occasionally known as Linux, works so well that we don't need Yet Another Case Of Open Source Effort Duplication (YACOOSED) (tm).
PHP could easily stand YACOOSED of being such. We need it about as bad as Groovy.
Thanks for fragmenting efforts, y'all. BeelzeBill loves you.
Yeah, that's my other website. Geocities doesn't support any server-side scripting at all, AFAIK. Fortunately, the one hosting togos.dhs.org also supports mod_perl, so I'm not completely screwed :)
Duct tape, XML, democracy: Not doing the job? Use more.
I used to be a PHP developer, but switched to python-based content management systems due to the elegance and ease of programming in python. However, I was interested to see how PHP had progressed since the last version, and read the article linked by Slashdot.
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?
Devin
Hell, just try porting a P/M site to a nice DB so you can push more of the data manipulation functionality to the DB layer where it belongs and you're in for a real tear-jerker. My main frustrations with OSS is that most of the work is done 1) where the work is easier, 2) where most people (unwashed masses) congregate, and 3) with little regard to lessons learned and best practices.
Yeah, right.
<?php echo '<b>great</b>'; ?>
<?php echo ' news!'; ?>
JET Program: see Japan, meet intere
References work well enough. Show me where you've been constrained.
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.
One apparently-little-used feature I've been wanting to play with lately is the PHP/Java integration. I've been assuming that PHP5 will be more conducive to this.
I've never QUITE managed to get this working on PHP 4 (though since I don't have any specific reason to use it other than 'I want to play with it', I haven't put all that much time into it, either.). Anybody tried this on PHP5 yet? Or know of a fairly thorough explanation of getting it installed and configured?
Hacker Public Radio is our Friend
More importantly, is it stable under Apache 2?
OK, I tried using XML & XSLT under PHP a couple years ago, for the CMS system which is linked in my .sig. It was one of the most frustrating experiences of my life.
/. will quickly point that out :)
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
All the OO features are nice, but what's really missing in PHP are some critical "enteprise" features, like true connection pooling (and no, pconnect doesn't count).
The Raven
Death throes my ass. Have you seen the traffic on comp.lang.perl.misc? Have you seen the perlmonks website? Have you seen the journals and publications (both online and offline) that deal with Perl? Have you seen the new Perl books that come out every year? Have you checked out CPAN lately? It seems to keep on growing and growing... And let's not forget the Activestate folks (the main Win32 Perl distro) who still find it worthwhile to support Perl and sell related development tools. Yeah, none of this would happen if Perl was have "death throes".
If you like PHP, fine, use PHP. No need to lie or troll or act like a jackass.
I reported a showstopper bug two days ago that crashed Apache 2 hard.
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.
I have never known anybody to use PHP to do sys admin stuff. Is it really commonly done? In not, why not?
You're both full of shit. And the moderators are on crack.
It's all about good coding practice. You can even write maintainable code in that nasty language people call PHP :)
Like I said though, to each his own. Some people worry that PHP is "killing" Perl, and other ridiculous nonsense... Frankly, there's more than enough room for both, and plenty more too.
I'm not religious though; if someone paid me to write PHP, I'd write PHP. But I won't touch VB though, that's the devil.
Heh, if you want to feel better about the language you have to use, just compare it to VB; "Well, at least I'm not writing this in VB..."
Sticking feathers up your butt does not make you a chicken - Tyler Durden
I use both perl and php. My motto, choose the tool based on the job you need to do.
PHP in my mind works much much better than perl for web sites. The syntax is neater, its really easy to template a site in php.
That being said the scripts that I run to prep my photo library for the web run perl from the command line. Shell scripting is way too limiting and perl is fairly cross platform and php doesn't really work as a scripting language.
either way lots of comments in code make it better..
That's what I used to think.. then I tried writing a medium-sized app in Perl.
YOW!
Just having to deal with arrays v. array refs, undef v. empty arrays, perl's strong typing with numbers v. strings.. I nearly went insane.. the app was always on the verge of being impossible to understand.
I have since switched to PHP, written in a java-like style (objects, etc), and keep perl for the quick hacks.
Perl just doesn't scale, and PHP is getting better every day.
I see lots of people starting to grumble about Perl and moving to other languages.
I know this is only slightly related...but while looking at improvements with PHP, check out this powerful template engine written in PHP:
Smarty.php.net now at version 2.6.2 with improved cache ability.
Suncoast Linux - Sarasota, FL
Too bad lots of PHP/Mysql coders never heard about them. And if I had to make a site site fast, easy to maintain and with good code/presentation separation, I'd go with Java servlets and Apache Velocity. And probably some kind of framework too.
--Coder
The SOAP/Web Services support is pretty week, not well documented, hardly any examples.
Hopefully it will change soon.
PHP needs namespaces. Then it will be all grown up.
-- SKYKING, SKYKING, DO NOT ANSWER.
I've coded java web applications for several years now, and I ENJOYED it. I personally HATE weak typed languages- maybe I could get used to them, but I make too many bugs that could be avoided by compilation/type checking that is lacking in PHP.
If you stay away from the 'advanced' j2ee stuff, like EJB and other crap, web applications are a breeze, and FAST. Personally, I prefer using templates (like Apache Velocity) to JSP. And noone in his right mind would make JSP-only web site. There are some web application frameworks that make job even easier.
By doing this this you get very good code/design serparation (cheap maintenance), all the advantages of OOD/OOP. And a strong typed language.
--Coder
I'll look at PHP again when its massive function library is refactored into functions.
There should be no need to write:
$arr = array();
array_push($arr, 42);
When it could be:
$arr = new Array;
$arr->push(42);
P.S. See you in Hell.
Is there any way to compile PHP to bytecode
or machine code?
Is there a way to distribute it in an executable format to someone's machine without an installed PHP compiler?
This would be for Mac and Windows.
See : Creating Extensions
I'm still trying to figure out what people mean by 'social skills' here.
Huh? PHP doesn't enforce (X)HTML or CSS correctness. As far as PHP is concerned, all you have is a sequence of bytes. (Not even Unicode characters!!!) PHP spaghetti code is used for generating tag soup all over.
Also, PHP-driven sites usually don't use MVC but have an intertwined mess of presentation and app logic.
OTOH, non-JSP Java solutions such as XMLC actually enforce some stardard constraints.
And don't tell me to turn them off in my configuration file.
.htaccess . If that's also not an option, you can still turn them off with a PHP command that you could include at the beginning of every script.
Then turn them off in your
The fact there are many different templating engines for PHP nicely illustrates PHPs major weakness - it's become a sprawling, bloated mess of a language that has no properly defined standards and no clear structure.
Every time I look at the PHP manual there seems to be 20 new (inconstantly named) functions, 3 new beta libraries and 5 subtle changes to the syntax (that will bite you later on). Instead of having one clear set of standards that people can learn and adhere to you have dozens, making integrating other peoples' code a nightmare.
PHP is becoming like Windows - more and more functionality is being bolted on whilst trying to maintain backwards compatability and the end result is a complete mess. It needs re-thinking and re-writing from scratch.
With every release, PHP introduces incompatabilities with previous releases. I've written the same application three times - and counting. When has perl done something that brainless? PHP is a nice niche langauge - very useful for certain applications. Perl is generally much more useful and the development team doesn't keep shooting us all in the foot!
PHP is good enough for Yahoo, and they have more traffic than CNN does.
I think Yahoo! would object to being described as a small site. Devshed network runs on a slightly customised version of the Mambo Open Source CMS (PHP/MySQL).
While the new Zend engine does a very good job at being compliant to earlier specifications, the PHP guys have managed to make PHP5 incompatible to older versions - unnecessarily. The new version will introduce a lot of senseless errors and failures were previous versions mangaged to automatically convert varaible types as needed and expected.
So the lazy type evaluation seems to become history for PHP, as the new versions is out to get rid of its scripting language state.
and i guess its the old line: use the tool that fits the task best. perl is the swiss knife, php a more focused language for web apps. go for what you actually need.
sick of sigs... *sigh*
This is a common misconception among the people who use Perl only for quick hacks. I personally moved to Perl after using PHP for 4 years mainly because it became difficult to use as the projects grew.
Perl has a lot of tools to help you deal with project complexity. Various "strict" and "warnings" pragmas help to fight sloppy code, *plethora* of usefull development support modules, great testing frameworks, embedded documentation standard, etc.
PHP's best quality is simplicity, and therefore fast learning curve. And that's a big win for a beginner or occasional programmer. But larger stuff isn't done by those.
"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"
Oh, please. People without substantial experience in software development don't get to work on large projects. If they do at your place, you're having an HR problem. The kind of code people with "basics of C" and 48-hour training tend to produce has no place in any system of even a moderate size and complexity. Unless you're talking about 100th PHPNuke clone done by school boys for kicks.
I hate magic quotes.
Do you even lift?
These aren't the 'roids you're looking for.