![Programming Programming](http://a.fsdn.com/sd/topics/programming_64.png)
![Books Books](http://a.fsdn.com/sd/topics/books_64.png)
![Media Media](http://a.fsdn.com/sd/topics/media_64.png)
![Book Reviews Book Reviews](http://a.fsdn.com/sd/topics/bookreview_64.png)
![IT IT](http://a.fsdn.com/sd/topics/it_64.png)
![Technology Technology](http://a.fsdn.com/sd/topics/technology_64.png)
PHP 5 Recipes 121
jsuda writes "
With all the books being published recently about PHP a new one will need to find
and fill a niche to distinguish itself. PHP 5 Recipes: A Problem-Solution
Approach, published by Apress, has done so, in my view. This is an intermediate-level
volume exploring PHP 5 using a recipe approach where the basics of
PHP 5's functionality are expressed systematically but in a small-topic
by small-topic manner. Cook-book style, each topic is relatively autonomous
and can be individually selected, as necessary, for information or review, similarly
to how many refer to the Joy of Cooking for help on a cooking project.
It's a source for instant solutions to common PHP-related problems. There are
over 200 such recipes presented." Read the rest of jsuda's review.
Php 5 Recipes: A Problem-Solution Approach | |
author | Lee Babin, Nathan Good, Frank M. Kronman, Jon Stephens |
pages | 646 |
publisher | Apress |
rating | 8 |
reviewer | John Suda |
ISBN | 1-59059-509-2 |
summary | A problem solving approach to Php 5 |
Each of these recipes refers to a small element or aspect of PHP 5 and the presentations contain a brief overview of the topic, an explanation of how the code elements work, and where the code is applicable in projects. Overall, the book covers the whole range of PHP 5 functionality where each major element of PHP 5 is addressed in a recipe explaining and illuminating relevant code elements. You can easily get information about a specific PHP 5 element by going directly to the section of the book where it appears. Even better, the code snippets are designed to allow one to copy and paste them into your own applications or development easily and then to configure them as necessary. All of the code snippets are freely available for downloading at the publisher's website at www.apress.com.
There are 16 chapters and an index covering a total of 646 pages. The chapters are organized similarly to other PHP primers, covering the basic elements of PHP - data types, operations, arrays, strings, variables, files and directories, dates and times, functions, and regular expressions. The coverage for much of these concepts is relatively mundane and unoriginal. The discussion of dynamic imaging, however, is an exception. The writing throughout, however, is solid and clear. The book emphasizes the most important elements of new PHP 5. The object-oriented programming elements especially are covered - classes, objects, protected class variables, exception handling, interfaces, and the new mysqli database extension. The authors' discussions focus on PHP 5.0.4, MySQL 4.1, and cover Linux and Windows environments.
The book is directed at PHP programmers looking to learn the elements introduced by PHP 5, and for those looking to find fast solutions to coding problems. It assumes a basic knowledge of PHP. Many of the recipes discuss object-oriented programming and these are some of the more advanced sections of the book. I can say that Chapter 2, which introduces the object-oriented concepts is one of the better explanations of the topic that I've read. The chapter covers constructors, destructors, methods and properties, class diagrams and examples of these concepts at work in code snippets. There are a number of interesting segments containing custom coding of classes as reusable templates from which to create objects.
The book is well-designed and written. The discussion is clear and logical. The code snippets are well-explained. The authors are experienced programmers and developers, and Good and Stephens have authored or co-authored a number of technical books.
A large handful of the recipes contain projects, usually appearing at the end of the overview and presentation of code snippets covering the basics of the topics. The projects usually deal with the creation of higher-end classes and objects as solutions to common coding problems. The idea here is to show PHP 5 functionality at work providing useful code sections to be dropped into your custom applications. Chapter Five concludes with a sophisticated class dealing with dates and times issues. Other chapters contain constructions of string, file, graphics, and regular expression classes.
The last five chapters deal with using the PHP code in web applications and services. This material covers cookies (including construction of a cookie class), using HTTP headers, sessions, and using query strings. Much of this material has been covered elsewhere in the many primers on PHP already published. There is a chapter on using forms and an interesting chapter on working with markup. The better chapters are on using DOM to generate markup, parsing XML, using RSS feeds, SOAP, and simple XML. The chapter on mysql is basic, except for the section on creating a wrapper class. The last chapter deals with communicating with Internet services, like POP, iMap, and FTP. Another project presented here is one creating object-oriented code dealing with a mail class.
This is a useful book to have in a programmer's library."
You can purchase Php 5 Recipes: A Problem-Solution Approach from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
What about security? (Score:3, Insightful)
Indeed, inexperienced programmers writing insecure code has plagued PHP for years now. Far too many PHP books that I have flipped through show very poor style. They don't verify the inputted data, for instance, before making a SQL query.
So while a professional, or even somebody with some level of experience, would see such an obvious problem, a beginner may not. And then the result is often a compromised server, a destroyed database, or some other shenanigans. Often times a problem with a user's PHP script ends up making other, completely innocent and unrelated projects (such as Apache or Linux) look to be at fault. That's not good for the image of the community.
Re:What about security? (Score:2, Insightful)
Re:What about security? (Score:2)
You say this like PHP is the sole exception. But it isn't.
Most perl, python, ruby, C/C++, ObjC, Haskell, Lisp, Tcl, ML, Lua texts don't cover security either.
Maybe someone should publish a book regarding security itself.
You mean like this [linuxcentral.com]?
Re: (Score:3, Informative)
Re:A lack of security-wise individuals. (Score:1)
Re:A lack of security-wise individuals. (Score:2)
It's really easy to use parameterized queries, so I simply do not have to deal with escaping strings before they go into the database. For example:
Re:A lack of security-wise individuals. (Score:1)
Re:A lack of security-wise individuals. (Score:1)
Re:A lack of security-wise individuals. (Score:3, Interesting)
In what way? Failing to check inputs before passing them on to a database or other module is an application, not a language, problem. You claim that there are "numerous security issues found in PHP" - please, describe them. I haven't found it to be any more insecure by nature than C, C++, Perl, etcetera...indeed I'd say it's easier to write reasonably secure code in PHP th
Re:More of a community attitude issue. (Score:5, Insightful)
While perl security has gotten better, it is still a problem. perl is still widely exploited, formmail.pl is one of the more infamous ones. lusers just download whatever script they find off the web and install it, and get quickly compromised.
Are the majority of perl users well versed in perl security? I doubt it.
What, you going to recommend people use C instead of PHP then? python [securityfocus.com]? Even java [securityfocus.com] has issues.
It's very fashionable, hip and trendy to bash PHP on
Re:What about security? (Score:2, Funny)
Uncyclopedia says that PHP is super-secure! [uncyclopedia.org] I read it online, it must be true!
* Tongue planted firmly in cheek
Re:What about security? (Score:3, Insightful)
The problem is that it's illegal to have a non certified engineer working on a project that can impact others. Those engineers are expensive because you're paying for their recognized skills and the years it took them to obtain them.
Meanwhile, 15 year olds are bidding on software projects and it's seen as a great opportunity. There are certainly some benefits to the industr
Developer's Union? (Score:3, Interesting)
Why not apply this idea to software? If there was a coalition or Union of workers, with a commonly agreed-upon set of requirements and certifications, with annual fees and a good reason to require a decent demonstration of competence? Something with real teeth, and ongoing certification requirements. Think, the Bar, only for software engineers instead of Attorney
Re:Developer's Union? (Score:3, Insightful)
Basically, the industry would have to foot the bill for something that would end up costing them a lot of money in the long run with nothing to gain except s
Re:Developer's Union? (Score:3, Insightful)
As far as I'm aware, developers are pretty well paid in the overall job market, more than twice as much as teachers in many cases.
I did spend time getting degrees in CS and CE, and it would be nice to seperate myself from those who simply have MSP on their resume. But wait - that's right - I DO seperate myself, by putting my CS and CE degrees on my resume.
Rarely is software life threatening (yeah, I know, there are exa
Re:Developer's Union? (Score:2)
Really? The underlying POINT at this poing in the thread is that there's not enough differentiation. And, truthfully, I've seen an incredible amount of shoddy, negative-worth work done by highly credentialled, CS/CE developers!
Somebody with a CS/CE degree is going to do better at dev
Re:Developer's Union? (Score:2)
Unless sarcasm was your goal, barring the BBB, the Bar and the Association of Realtors is hardly a group that guarentees any sort of quality. There are some crappy lawyers out there (Harvey Birdman and Lionel Hutz come to mind, but I digress, because it makes it seem like I'm trying to be funny) and some really crappy/corrupt realtors out there.
Just because someone passed the bar d
Re:What about security? (Score:2, Interesting)
I have to ask -- do you also point out C++'s flaws, in the realm of buffer overflows? It is, after all, an inherently insecure language.
Which languages do you consider secure? Java?
Re:What about security? (Score:1, Troll)
It's widely acknowledged that C++ suffers from various security problems. Anyone who has any level of formal training or experience knows that. Not only that, they know how to avoid such prob
Re:What about security? (Score:2)
Re:What about security? (Score:2)
Re:What about security? (Score:1)
Re:What about security? (Score:1)
Re:What about security? (Score:2)
He keeps ranting about PHP like PHP is the sole exception from of the vast ocean of languages out there.
A more intelligent discussion would point out that security in general does not seem to be a priority, regardless of the language. (Maybe one could count java as the sole exception here, even though its record hasn't been stellar either.)
But this is way over cyricz's head. Like a freebsd zealot who bashes linux at every chance, he bashes PHP at every chance. In the end he comes off s
Re:What about security? (Score:2, Informative)
Yes, I am affiliated with the publisher of the book I linked--but it's a good book! (-:
S
Re:What about security? (Score:1)
This might sound elite, but this is how I did. I used a book to learn the basics of SQL and I'm now teaching myself to use other ways to get rid of the security and efficiency issues I keep programming in MySQL-routines because of that dreaded book. I learn
Really :o (Score:3, Funny)
Re:Really :o yup (Score:1)
Hello World is easy in PHP. (Score:5, Funny)
Re:Hello World is easy in PHP. (Score:1)
Re:Really :o (Score:2)
b4n
Does it tell you how to upgrade PHP? (Score:1, Interesting)
Re:Does it tell you how to upgrade PHP? (Score:2)
As for RPMs....no idea. I don't use them.
Re:Does it tell you how to upgrade PHP? (Score:1)
Apples to oranges. The redhat equivalent to apt-get is yum these days:
yum install $packagename
You can set redhat distros up to use apt however (though I see no reason to).
Re:Does it tell you how to upgrade PHP? (Score:2)
Download and build apache and php from source. Remove the RPM versions. Install the newly built ones. Now you are no longer tied to the RPM that RedHat provides. I don't even bother installing RPM's for apache, php, perl, sendmail (and other packages) at this point.
This way, I get to control what version and what patches I run, on my schedule.
You can get the source for php from php.net and the source for apache from apache.org. It's really that easy. Or you can pay an apache/php geek to do the first
Re:Does it tell you how to upgrade PHP? (Score:1)
That's kind of slack. However you might be interested to know that the PHP source packages contain a makerpm script. They are hells out of date however and needed quite a bit of tweaking to get going.
I have a set of PHP 4.4.1 RPMs for FC1 available here:
http://houseofzeus.com/notblog/?postid=322 [houseofzeus.com]
The SRPM is also there, so if you need another variant of PHP compiled then you can get to the SPEC file I modified and change it appropriately :)
Does it delve into SQL? (Score:3, Insightful)
I recall working with one web developer who learned PHP from such a book. We told him that we wanted to use PostgreSQL as the backend for our site, but he insisted on using MySQL, since that was the only system mentioned in the book he had bought. We no longer required his services after that show of incompetence.
Does this book try to cover topics such as SQL and database design, which should be covered in their own, separate book(s)? Does it specifically refer readers interested in such subjects to consult other sources of information?
Re:Does it delve into SQL? (Score:1)
I have to say, I disagree with the importance you place on this in a PHP book. If a person needs to know more about MySQL then they should get a book on MySQL. This book also has examples of connecting to an FTP server - should it also go into the proper way to setup an FTP server? And creating clean HTML code? Optimizing Apache? Sendmail? If it did that it would no longer
Re:Does it delve into SQL? (Score:2)
Indeed, I wanted to know if this book covers SQL just because if it were a good book, it would not cover topics such as SQL and databases. Those topics are best covered by experts writing their own books on such subjects. This book should at least recommend that interested readers consult other material to learn more about such subjects.
It would be a major blemish on this book if it did cover such topics.
Re:Does it delve into SQL? (Score:1)
No, it does not reference other books. It only tells you how to work with an existing table.
May I sugest a great PHP tutorial? (Score:2, Informative)
Re:May I sugest a great PHP tutorial? (Score:3, Insightful)
Nothing could be worse than a new PHP user learning PHP from outdated tutorials which fail to show the proper techniques necessary for building solid, secure and trusted web applications.
First non-italicized post (Score:4, Funny)
Unclosed italics tag (Score:1, Redundant)
Look, I fixed it!
Re:Unclosed italics tag (Score:2)
Re:Unclosed italics tag (Score:1)
In Firefox, there's no problem to begin with.
Catalyst (Score:2)
Re:Catalyst (Score:2)
If you can present a good case why people should move away from PHP towards alternative systems, then it might lead to some other distributions including far superior systems. Indeed, the best way to get this sort of a change is to raise awareness, and a well-publicized article may just do the trick.
I would imagine that there is a big enough community of serious web developers who are fed up with the insecurity and lack of quality that PHP poses. They might be able to o
Dangit! (Score:1)
Re:seasoned php programmers (Score:2)
Re:seasoned php programmers (Score:1)
Re:seasoned php programmers (Score:1)
Re:seasoned php programmers (Score:1)
Affiliate Program? (Score:2)
I'm just wondering if someone is trying to make a buck off of this.
Re:Affiliate Program? (Score:3, Informative)
Re:Affiliate Program? (Score:1)
ebook (Score:1)
There is allegedly at least a 50% discount for the ebook as against the printed version, although the price of $22.50 means there is a nad less than a 50% discount from the full $44.99.
I guess publishers don't have to know maths, or they are just tight. That whole half cent makes their statement a lie..
Maybe they meant up to 50% discount.
Let the web language wars begin!!! (Score:1)
I've heard great things and bad things about all of them. Pearl is hard to learn, but is super fast and secure. Java is super slow and hard to learn, but very secure. PHP is easy to learn moderately fast, but insecure. ASP is fast, but is being replaced by
Re:Let the web language wars begin!!! (Score:2)
That last bit maybe true in ASP.NET 1.1 but Microsoft have made a big, and I think quite successful, effort to make ASP.NET 2 standards compliant.
Re:Let the web language wars begin!!! (Score:1)
Re:Let the web language wars begin!!! (Score:2)
(Most of the issues in ASP.NET 1.1 were due to JavaScript code for validation and such that worked only in Internet Explorer. Even then, ASP.NET controls in other browsers would still work -- but without the added JavaScript functionality, basically meani
Re:Let the web language wars begin!!! (Score:1)
Flame on (Score:1)
Re:Flame on (Score:2)
From what I've seen of writings about ASP.NET, they tend to:
So, in this case, good practices are widely promoted, where in other cases, they aren't. Measures like magic_quotes_gp
Apress in general (Score:2, Informative)
Re:Does the book also cover the fact (Score:1, Informative)
Re:Does the book also cover the fact (Score:3, Interesting)
Indeed. A truer statement has rarely been stated.
From an engineering standpoint, PHP is abysmal. Many people will suggest otherwise, but they are often those who lack a formal education and background in designing secure, scalable, high-reliability software systems.
The Hardened-PHP [hardened-php.net] project is a perfect examp
Re:Does the book also cover the fact (Score:2)
Re:Does the book also cover the fact (Score:1, Redundant)
Re:Does the book also cover the fact (Score:2)
You sorta of come off as a disgruntled Perl programmer who had his job displaced by another language.
Re:Does the book also cover the fact (Score:1)
Oh stop it, version 6 is still something! Those poor PHP developers, they sure have a lot of past mistakes to undo / fix, (register global on? more than one way to enable magic quotes? ughh), I agree that version 4 must die now!!
Rewriting a web app in Perl, Python or Ruby is still so much more work than cleaning up PHP4 code to work in PHP5. Whatever haters say about it, PHP won't be dying anytime soon.
Re:Does the book also cover the fact (Score:1)
I have an M.S. in Computer Science, spent my first three years as a professional developer working on the development of a secure (TCSEC B3 targeted) operating system, then another year and a half on a firewall project based on a secure OS. I've also worked in the telecom and space sciences fields for well-known companies such as Hughes,
Re:beasters (Score:2, Funny)
An anti-PHP/anti-ASP coalition. (Score:2, Insightful)
Either way, the fact remains that insecure, faulty systems are used far too often for web development. The best thing that can be done at this point is to raise awareness as to the flaws and problems associated with such systems. That may be the most effective way to eradicate their use, thus providing a far more secure Internet.
Re:An anti-PHP coalition? (Score:3, Insightful)
Your argument is goes something like this: "Because someone stabbed somoene else with a fork, we should rally together and make sure forks are banned from all households". You may as well form an anti-C coalition while you
Re:An anti-PHP coalition? (Score:1, Troll)
What it comes down to is that PHP is not well designed, and is not well engineered. This is shown by the numerous security issues involving PHP (even on systems that have been designed, set up and maintained regularly by experienced professionals). Don't take my word for it! Go do some research for yourself.
As for your attack on GCC, well, that just shows how clueless you are about su
Re:An anti-PHP coalition? (Score:2)
You obviously do not understand my argument. There's no need to bring fork terrorism and other analogies into the discussion.
I do, your argument is stupid. It provides no supporting facts or details, just your rabid screaming about PHP, and how it's going to rape my dog, and kill my hamster.
What it comes down to is that PHP is not well designed, and is not well engineered. This is shown by the numerous security issues involving PHP (even on systems that have been designed, set up and maintained regul
Re:An anti-PHP coalition? (Score:1)
Now, I don't know why you want to rape your dog and kill your hampster, but it's none of my business. Please keep that kind of nonsense to yourself.
The fact remains that PHP has a terrible record. It's been shown time and time again to be insecure. That's a fact that you cannot dispute.