How to Install CakePHP on Rocky Linux 8 / Alma Linux 8

CakePHP has several features that make it a great choice as a framework for application development:

  • Flexible licensing, which means you can use it in many environments.
  • Compatibility with recent versions of PHP.
  • Integrated CRUD for database interaction and simplified queries.
  • Scaffolding.
  • Model View Controller (MVC) architecture
  • Cache Management

For these and more features is that CakePHP is widely used and quite popular.

1. Meeting the requirements

As expected, CakePHP is not in the official repositories of any distribution, but the installation is simple.

First, open a terminal or SSH into your server and update the system:

sudo dnf update

As a dependency, you have to install PHP and curl and some of its modules on the system.

sudo dnf install curl unzip php php-mbstring php-xmlrpc php-soap php-gd php-xml php-cli php-zip php-json php-intl php-pdo

Now you can continue.

2. Install Composer

To perform the installation, just run the following command:

curl -sS https://getcomposer.org/installer | php

With this, Composer will be installed. But it is better to place it in a system directory that is in the PATH.

sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
source ~/.bashrc

Now Composer is ready.

Check the whole process by running

composer -v
Composer version 2.3.7 2022-06-06 16:43:28

3. Installing CakePHP

Now you can install CakePHP without too many problems. To achieve this, use Composer.

composer create-project --prefer-dist cakephp/app [project-name]

For example:

composer create-project --prefer-dist cakephp/app imaginelinux

At the end of the process, you will be able to access the imaginelinux folder or with the name of your project, and you will see the whole structure of files and directories.

cd imaginelinux

To test the installation, you have to assign permissions to the bin/cake file that will allow you to deploy a development server.

chmod +x bin/cake

Now serve the project. If you ran this tutorial on your local computer:

bin/cake server

Or by specifying a host and a port

bin/cake server -H [host] -p [port].

For example:

bin/cake server -H 0.0.0.0.0 -p 9876
Serve the CakePHP project
Serve the CakePHP project

Finally, open a web browser and access localhost:[port] or ip-server:[port] to see the CakePHP home page.

CakePHP on Rocky Linux 8 / Alma Linux 8
CakePHP on Rocky Linux 8 / Alma Linux 8

Conclusion

In this post, you learned how to install CakePHP on Rocky Linux 8 / Alma Linux 8. This PHP framework is used to create web applications quickly and easily.

I hope you liked this post, and you can share it with your friends.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top