Getting up and running with PHP on Windows has always been quite easy due to
XAMPP. It provides everything needed
to get started quickly and build something using a default stack available
everywhere. A lot of people get (or got) started this way, including me. But now
that MySQL, PHP, and Apache are setup maybe it’s time to try something new. For
me it’s been a while since I ran a setup like this and so I thought it’s worth
documenting the process.
Getting all the pieces
First of all you’ll need:
- XAMPP for all your PHP and
Apache needs, so install at least PHP and Apache
- Couchbase, remember that you can try
out the Enterprise version for development for free.
XAMPP uses thread safe PHP so make sure you download the correct version
(either x86 or x64 Thread Safe) for your environment.
Getting everything installed
For Couchbase and XAMPP you basically follow the instructions on the screen to
get it up and running, and make sure you configure Couchbase as well at the end
by visiting the web interface. Now all there is left is
moving the PHP stuff into place, which is probably the most complicated part of
a really easy setup. The zip downloaded from the windows PECL
page contains 2 dll files,
libcouchbase.dll and php_couchbase.dll which need to be moved in the right
place. First to make php find libcouchbase it’s needs to be present c:apachebinlibcouchbase.dll and to make sure you can also use
php from the command line also copy it to c:xamppphplibcouchbase.dll and
add the XAMPP PHP to your PATH by going to Control Panel -> System and Security
-> Advanced System Settings -> Environment Variables and edit the PATH
variable by appending c:YOUR XAMPP DIRECTORYphp. And that’s it you are
now ready to use Couchbase in XAMPP, by adding the extension to php.ini, so just add
Try it out!
Create a new PHP file at c:YOUR XAMPP DIRECTORYhtdocscb-test.php containing
and open it in your browser to make apache run
it you should now see the result in your browser.
you can also use the command line of course.
OK so you are now ready to use Couchbase from PHP, and if you need any help and
are in London this week stop by the Couchbase Developer Day as part of Big Data
or even if you don’t still you should still stop by.
You should also checkout Trond Norbye’s Blog basically describing the same setup.