XAMPP is one of the easiest options to develop using PHP or PHP CLI. I use CakePHP for development and one of the features of CakePHP is to back the MVC. In this guide, we’ll see how to get started. This tutorial doesn’t teach you how to use CakePHP’s bake feature. This guide is specifically written for Windows Vista or Windows 7.
To run XAMPP’s PHP CLI, you first have to set up the environment variables for PHP CLI. Also introduce how to get started on CakePHP’s console.
1. Setting up environment variables
Firstly, we would need to let the command prompt know where to find php.exe. In my computer set up, it is located in ‘C:\xampp\php\’. Yours might be in ‘C:\xampp-lite\php\’ depending on where you install your XAMPP.
We need to edit some system environment variables:
Click on ‘Edit the system environment variables’, a dialog box will pop up. Click on ‘Environment Variables…’, you should be greeted with the following dialog box:
My path looks like this before I add anything:
Append your XAMPP PHP directory at the back of what is already there:
Open a new command prompt (don’t use existing one), and type “php” and see if there are any problems.
2. Avoiding MSVCR71.dll error
I encountered an error: “php.exe – System Error: The program can’t start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem.”.
Open the file ‘php.ini’ in ‘C:\xampp\php\’ and search for “pgsql”. Disable the extension by placing a semicolon in the beginning of the line this way:
3. Command Prompt’s “Start in” setting
You can have multiple shortcuts of command prompts in your desktop. I set my command prompt shortcut to start in ‘C:\xampp\htdocs\dev\app’ which is my CakePHP application folder:
And when I run the command prompt, it will show:
Microsoft Windows [Version 6.1.7000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
This is just more convenient without having to navigate through the folders again and again.
4. Running the CakePHP console
You should run the Cake console in your application folder this way:
This runs the ‘cake’ program and tells it to bake.
For a list of CakePHP console commands to use, you can try:
You can also put the CakePHP console path in your Windows environment variables. However note that if you have multiple projects with different versions, this method is less than ideal. Hope it helps.