How create your first cakephp project without errors ?

Previously I have experienced cakephp 2.6.1 RC and now I’m going to show to how to create your cakephp project using composer. In the previous version that I’ve used (2.6.1 RC) was a bit dull 😦 , because I’ve simply download it as a default  zip archive and unzipped and used it for developments . In the versions up to 3.x the developers of cakephp added the “composer”  dependency manager to give the real developing experience to the users 🙂 .

Ok , lets start …

before this your development environment must have the following requirements,

  • php version >=5.6.4 , php 7 is good 🙂 .
  • Composer dependency manager
  • Apache (httpd) server 2.4.
  • Mysql database server >= 5.6 .

In this example I’ve used wamp server 2.5 on windows and updated the php version to 7.0.23 on wamp.

first you must open a command prompt on windows and move to “wamp\www” folder and issue the following command ,

c:\wamp\www\ composer create-project –prefer-dist cakephp/app test_cake3

then you must wait for 2 to 4 minutes to install the cakephp project on your computer.

After that move to the newly created project folder typing the following command

c:\wamp\www\ cd test_cake3

Then  you must issue the following command to run the project

c:\wamp\www\test_cake3\php -S localhost:8000 -t webroot

Here the “webroot” is your assets directory

So you can get the below as the welcome screen 🙂 ..

cake_first_run

Ok , that rocks 🙂 , But it shows an alert in red as show in below screenshot 😦 ..

cake_db_error

So , How to resolve this ?

Here we have to do two things,

  1. Make the “my_app” database and,
  2. Edit the “config/app.php” file parameters.

Ok , lets do it 🙂 .

First open the mysql cli and issue the following command on it.

make_mysql_schema

After that edit the “config/app,php” file. Scroll down the code until you find “Datasources” settings.

The default configurations of “config/app,php” file as below,

default_db_param

Apply the database name, username and password settings according to your mysql server settings. Here I have applied my computer’s mysql server parameters 🙂 as below screenshot.

modified_db_param

After that save the settings and refresh your cakephp welcome page . Here you can see that red  icon goes green 🙂 .

after_resolving_db_params

So this is the method of fresh installing cakephp version 3.x project , here in my case “3.5.2 red velvet” on windows environment  : -).

Have a nice day 🙂 … !

Advertisements
How create your first cakephp project without errors ?