Debian 12 bookworm
Sponsored Link

CakePHP : Install2023/07/14

 
Install CakePHP which is a PHP Web application framework.
[1] Install required PHP modules first.
root@dlp:~#
apt -y install composer php-curl

[2] Create a CakePHP test project with a common user.
debian@dlp:~$
mkdir test-project2

debian@dlp:~$
cd test-project2
# create [my-app] CakePHP project

debian@dlp:~/test-project2$
composer create-project cakephp/app my-app

Creating a "cakephp/app" project at "./my-app"
Info from https://repo.packagist.org: #StandWithUkraine
Installing cakephp/app (4.4.2)
  - Downloading cakephp/app (4.4.2)
  - Installing cakephp/app (4.4.2): Extracting archive
Created project in /home/debian/test-project2/my-app

.....
.....

Created `/home/debian/test-project2/my-app/tmp/cache/views` directory
Set Folder Permissions ? (Default to Y) [Y,n]? Y
Permissions set on /home/debian/test-project2/my-app/tmp/cache
Permissions set on /home/debian/test-project2/my-app/tmp/cache/models
Permissions set on /home/debian/test-project2/my-app/tmp/cache/persistent
Permissions set on /home/debian/test-project2/my-app/tmp/cache/views
Permissions set on /home/debian/test-project2/my-app/tmp/sessions
Permissions set on /home/debian/test-project2/my-app/tmp/tests
Permissions set on /home/debian/test-project2/my-app/tmp
Permissions set on /home/debian/test-project2/my-app/logs
Updated Security.salt value in config/app_local.php

debian@dlp:~/test-project2$
cd my-app

debian@dlp:~/test-project2/my-app$
./bin/cake server -H 0.0.0.0 -p 8765


Welcome to CakePHP v4.4.15 Console
-------------------------------------------------------------------------------
App : src
Path: /home/debian/test-project2/my-app/src/
DocumentRoot: /home/debian/test-project2/my-app/webroot
Ini Path:
-------------------------------------------------------------------------------
built-in server is running in http://0.0.0.0:8765/
You can exit with `CTRL-C`
[Thu Jul 13 19:21:20 2023] PHP 8.2.7 Development Server (http://0.0.0.0:8765) started
  Access to the URL you set from any client computer, and then that's OK if following site is shown.
[3] Create a sample Hello World app.
debian@dlp:~$
cd ~/test-project2/my-app
debian@dlp:~/test-project2/my-app$
vi src/Controller/HelloWorldController.php
# create new

<?php

namespace App\Controller;

class HelloWorldController extends AppController
{
    public function index()
    {
    }
}

debian@dlp:~/test-project2/my-app$
mkdir templates/HelloWorld

debian@dlp:~/test-project2/my-app$
vi templates/HelloWorld/index.php
# create index

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hello World</title>
</head>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Hello CakePHP World!
</div>
</body>
</html>

debian@dlp:~/test-project2/my-app$
./bin/cake server -H 0.0.0.0 -p 8765

Matched Content