specializing in digital media technologies

Digital Media and Communications Insights, Inc.


Larry Ullman's Blog

Installing PHP6 on Windows

When I went to write the third edition of my PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide book, I had to decide what version of PHP to support. PHP5 had been out some time and PHP6 was more than 50% ready to go. The primary alteration in PHP6 is support for Unicode, a change that Ruby is also making in version 1.9. This is a big deal, so I thought I’d include support for PHP6 in the book. Now, just over a year later, there’s no news on PHP6 and, from what I gathered, there’s not a pressing drive to get it out anytime soon, either. Such are the potential problems when it comes to writing about open source software: you really never know what you’re going to get or when. Obviously the situation isn’t ideal but only two chapters in the book require PHP6, and some features originally intended for PHP6 have been added to PHP5. Still, some users reading the book (rightfully) want to test or play with the forthcoming, primarily Unicode-related, features I discuss in those two chapters. In order to do so, you’ll need to do what I did in order to write the book: install a beta version of PHP6 on your computer. In this post, I’ll walk you through that process for Windows users (I’ll address non-Windows users separately).No matter what version of PHP you’re using, you need to run it through a Web server (unless you’re using it for command-line purposes only). Normally I would run PHP through Apache, even on Windows. Generally I advise beginning Windows users to install something like XAMPP, which is an easy, no-nonsense all-in-one packager for PHP, Apache, MySQL and more. So as not to have the PHP6 installation conflict or harm any existing PHP setups, I would recommend using another Web server for PHP6. In this example, I’ll use Abyss, from Aprelium, a nice, simple to use, lightweight alternative to Apache. You can also use Internet Information Services (IIS), the Microsoft Web server, but I’m much less familiar with it.

To start, download a snapshot of PHP6. A snapshot, in case you’re not familiar with it, is just a reflection of the software at a moment in time. For example, a snapshot may be what PHP6 looks like at February 17, 2009 at midnight. Note that snapshots are not intended for production use. Most PHP snapshots are at http://snaps.php.net. For Windows, you need to head to http://windows.php.net/snapshots/. As I write this, that page has snapshots available for three versions of PHP: 5.2, 5.3, and 6.0. For Windows running Apache or Abyss, you want to download the file named PHP 6.0 – Windows x86 VC6 (thread safe). The downloaded file is a ZIP that needs to be extracted. I extracted all of my files into a newly created C:\php6 directory.

Next you need to download and install Abyss. For this article, I used version X1, which is free. The Abyss installation process is really simple and needs no further explanation from me (check the official documentation if you have questions). After you’ve installed Abyss, start it up and you can configure it for PHP. Much of this information comes from Abyss’ own documentation for installing PHP, but with my own images (click the appropriate links to see them). After you register and login, you’ll be brought to the Abyss Web Server Console. Click “Configure” for the default host (note that your default host may run on a port other than 80 if you have another Web server installed). On the resulting page, click on “Scripting Parameters”.

On the Scripting Parameters page, make sure that “Enable Scripts Execution” is checked. Then click “Add” in the “Interpreters” table. This will take you to a new page. On that page, set the “Interface” to “FastCGI (Local – Pipes)”. Then click Browse next to the “Interpreter” and select the php-cgi.exe file in the extracted PHP6 snapshot folder. Don’t select the php.exe or php-win.exe file, use php-cgi.exe, which is explicitly for FastCGI usage. Change the “Type” to “PHP Style” and make sure the “Use the associated extensions to automatically update the Script Paths” box is checked. Click “Add” in the “Associated Extensions” table. In the popup window, enter php and click OK. This last step associates files with a .php extension wtih the PHP6 executable. (As an aside, if you wanted to use Abyss for multiple versions of PHP, you could associate .php with a PHP5 executable but .php6 for PHP6.) Then click OK to leave the Interpreters page. This will return you to the “Scripting Parameters” page.

Back on the “Scripting Parameters” page, click “Add” in the “Custom Environment Variables” table. In the resulting window, type REDIRECT_STATUS as the “Name” and 200 as the “Value”, then click OK. You’ll need to click “OK” on the “Script Parameters” page, which will take you back to the Abyss Web Server Console page. There, if you want, use the “Index Files” page to add index.php as an acceptable index file. Then, restart Abyss.

