Learning how to install CakePHP on Debian 11 is a good way to start developing web applications with PHP. This framework stands out for its low learning curve while remaining secure and modern.
CakePHP is a PHP framework that is fast, efficient, and easy to learn. Fortunately, it is open source and is powered by the contributions of the community. The goal of CakePHP is to provide developers with a solid and secure foundation with which to create their web applications.
Among PHP frameworks, CakePHP comes out on top in popularity as one of the most widely used. Some main features of CakePHP are:
- Flexible licensing
- Compatible with PHP4 and PHP5
- Built-in CRUD for database interaction
- Application support [scaffolding]
- Code generation
- Model View Controller (MVC) architecture
- Request dispatcher [dispatcher], with clean custom URLs and routes
- Integrated validation
And many more.
Install PHP and some extra modules
Before installing CakePHP it is necessary to install PHP and some of its modules on the system. To achieve this, open a terminal or connect via SSH and update the system.
sudo apt update sudo apt upgrade
And run this command to install PHP and its modules at once.
sudo apt install php php-zip php-intl php-pdo php-intl php-xml php-zip php-mbstring php-xml php-zip php-mbstring php-xml php-zip php-mbstring unzip
You can check the version of PHP running
php -v PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
Installing Composer on Debian 11
Now we need Composer to install CakePHP. To download it to the system, run.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
Now install it
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Assign it execution permissions to be able to use it.
sudo chmod +x /usr/local/bin/composer
Check that Composer is installed by
composer -V Composer version 2.2.7 2022-02-25 11:12:27
So, everything is fine.
If you want to learn more about Composer, we have the correct post for you.
We can continue.
Installing CakePHP on Debian 11
Now we can install CakePHP thanks to Composer. To complete this, run.
composer create-project --prefer-dist cakephp/app [project-name]
Remember to modify
[project-name] with the name of your project. At the end, the command will look like this.
composer create-project --prefer-dist cakephp/app new-project
At the end of the command execution, a new folder with the name of your project will be created. Now you need to access it, so you can notice the CakePHP structure.
Then you just have to start configuring it to your liking. If you want to serve your project, you have to run.
Although, if you are working on a virtual machine or a server, you can specify a port and a host.
bin/cake server -H [host] -p [port]
All that remains is to open a web browser and go to
http://localhost:8765 or to the host and port of your choice. If all goes well, you will see this screen.
So, this indicates that CakePHP is installed, running, and we can start working with it.
So, CakePHP is a vital PHP framework for many web developers. It has everything necessary to be considered one of the best, with a fairly low learning curve.
I hope this post has been useful for you. Help us to grow by sharing this post.