How to install CakePHP on Debian 10?

0
171

The development of web applications seems to be fashionable these days. Many young people start their way of developing applications for the web. And for that, a Linux distribution is the most recommendable thing to use. Because it provides stability and above all, the tools to make the process without problems. For web development there are certain languages that can be used, perhaps PHP is the most popular of them. And in PHP we have many frameworks to speed up the development. So in this post, I will show you how to install CakePHP on Debian 10. It is one of the most popular because of its low learning curve.

CakePHP it is a good framework

CakePHP is a PHP framework for web application development. It is known to be one of the easiest to learn. However, do not be fooled by its ease of learning, it is also one of the most powerful.

As expected, CakePHP is open source and is compatible with both Apache and Nginx. It also supports various database handlers such as MySQL, MariaDB, SQLite or PostgreSQL.

So let us go for it.

Install CakePHP on Debian 10

1) Install LAMP on Debian 10

First of all, you have to have a working LAMP server. As I told you at the beginning, it is also possible to run it with Nginx. However, for this tutorial, I will use Apache.

The LAMP server is absolutely necessary to “deploy” the application once finished. However, it is not indispensable for development. Although it is good to install it at once.

Read How to install LAMP on Debian 10?

Just be sure to install these PHP extensions

php-pdo php-intl php-xml php-zip php-mbstring

Now we can continue.

2) Install Composer on Debian 10

One of the best ways to install CakePHP is to use Composer. Composer is an open-source and cross-platform PHP dependency manager. It is a wonderful tool for our PHP projects.

Read, How to install Composer on Linux?

Now, we can install CakePHP.

3) Install CakePHP on Debian 10

Now we can start installing CakePHP on Debian 10. For that, we will use composer to create the project all at once.

In the terminal, run the following command:

:~$ composer create-project --prefer-dist cakephp/app myproject
1.- Install CakePHP on Debian 10
1.- Install CakePHP on Debian 10

Replace “myproject” by the name you want to yo your project. The installation will take some time.

If you want to use the CakePHP command, it needs to have run permissions.

:~$ cd myproject
:~$ chmod +x bin/cake

Now you can start developing your application with your favorite text editor. You can also use the project to see the changes in the web browser as if it were the real web server.

To do this, run the following command:

:~$ bin/cake server
2.- Serve the application
2.- Serve the application

This will make the application available at http://localhost:8765. However, we can also specify a host and a specific port with the following command:

:~$ bin/cake server -H [host] -p [port]

Now, you can open your web browser and check that everything is OK.

3.- CakePHP running
3.- CakePHP running

Note that you should never use this method to deploy the application on a real server. To do this, just upload the whole folder of your project to the root document of the server, for example /var/www/html/.

So, create a new application with CakePHP.

Conclusion

Web development is very important nowadays and for PHP it seems to be the most used and important language. It also has the advantage of having many important frameworks to be used as CakePHP. In this sense, installing CakePHP is quite simple and provides us with a great tool ready for work.

Please share this post and join our Telegram channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here