After you do all this, you can use a phpinfo() script to confirm the version of PHP that you now have running. And that’s it! Enjoy playing with PHP6 and let me know if you have any questions or problems (issues related to installation can be made as comments here; other questions should go in the book forums).

Filed under: PHP,Web Development — Tags: , , ,

10 Comments »

  1. Now that’s an easy install for a web server! I installed it on Windows Vista 64bit with not one problem at all.

    I went a little bit further and added a windows registry key that points to the php.ini file. The key is HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath

    And for me, I set that to C:\php5
    (Yeah, I just installed php5 :) )

    I did have to rename the php.ini-recommended file in the C:\php5 folder to php.ini (I’ve used that php.ini for every php installation — use which ever one you want)

    After that, restarting the web server showed the correct Loaded Configuration File and magic_quotes_gpc had been turned off. Those are normally the two things I look for first to make sure the new ini file is taking affect.

    Thanks for the article, the step by step was perfect. :)

    Comment by Floydian — February 17, 2009 @ 6:21 pm

  2. Thanks for the feedback and the confirmation that it worked. Lots of credit goes to Abyss, of course. Thanks for the php.ini mention, too. I forgot to address that. Another thing I always recommend in the PHP configuration is that error reporting is set to the highest level and display errors is enabled (for non-live sites, that is).

    Comment by Larry — February 17, 2009 @ 9:12 pm

  3. I find it absolutely ridiculous that someone would have even written a book on php6 yet let alone had it already published.

    I guess were (yes, our community has to field questions by newcomers to php about the discrepancies in your books) just lucky you didn’t seem to get into describing the use of name spaces (one of php6′s biggest features IMO) since the syntax has completely changed since your book was published.

    Comment by tbar — July 31, 2009 @ 6:02 pm

  4. Thanks for your comments, but I humbly disagree with pretty much everything you state. First, the book only requires PHP 6 for about 10% of the content, at most. Second, I was able to write about PHP 6 because even though it’s not (still) released, I did use the source code when I wrote the book. So the book was accurate with respect to PHP 6 as much as any book is accurate when it’s written. And, my assumption was that PHP 6 would be out in the near future, which I was clearly wrong about.

    As for the specifics on namespaces, those ended up being added to PHP 5. And I don’t discuss those because I don’t discuss OOP in this book. My main focus in the book with respect to PHP 6 was Unicode.

    So, with all due respect, I find your comments to be not “absolutely ridiculous”, but misinformed and misplaced. And if you’re out there trying to clear up my mistakes, then I do worry for those PHP newbies. For example, ‘namespace’ is one word.

    Comment by Larry — September 18, 2009 @ 2:58 pm

  5. I agree with Larry on tbar’s comment. Any technology book, or web book for that matter, prepares you for the next generation of software. It is not right to publish a book completely on PHP 6 as it has not yet been released. Though, as someone WHO HAS READ THE BOOK I’m glad Larry discussed the small percentage that he did on what’s to look forward to in the next PHP edition, like Unicode support for example.. which is one of the few issues I have with PHP 5.

    Comment by Omar — November 5, 2009 @ 1:14 am

  6. Thanks, Omar, for the input. I appreciate the perspective on this. Unicode is definitely the future of Web development and programming, and I did think it worth discussing in the book. Larry

    Comment by Larry — November 5, 2009 @ 2:37 pm

  7. Hello,
    where PHP 6 can be found?
    I visited http://windows.php.net/snapshots/ but there are no any downloads for version 6.

    Comment by AlikT — December 18, 2009 @ 1:08 am

  8. Wow. Strange. Not sure what happened there but I assume it’s only temporary. That’s where you’d find the Windows version of PHP 6, when it’s available (in beta format). In the interim, you could use AppServ. Sorry for the inconvenience!

    Comment by Larry — December 19, 2009 @ 8:49 pm

  9. Larry, thank you for the reply.
    I visited AppServ — there is an alpha version of MySQL 6. Is it suitable for the “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide” book?

    Comment by AlikT — December 20, 2009 @ 9:06 am

  10. Yes, I’m sure that will be fine for non-production purposes.

    Comment by Larry — December 22, 2009 @ 8:11 am

RSS feed for comments on this post. TrackBack URL

Leave a comment




If you have a question, are seeking information, want to download files, or generally have any need related to a specific book, please make sure you are using the correct link. Check both the title and the edition.