In this edition…
- About this Newsletter
- On the Web=> Sun to buy MySQL
- Q & A => How do you install PHP 6 when it hasn’t yet been released?
- In the Forums => Developing an E-Commerce Site
- Book Giveaway Update => “PHP 6 and MySQL 5 for Dynamic Web Sites” Books Have Been Mailed
- My Book News => “Adobe AIR: Visual QuickPro Guide” Available in Rough Cuts
About this Newsletter
Well, it’s been almost a month since my last newsletter (how time flies), so it’s time I put together another installment. Perhaps if I made them shorter, I could get them out faster, but brevity isn’t my strong suit… That being said, I’m going to try to make this one brief (brief-er, at least), with just a smattering of topics. The feedback on the last Q & A newsletter was very good, so I’ll do another one of those in the next month or two. As always, please keep your feedback and questions coming! And, of course, thanks for your interest in what I have to say.
On the Web=> Sun to Buy MySQL
The big news announced yesterday is that Sun Microsystems is buying MySQL for a reported $1 billion (US). Who said there’s no money to be made in open-source software? If you search the Web, you’ll find analysis as to why Sun is doing this. First, it keeps Sun active in the so-called Web 2.0, of which MySQL is a major player. It could also help turn LAMP (Linux Apache MySQL PHP/Perl/Python) into SAMP (Solaris et al.; Solaris is Sun’s version of Unix). Another reason for buying MySQL is to keep it away from other companies that might want it. Oracle, in particular, has been threatened by MySQL as of late (lots of companies that used to pay hundreds of thousands of dollars for Oracle now use MySQL instead), buying lots of MySQL-related stuff in response (Oracle purchases the InnoDB storage engine a couple years back). Anyway, this is pretty interesting news, although I don’t know how it’ll affect MySQL in the end. I can’t imagine Sun would turn it into an entirely commercial product, as a large reason for MySQL’s popularity is that it is free.
Q & A => How do you install PHP 6 when it hasn’t been released?
An astute reader asked me about this when they noticed that parts of my new book, “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide”, requires PHP 6 but that it hasn’t been formally released yet. In fact, even in the appendix I had to demonstrate installation using PHP 5. That’s because the book shows how to install PHP using pre-compiled installers, which are much more fool-proof than doing it manually, and none of these installers support PHP 6 yet, either. In order to test on PHP 6, I manually installed it on both Windows and Mac OS X. I’ll sketch out what that entailed.
The first step in manually installing PHP 6 was to decide what Web server application to use. I went with Abyss, which another reader had recommended to me. It’s arguably not as powerful as Apache, but sometimes that’s a good thing. It’s small, easy to use, and works pretty well. More importantly, by installing PHP 6 with Abyss, I wouldn’t mess up my existing PHP installations that ran using Apache. If I wanted to test PHP 6 then, I might end up using the URL http://localhost:8080. To test a live site I’m developing for a client or myself, I’d use PHP 5 by going through http://localhost. The port number at the end of the address indicated which Web server, and therefore, which version of PHP, would be used.
To then install PHP 6 on Windows was rather simple. First, I downloaded the latest Windows version from http://snaps.php.net. You expand the downloaded ZIP file and copy everything to a folder on the computer (I used C:php6). Then, you follow the Abyss documentation for how to enable PHP support. Basically this is a matter of using a Web-based configuration tool to associate files with an extension of .php with the PHP executable. Instead of choosing the PHP 5 executable, I used the new PHP 6 one, and that was that.
Installing PHP 6 on my Mac was slightly more complicated as I had to “build” PHP myself from the source code. This is common on all Unix/Linux computers (the Mac operating system is a version of Unix). To do that, I downloaded the source code from http://snaps.php.net. Then you expand the downloaded file so that you have a folder full of stuff. You also have to download the latest version of ICU (International Components for Unicode), which is what PHP uses to support Unicode, a major feature of PHP 6. Expand that downloaded file and then open the Terminal, so you have command-line access.
Building software from the source on Unix is simple in theory. You use the command-line and normally execute three commands: “configure”, “make”, and “make install”. One snag is that you need to use the proper configuration settings and the second snag is that if a problem occurs, it can take quite a lot of searching to find the answer. But for building PHP 6 on my Mac, I ran these commands in the Terminal:
- cd /path/to/icu/directory
- ./configure –disable-threads –enable-extras –enable-icuio –enable-layout
- sudo make install
- cd /path/to/php6/directory
- ./configure –prefix=/usr/local/php6 –with-config-file-path=/etc/php6 –with-mysqli=/usr/local/mysql/bin/mysql_config –with-icu-dir=/usr/local/lib/icu/3.8/
- sudo make install
The “cd” commands change the current directory (you have to replace “/path/to/*/directory” with the actual path to the directory; to get that, you can just type “cd”, followed by a space, then drag the folder from the Finder into the Terminal window). Then “configure” tells the software how it should be configured. With PHP, for example, the “prefix” indicates where it should be installed, the “config-file-path” says where the php.ini file should go (I want PHP and the php.ini to be in different directories than the standard PHP installation), “with-mysqli” includes support for the Improved MySQL functions, and “with-icu-dir” includes support for ICU. The “configure” command has to be preceded by “./”, which means “run the ‘configure’ command in this current directory. You don’t have to use “./” for the other commands as they are all universal commands (i.e., they should be in your path). The “make” command builds the software. If that works, you can then install it. If it doesn’t work, you’ll see errors, which you need to fix before going on. Also note that “make” normally takes some time, like some minutes to a couple of hours, depending upon the complexity of the software and the speed of your computer. The “make install” command actually installs the software. I preface this with “sudo” to run the installation as a super user (because the software will be installed in a directory that I don’t otherwise have access to). And that’s it for building the software. Then I go into Abyss’ Web-based administration window and associate files with an extension of .php with the PHP executable that was installed in /usr/local/php6/bin. This executable is called just “php” (“bin”, by the way, is short for “binary”, and is where executable files are normally found for software that you build).
So installation of PHP 6 wasn’t really too hard and it’s kind of interesting to know how to do it. Just be prepared the first time to do a few searches to figure out why you might be seeing certain errors, because you will see some errors!
In the Forums => Developing an E-Commerce Site
One reader is currently taking the e-commerce information provided in my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” and completing an entire e-commerce application. He’s had lots of good questions along the way, which he’s posted in a few threads in the forum. I think there’s some good information here, which most people will benefit from reading (note that you don’t have to be registered to read a forum posting).
In the first thread–https://www.larryullman.com/forum/read.php?13,33838–the reader asks about the scripts and steps involved in getting from view_cart.php to checkout.php. This process entails getting the customer’s shipping and billing information, validating all that, sending it to the payment gateway (the third-party that actually processes the payment), etc. In the second thread–https://www.larryullman.com/forum/read.php?13,34069–he inquires about how the customer addresses should be stored in MySQL, specifically, how many tables should be used for that purpose. In the third and final thread (to date)–https://www.larryullman.com/forum/read.php?13,34032–the reader follows up on the subject of maintaining sessions when going from HTTP pages to HTTPS. This is a very important question as you’re likely to lose access to the existing session data in the transition. You can also lose the access to the session data in the transfer to and from the payment gateway. There’s lots of good questions in these threads, along with both general and specific advice, and a bit more code.
Book Giveaway Update => “PHP 6 and MySQL 5 for Dynamic Web Sites” Books Have Been Mailed
For my last giveaway, people received free, signed copies of my latest book, “PHP 6 and MySQL 5 for Dynamic Web Sites”. All of those books were mailed at the end of December and in the first week of January. I’ve received word from some people that they’ve received their copies, in places like England, Switzerland, France, and Greece (and in the US, too!). Hopefully you’ve received your copy by now as well. I’m not sure what I can do about it, but if you haven’t received your copy by the end of the month, let me know.
In the next newsletter, or maybe the one after that, I’ll giveaway a handful of more books that I have lying around.
My Book News => “Adobe AIR: Visual QuickPro Guide” Available in Rough Cuts
The book I’m currently working on–“Adobe AIR: Visual QuickPro Guide”–is now available to be read online thanks to the Rough Cuts series. The URL is http://safari.informit.com/9780321524614 With Rough Cuts, you can actually read the book as I write it! Besides being able to look at it months before it’s published, you can also see how the book changes in the process, provide feedback, and more. This isn’t free, of course, as you’re actually getting the entire book in the end (you can’t just read bits of it, as far as I know). According to the information on that site, for $24.49 (US), you can read the book while it’s being written and get a PDF of the final book. This is roughly what the book itself will cost once published (Amazon currently has it listed at $23.09). There’s also an option, for $47.23 (US) to read the book online using Rough Cuts, get a PDF of the book, and get a hard copy when it’s published.
I’ve never personally used Rough Cuts before (as a writer or a reader) so I’ll be interested in hearing people’s thoughts on this.