develop with cakephp and eclipse in Windows

if you do not have apache php mysql in your computer, download one from somewhere.

download xampp from http://www.apachefriends.org/en/xampp-windows.html

you may need to set memory_limit=256M or more

download cakephp from http://cakephp.org/

my version is 1.3.8
extract to local web server root, for example: E:\zwamp\vdrive\web\cakephp
you will have “app” and “cake” and other cakephp folders in this folder.

if you need to use bake, you need to config environment variables. see the link below if you don’t know how.
http://tv.cakephp.org/video/gwoo/2010/12/24/setting_up_the_cakephp_console_on_windows

Add environment variables
E:\xampp\php;E:\xampp\htdocs\cakephp\cake\console

Important!! to run bake, your eclipse workspace is better in the same drive as xampp.
Download eclipse
http://www.eclipse.org/ choose download, choose Eclipse for PHP
extract to somewhere, for example: E:\eclipse

launch eclipse by clicking E:\eclipse\eclipse.exe
when being asked, choose E:\xampp\htdocs\ as your workspace

In eclipse, choose file -> new -> PHP Project.
In project name, type cakephp. If you want another name, you need to change file folder name that you extracted cakephp as well.

Note that, if you choose “Create project at existing location”, you will receive an error saying “cannot create project content in workspace”.
You can now start using cake php in eclipse.

To make eclipse recognize cakephp template files, go to Window -> Preferences -> General -> content Types -> Text -> PHP Content type -> Add, then add *.ctp.

To run bake, add a external command and use the settings similar to below:

Location: E:\xampp\htdocs\cakephp\cake\console\cake.bat
Working Directory: ${project_loc}/app
Arguments: bake

Some says it can autocomplete views but it does not work for me…
http://bakery.cakephp.org/articles/gravyface/2009/07/23/how-to-add-autocomplete-to-eclipse-aptana
add cake/tests/cases/libs to exclude pattern
There is a good manual in cakephp site but it is for Ubuntu. Some of them can also apply to Windows.
http://bakery.cakephp.org/articles/rynop/2010/11/11/howto_setup_eclipse_3_6_to_get_the_most_out_of_cakephp_1_3_development

Leave a Reply