Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»PHP Framework»How to Install CakePHP 3.8 on Fedora 30/29/28

    How to Install CakePHP 3.8 on Fedora 30/29/28

    RahulBy RahulOctober 14, 20183 Mins ReadUpdated:July 31, 2019

    CakePHP is a popular PHP framework used for the web development. It is fast and easy to install. Recently CakePHP has released its latest version 3.8 with a variety of changes to improve speed and security. This article will help you to install CakePHP 3.8 (or latest version) on Fedora 30/29/28/27/25 system.

    Step 1 – Prerequsities

    First of all, you need to set up a LAMP environment to install CakePHP on your Red Hat system. We assume that you already have PHP, MySQL and Apache installed on your system. If you don’t have, use the following article to install it.

    • Install Apache, PHP, & MySQL on Fedora

    Step 2 – Install Composer

    Now CakePHP is using composer for managing dependencies. So first we need to install Composer using following command on the system. If already installed then just update to latest version.

    Install Composer:

    curl -sS https://getcomposer.org/installer | php
    mv composer.phar /usr/local/bin/composer
    chmod +x /usr/local/bin/composer
    

    Update Composer:

    composer self-update
    

    Step 3 – Create CakePHP 3 Application

    After installing the composer on your Fedora system. Let’s create CakePHP application named “MyApp” using composer command as below.

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

    Setup CakePHP 3

    Now set the proper permission for your project files. For RedHat based system Apache default uses apache as the user. So change files ownership as per your setup.

    chown -R apache:apache MyApp
    chmod -R 755 MyApp
    chmod -R 777 MyApp/tmp
    

    Step 4 – Setup Database for CakePHP

    For this article, we are using MySQL as the database server. First use following commands to create a MySQL database and create.

    MySQL
    1
    2
    3
    4
    mysql> CREATE DATABASE CakePHPDB;
    mysql> GRANT ALL ON CakePHPDB.* to 'dbuser'@'localhost' IDENTIFIED BY '_password_';
    mysql> FLUSH PRIVILEGES;
    mysql> quit

    Now edit config/app.php configuration file and search for your database setting. Make necessary changes as per below details

    File: config/app.php
        'Datasources' => [
            'default' => [
                'className' => 'Cake\Database\Connection',
                'driver' => 'Cake\DatabaseDriver\Mysql',
                'persistent' => false,
                'host' => 'localhost',
                //'port' => 'nonstandard_port_number',
                'username' => 'dbuser',
                'password' => '_password_',
                'database' => 'CakePHPDB',
                'encoding' => 'utf8',
                'timezone' => 'UTC',
                'cacheMetadata' => true,
    

    Here, you have two options to run your CakePHP application. For the development, system follows Step 5(A) and for Production deployment follow step 5(B).

    Step 5(A) – Deploy CakePHP on Development System

    First is to use its built-in web server preferred for development purpose installation. This will make your application available at http://host:port. From the app directory, execute:

    bin/cake server
    

    By default, without any arguments provided, this will serve your application on localhost at port 8765.

    You can also specify your own host and port like below

    bin/cake server -H 192.168.10.123 -p 1234
    

    This will serve your application at http://192.168.10.123:1234/

    Step 5(B) – Deploy CakePHP on Production System

    Second is deploy with external web servers like Apache its preferred for production use. Let’s create an Apache VirtualHost configuration file using the following content.

    sudo vi /etc/httpd/conf.d/cakephp.conf
    
    File content: /etc/httpd/conf.d/cakephp.conf
    <VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName cakephp.example.com
        DocumentRoot /var/www/html/MyApp/webroot
        <Directory /var/www/html/MyApp>
              Allowoverride All
        </Directory>
    </VirtualHost>
    

    Change the ServerName and document root as per your setup. Then restart Apache service

    sudo systemctl restart httpd
    

    Now access your CakePHP application in a web browser.

    http://cakephp.example.com
    

    cakephp CakePHP Framework fedora php framework
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Apache, MySQL & PHP (LAMP Stack) on Fedora
    Next Article How to Install Moodle 3.8 on Fedora 32/31/30

    Related Posts

    Top 5 Most Stable Linux Distributions in 2022

    Updated:January 11, 20226 Mins Read

    How to Install Anaconda on Fedora 35/34

    Updated:April 18, 20224 Mins Read

    Top 10 Best Linux Server Distributions in 2022

    Updated:April 1, 20228 Mins Read

    How To Install and Configure Drupal on Fedora 35/34

    Updated:February 15, 20224 Mins Read

    How to Disable SELinux on Fedora

    Updated:July 12, 20213 Mins Read

    How To Install TeamViewer on Fedora 35/34

    Updated:February 15, 20222 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.