CakePHP : Install2022/06/24 |
Install CakePHP which is a PHP Web application framework.
|
|
[1] | Install required PHP modules first. |
[root@dlp ~]#
[root@dlp ~]# dnf -y install php-intl php-xml php-mysqlnd curl -sS https://getcomposer.org/installer | php All settings correct for using Composer Downloading... Composer (version 2.3.7) successfully installed to: /root/composer.phar Use it: php composer.phar[root@dlp ~]# mv composer.phar /usr/local/bin/composer [root@dlp ~]# chmod 755 /usr/local/bin/composer |
[2] | Create a CakePHP test project with a common user. |
# create [my-app] CakePHP project [cent@dlp test-project]$ composer create-project cakephp/app my-app Creating a "cakephp/app" project at "./my-app" Installing cakephp/app (4.4.1) - Installing cakephp/app (4.4.1): Extracting archive Created project in /home/centos/test-project/my-app Loading composer repositories with package information Updating dependencies Lock file operations: 92 installs, 0 updates, 0 removals ..... ..... 26 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating autoload files 57 packages you are using are looking for funding. Use the `composer fund` command to find out more! PHP CodeSniffer Config installed_paths set to ../../cakephp/cakephp-codesniffer,../../slevomat/coding-standard > App\Console\Installer::postInstall Created `config/app_local.php` file Created `/home/centos/test-project/my-app/logs` directory Created `/home/centos/test-project/my-app/tmp/cache/views` directory Set Folder Permissions ? (Default to Y) [Y,n]? y[cent@dlp test-project]$ cd my-app [cent@dlp my-app]$ ./bin/cake server -H 0.0.0.0 -p 8765 Welcome to CakePHP v4.4.1 Console ------------------------------------------------------------------------------- App : src Path: /home/centos/test-project/my-app/src/ DocumentRoot: /home/centos/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 Jun 24 15:56:37 2022] PHP 8.0.13 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. |
[cent@dlp ~]$
cd ~/test-project/my-app
[cent@dlp my-app]$
vi src/Controller/HelloWorldController.php # create new <?php namespace App\Controller; class HelloWorldController extends AppController { public function index() { } } # 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> ./bin/cake server -H 0.0.0.0 -p 8765 |
Sponsored Link |