Installing and using a PHP framework is a great idea to develop quality web applications. This is because the frameworks have configurations and conventions prepared for development. In this post, I will show you how to install CakePHP in CentOS 8. With this framework you will be able to quickly create web applications following the best possible conventions.
In Osradar we like CakePHP very much and is that this PHP framework for the creation of solid web applications, is a wonder. Thanks to CakePHP it is possible to create applications quickly, robust and above all easy to maintain. Not in vain is one of the best known frameworks that PHP has.
So, let us start to install CakePHP on CentOS 8.
Install CakePHP on CentOS 8
1) Install LAMP on CentOS 8
While it is true that to start developing using CakePHP you only need to install PHP and a database management system, it is recommended to install the entire LAMP stack at once.
Read, How to install LAMP on CentOS 8?
In the case of PHP, you can use PHP 7.3 but you have to activate the following modules:
- mbstring PHP extension
- intl PHP extension
- simplexml PHP extension
- PDO PHP extension
You can also use Apache or Nginx as a web server. As you can see, the framework is very flexible.
2) Install Composer on CentOS 8
CakePHP has many dependencies that make manual installation a bit complicated. However, to handle PHP dependencies nothing better than Composer. Using it the CakePHP installation becomes a lot less complicated. So you have to install it. Just, be sure that you have installed the json PHP extension.
Read, How to install Composer on Linux?
In that post, we detail the installation process. So you will not have any problems in completing the process. Once you are done, you can continue.
3) Install CakePHP on CentOS 8
Now it is time to install CakePHP on CentOS 8. For that, just use composer to “download” all CakePHP components. On a terminal, run the following, as a regular user not as root:
:~$ composer create-project --prefer-dist cakephp/app example
So, remember to replace “
Then, you have to make the cake file executable to get tools from the framework. To do this, execute the following commands:
:~$ cd example :~$ chmod +x bin/cake
Now all you have to do is start developing your application. If you want to “serve it” and check that everything is perfectly in order, run the following command from the project folder:
:~$ bin/cake server
This will make your application available from localhost and will be accessible from the web browser. But if you add the option -H and -P you can specify the host and port where the application will be served.
:~$ bin/cake server -H [host] -p [port]
Now, open your web browser and go to your CakePHP app and you will see the following:
And that is it.
Conclusion
CakePHP combines the ease of a clear and conscious framework with the robustness of a solid code that allows you to have secure applications with clear conventions. In this post, you have learned to install it in CentOS in an easy and fast way.
You can also learn how to install it in Debian 10.
Please share this post with your friends and join our Telegram channel.