Ubuntu 24.04
Sponsored Link

CakePHP : स्थापित करना2024/05/17

 
CakePHP इंस्टॉल करें जो एक PHP वेब एप्लिकेशन फ्रेमवर्क है।
[1] पहले आवश्यक PHP मॉड्यूल स्थापित करें।
root@dlp:~#
apt -y install composer php8.3-curl php8.3-sqlite3
root@www:~#
vi /etc/php/8.3/cli/php.ini
# पंक्ति 1614 : चालू पर बदलें

zend.assertions =
1
[2] एक सामान्य उपयोगकर्ता के साथ CakePHP परीक्षण प्रोजेक्ट बनाएं।
ubuntu@dlp:~$
mkdir test-project

ubuntu@dlp:~$
cd test-project
# [my-app] CakePHP प्रोजेक्ट बनाएं

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

Creating a "cakephp/app" project at "./my-app"
Installing cakephp/app (5.0.1)
  - Downloading cakephp/app (5.0.1)
  - Installing cakephp/app (5.0.1): Extracting archive
Created project in /home/ubuntu/test-project/my-app
Loading composer repositories with package information
Updating dependencies
Lock file operations: 86 installs, 0 updates, 0 removals

.....
.....

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

ubuntu@dlp:~/test-project$
cd my-app

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


Welcome to CakePHP v5.0.8 Console
-------------------------------------------------------------------------------
App : src
Path: /home/ubuntu/test-project/my-app/src/
DocumentRoot: /home/ubuntu/test-project/my-app/webroot
Ini Path:
-------------------------------------------------------------------------------
built-in server is running in http://0.0.0.0:8765/
You can exit with `CTRL-C`
[Fri May 17 02:08:01 2024] PHP 8.3.6 Development Server (http://0.0.0.0:8765) started
  किसी भी क्लाइंट कंप्यूटर से आपके द्वारा सेट किए गए यूआरएल तक पहुंच, और फिर यदि निम्न साइट दिखाई जाती है तो यह ठीक है।
[3] एक नमूना हैलो वर्ल्ड ऐप बनाएं।
ubuntu@dlp:~$
cd ~/test-project/my-app
ubuntu@dlp:~/test-project/my-app$
vi src/Controller/HelloWorldController.php
; नया निर्माण

<?php

namespace App\Controller;

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

ubuntu@dlp:~/test-project/my-app$
mkdir templates/HelloWorld

ubuntu@dlp:~/test-project/my-app$
vi templates/HelloWorld/index.php
; सूचकांक बनाएं

<!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>

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

मिलान सामग्री