you installed 7 either MAMP for Mac as x or WAMP for Windows. That collection of programs, all conveniently bundled together, gave you not just PHP but also MySQL plus an Apache web server and a few other goodies like phpMyAdmin and SQLiteManager. It’s easy to install and lets you control all your programs from a centralized manager.
On the other hand convenience almost always costs you control. In the case of WAMP you lose the ability to pick a specific version of PHP. In fact you’re often going to end up with a version of PHP that’s several months behind the latest stable release simply because that’s the amount of time it takes the good folks at WAMP to update their bundle to that release. (For more information on releases see the box )
Most of the time none of this is an issue. But as you become more familiar with PHP (and more advanced) you might want to take back some of the control you gave up for the convenience of WAMP. If that’s the case then you’ll want to install PHP manually and this appendix instructs you how .
Release the Version Within
If you’ve never worked with software that comes in versions or releases don’t worry it’s easy. A software is simply a program (or more often than not a package of programs that work together) that’s ready to install on your computer.
Because software changes frequently, though, the folks that make software need a way to say, “Hey, our software has some new cool bells and whistles! There’s a new package available Software companies use to do that. Generally, software starts out at version 1.0,and that number increments higher as the software adds new features. Thus, version 2.2 of PHPis newer than version 1.1,and probably will have some cool new features, too.
Sometimes as on the PHP website you’ll see several different packages or downloads, each with a different version number. Most of the time, you want to download the most recent version. Most important, ensure that you’re downloading the correct version for the operating system you’re using .
Installing PHP from www.php.net
Open your favorite web browser and head to www.ono.net, This website is the online home of PHP and it’s where you’ll download your own version of the PHP language along with all the tools you need to write and run PHP programs. Look along the right side of the PHP home page for the Stable Releases heading you can see it on the right of Figure A-1.
Click the link for the version with the highest number
Once you’ve chosen a PHP version link, you’ll see a screen similar to Figure A-2, with links for the current version of PHP as well as at least one older version (which you can identify by the lower version number) .
Before you download PHP,though,look for a link called Windows Binaries; that’s your ticket to getting PHP up and running on your Windows-based computer, Clicking this link takes you to another site, which should look something like Figure A-3.
This page has options for the latest version and well as several older versions. For the newest version, there will be two big, gray blocks: the first for the Non Thread Safe version, and the second for the Thread Safe version. You want to download the Non Thread Safe version. To learn why, read the following box.
PHP on Windows: Fast or Safe?
PHP first appeared in a Windows-friendly version back in 2000. In those early releases PHP came in only one flavor Thread Safe.Whereas Macas x and Unix/Linux systems use something called to run multiple things at one time, Windows systems use Those Windows threads can interact with each other. To prevent them from messing one another up, PHP came in a version that was sele.
Unfortunately, keeping those threads out of each other’s way takes a lot of time. Yes thread-safe PHP on Windows is slow and PHP programmers flocked ?way from Windows whenever possible. A few clever PHPprogrammers figured out ways to recycle threads and a lot of web servers that run on Windows now come pre installed with a PHP version that can recycle threads right fram the start.
Chances are that if you don’t have a strong opinion or idea about which version of the PHPbinaries you need, you’ll do great with the non-thread safe binaries, and you’ll get a nice snappy performance. If you have real concerns about the non-thread safe version, you can certainly choose the thread safe binaries and tweak your own installation as you see fit.
Just look for the Installer option and click the link. The download is usually large but includes a nice Windows installer that will make getting PHP running a breeze. Click this link and then grab a cup of coffee while you’re waiting for your download to complete.
Once your download is done find the downloaded file and double-click it. Let Windows run the installer and then click Next on the pop-up screen to start the installation.
You have to accept a license agreement and then select an installation directory. Going with the suggested directory C.is a good idea unless you have a specific reason not to. Next, the installer asks you about configuring a web server, as shown in Figure A-4. For now, you’ll be using PHP on your computer to test programs and then upload those programs to a web server so you can select “Do not setup a web server.” If you want to add a web server later you can always come back and add or change this option.
Next. be prompted about which items to install. The default options shown in Figure A-5 are fine for now. Just click Next to go to the next screen.
Finally, click Install and then let your progress indicator march to full. That’s it! You’ve got PHP running on your computer.
To check out PHP open a command prompt and type php_version, as you see in Figure A-5.
Even though it doesn’t look like much, that blank line and empty command prompt means PHP is installed correctly. Now, you’re ready to get into your first program or if you’ve already worked through this book, your twentieth …or your hundredth! And anytime you want to update your PHP installation, just revisit WWW.Oil.net and download a new version.