RSS feed RSS   ATOM feed Atom


PHP 5 Power Programming · 12 September 2005, 08:42 by Admin

I’ve really been meaning to get into PHP. I can see the advantages, but as usual, lack of time to learn enough to be comfortable has kept me mired in my old cgi includes. I was happy to see this book, and hoped it wouldn’t be too far over my head.

One small problem: I didn’t have anything running anything newer than PHP 4.3.8. Even the new RedHat server that I had just run “up2date” on only had 4.3.2. I didn’t want to mess with my real web server, so I downloaded source to the RedHat and tried compiling it there. I had to add bison and flex before configure even wanted to get started, and finally I had to do it as:

./configure—disable-pear—disable libxml

“Pear” is the PHP Extension and Application Repository, kind of like CPAN for PHP. I suppose I’ll want that eventually, but for now I’m probably far away from needing to add anyone else’s code. I felt I could definitely live without XML extentions for a while also, and without these two, php5 happily compiled on RedHat 2.4.21-4.EL.

Now, with a working PHP5, it was time to take a look at the book. It begins with a description of new features, but chapter 2 is an overview of PHP in general, which is what I really needed. PHP is very comfortable for a Perl user like me, but it was helpful that this chapter pointed out things that I needed to know, like PHP’s different ideas concerning global variables (there aren’t any), and the “superglobals”. Things like string offsets ($str{2}) are going to look like hashes to me, but I’ll just have to get used to that.

Chapter 3 jumps into the new object oriented features. For those who have some managed to avoid any prior exposure to OOP, there’s a light overview with simple examples. I like that much better than the more typical case where some OOP evangelist goes off into a complex example of inherited objects. This does get to the more complicated stuff (and especially in Chapter 4) , but at least they started simply.

Chapter 5 is “How to write a Web Application with PHP” and I was glad to see that ten pages of it dealt with security issues. After that, hooking PHP to databases, and then error handling. PHP5 has try, catch and throw – if you have missed these in other languages, you’ll learn about them here. This was all followed by chapters about PEAR and XML – I skipped by those for now, and was more interested in the long chapter on performance. As my cgi scripts have become more complex, performance is a hot-button, so I found this part quite interesting. The book finishes with how to write PHP extensions (I’m a long way from that!) and using PHP for shell scripts, which is something I will be doing while learning. There’s also an appendix on Zend Studio, and the back inside cover has a 90 day eval license printed on it, but again that’s far beyond my current need or ability.

Overall, I probably need something more basic to get going here. I do have some other PHP books kicking around, so I’ll dig those out and then come back to this again.

Previous Article :: Creating Cool Web Sites Previous Article :: Creating Cool Web Sites
Next Article :: Apache Cookbook Next Article :: Apache Cookbook