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.
In a current Project I’ve been working with a Cappucino frontend and a CodeIgniter Backend. Since Cappucino just loves JSON I decided this is the way to go, sadly PHP doesn’t provide a standard way to interact with a JSON POST but with a little helper this can be solved easily. I made a Gist out of it so it can be improved apon and reused.
Automatic deployment is essential for any project which is supposed to be worked on and run continuously. Until recently I was using capistrano to do this, but since development seems to have kind of stalled recently I decided to look around for an alternative, which I found in deploy a shell script by TJ Holowaychuk. To check it out I am currently using it to deploy a small Codeignitor project I am working on the side and use to try out new stuff. It really is easy to use and quite flexible due to allowing pre and post deploy hooks as well as automatic tests to check if the deployed version is working, and rollback if it is not. The use with CI is quite simple the only thing todo is to make sure that the right permissions are set which can be easily handled by a post-deploy shell script.
On the server it creates a simple directory structure with
in my case for both staging and production. This is done via an initial
deploy [ENV] setup
all following deploys are done by issueing
For some reason some commands were not working for me in Bash ond my Mac so I had to do some small ajustments, I guess it is due to the version of bash I am using being not current maybe. You can find them in my fork
Just some quick notes on zend and doctrine. Right now I am in the process to rewrite a web application which is based on zend and doctrine, and in the process is ported over to the latest versions of both. Since doctrine does not integrate completely seamless in zend, yet, there is some glue code to be included to make it work. While looking for the right way to do it I came across a video which explains everything nicely. The code which holds everything together is Bisna which is available as part of NOLASnowball. To make it work simply check out the
$ git clone https://github.com/ralphschindler/NOLASnowball
$ git co doctrine2-managed-crud
and copy Bisna, Symphony, Doctrine from the library folder to your project, also the application.ini file needs to be adjusted to. For a more extensive explanation check out the video mentioned above.