Thursday, June 26, 2008

Practical PHP and MySQL

I'm taking a summer course in Building Data Driven Websites - not that I thought I'd learn much in such a course at SCILS, but I'd like to graduate on time, and need the credits, and Bill Crosbie is just the type of rare teacher that can keep even me awake and interested. Our book is Practical PHP and MySQL: Building Eight Dynamic Web Applications (Amazon by Jono Bacon. Now, I know it's not a real book like, say, ESA3 by Frisch, which has a healthy web presense. But this thing is all code and doesn't even have a web site, let alone easy code downloads!


The book does come with a heavily customized Ubuntu LiveCD. However, when I popped it in my OpenSuSE workstation, I couldn't really make much out of the CD - there was certainly no easy-to-find "this is the code" directory. Well, after some exploring, I mounted the SquashFS filesystem and poked around a bit. Strange... seems to only have one real user (root) and, though they claim this is a fully-functional LAMP server, no Apache or MySQL. Really weird. Well, after poking for a few minutes, I found the holy grail - /root/.bash_history was intact! Just a quick look through it with less and I found what I was looking for: /opt/lampp. It appears that the install is actually ApacheFriends' LAMPP, or XAMPP for Linux (gotta wonder if the guy writing this book doesn't even know how to install Apache... I'm sure XAMPP for Linux is more bloated than a customized build of Apache/MySQL/PHP from source, especially since it's only being used to host 8 sample projects, so a lot could be left out).


Anyway, it appears that LAMPP is running in a chroot'ed environment. The actual sample code is rooted at /opt/lampp/htdocs/sites. It seems that all of the PHP files are also owned by root and chmod'ed 777! And the top-level index.php file makes use of absolute links, so obviously he never thought that someone may want to copy the sample code and use it on a real box.


I just can't imagine someone who's a beginner with Linux, let alone a Windows person, trying to get this source code onto a machine where they can actually play with it. And... to make the situation worse... the LiveCD has vi and vim, but no Emacs!!!! Eeeek!!


For anyone who needs it, I have the archive available on my site. For non-*nix people, you'll need Gzip or an equivalent program to extract it.

Labels: , , , ,

3 Comments:

At Thursday, June 26, 2008 9:24:00 PM EST , Blogger bcrosbie said...

Jason, thanks for making the effort to get this code out. I agree with you - the CD is a really terrible example of how not to do it. I'm not sure if it was the author or the publisher who set this thing up. Given comments on the author's blog, I believe that it may have been prentice hall that put it together.

 
At Sunday, July 20, 2008 12:59:00 PM EST , Blogger Tu said...

Great ! Thanks ! I am a newbie in PHP ! So I think this is the way for me to have a fast view about PHP

 
At Sunday, August 17, 2008 12:41:00 PM EST , Blogger Bill said...

Jason, Thanks for the help. I was going to boot up the CD and try to copy the files to a USB drive. There are quite a few typos in the book and I was starting to get frustrated. Thanks again, -Bill

 

Post a Comment

<< Home