Posted on: 12/04/2018
This is a complete instruction on how to install CakePHP on Windows and set up dependencies to run Cake App on XAMPP virtual server.
This instruction guides you step by step to install CakePHP and MySQL Database virtual server on Windows operating system, then set up the required dependencies to connect CakePHP application to database and run it on virtual server.
Initial requirements:
Composer
is a tool for managing dependencies in any PHP Frameworks. You can declare, install and update PHP libraries for your project. You can install Composer
using either the installer or command-line.Once you're done with the above requirements, Let's get started, it only takes a few minutes.
Step 1: Disable your Windows User Account Control (UAC
) if you wish to install the tools for all users on your Windows. Apart from that, UAC
sometimes prevents the software from setting permissions or adding new entries to the environment PATH
variables.
PATH
variables then you can skip this step. You can also enable UAC
when you finish setting up CakePHP.Step 2: Run XAMPP installer and let it finish. Make sure Apache
, MySQL
, PHP
and phpMyAdmin
are checked at Select Components. You may need Mercury
Mail Server, Webaliser
and Fake Sendmail
later so it's up to you to decide.
C:\xampp
Step 3: Set up XAMPP dependencies:
Apache
and MySQL
services.C:\xampp\phpMyAdmin\
$cfg['Servers'][$i]['auth_type'] = 'cookie';
MySQL
service to open phpMyAdmin
, which is a local database server management tool.root
for username and blank password. Make sure you change your root password after login.After logging in, please set your password by clicking "Change password".
localhost
. Enter your username and password.Control Panel / System / Advanced system settings / Environment Variables / System variables / Path
, then add new path to php.exe to the list.C:\xampp\php
.php -v
. You should see your PHP version.Step 4: Set up composer and CakePHP:
composer.phar
executable will be added to Environment Variables automatically.php -r "readfile('https://getcomposer.org/installer');" | php
, then add the composer.phar
executable to your Environment Variables as the guide above.C:\Users\Jay\AppData\Roaming\Composer\vendor\bin
Step 5: Set up PHP dependencies to work with CakePHP:
C:\xampp\php
, then uncomment this line by removing the semicolon to enable the PHP intl
extension: extension=intl
C:\xampp\php
, copy the files with name icu*.dll
, then paste and replace the corresponding files in folder C:\xampp\apache\bin
Apache
and MySQL
services in XAMPP controller, open new command-prompt and use this command to have composer generate your first CakePHP project:php composer.phar create-project --prefer-dist cakephp/app your_app_name
C:\xampp\htdocs
, the default project folder location is C:\Users\Jay\
localhost
via this link: localhost/your_app_name
.Step 6: Set up your MySQL database server:
C:\xampp\htdocs
.SQL
commands to create tables.Step 7: Connect your project to Database and bake your tables:
C:\xampp\htdocs\jayblog\config\
Security.salt
, which will be used for password hashing:Datasources.default
as following:You're almost done now, let's bake your first table into the project:
cake
executable of your project to Environment Variables to let the system recognize your Cake app: C:\xampp\htdocs\your_app_name\bin
cd
to your project folder then run command: cake bake all
cake bake all table_name
.That's the last step. Now look at your project folder, there will be the models, controllers and views for every table in the database. From now, it's so easy to go on and quickly complete any web applications with CakePHP.