</> Code The Pixel

CakePHP 4 Installation & Configuration

Asyraf Wahi Anuar - May 10, 2020

Estimated reading time: 1 minute, 33 seconds

This tutorial will guide you to install the CakePHP 4 using composer. The composer is a dependency manager. All developer is recommended to use composer as it is easier to maintain the codes and the framework package compared to the .zip archive. Database configuration is also included at the end of this tutorial.

CakePHP 4 requirement:
- HTTP Server. For example Apache. Having mod_rewrite is preferred, but by no means required. You can also use Nginx, or Microsoft IIS if you prefer.
- Minimum PHP 7.2 (7.4 supported).
- mbstring PHP extension
- intl PHP extension (uncomment extension=php_intl.dll in php.ini and restart the server)
- simplexml PHP extension
- PDO PHP extension

Tools:
- XAMPP with PHP 7.2 (minimum)
- Composer 1.10.6 or latest version

Install Composer. Download at composer website.
Check PHP version using CLI

php-v

Make sure the PHP version is 7.2 and above.

Download and create a CakePHP project
Execute the Command Prompt/ Windows Power Shell/ Git Bash and navigate the target directory to your htdocs path. If XAMPP is installed in C, then the command should be:

cd c:/xampp/htdocs


Then execute this command (myCake4 is your folder name - change to your own folder name):

composer create-project --prefer-dist cakephp/app:4.* myCake4


Composer will generate the myCake4 folder and download all CakePHP 4 source files:



Once the download process is complete, navigate to localhost/myCake4 and it will redirect you to the main page for CakePHP 4.



When this tutorial is written, the latest version of CakePHP 4 is 4.0.7. If you want to update your CakePHP 4 version, just navigate to the myCake4 path and run:

composer update


To update your database configuration, navigate to .../config/app_local.php and edit the following codes (around line 37):

'Datasources' => [
	'default' => [
		'host' => 'localhost',
		//'port' => 'non_standard_port_number',
		'username' => 'root',
		'password' => 'secret',
		'database' => 'yourDBname',


That all. Happy coding :)


Cite this article (APA 6th Edition)

Popular
CakePHP 4 Print PDF Using CakePDF
May, 17 2020
CakePHP 4 Authentication Using Auth...
May, 14 2020
CakePHP 4 Sending Email
February, 01 2022
CakePHP 4 jQuery Date Time Picker
October, 01 2018
CakePHP 4 Export To CSV
May, 29 2020
CakePHP 4 Authentication Using...
May, 11 2020
CakePHP 4 Find, Sort & Count
June, 02 2020
Share
Sharing Link
Click the icon to share