Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud Compute Engine

Install CakePHP with LAMP on Ubuntu 18.04 – Google Cloud

by Cloudbooklet
5 years ago
in Compute Engine
Install Cake Php With Lamp On Ubuntu 18.04 – Google Cloud
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

Install CakePHP on Ubuntu 18.04 – Google Cloud. CakePHP is a rapid development framework for PHP which uses popular design patterns like Front Controller, Associative Data Mapping and MVC. This guide, explains the steps to install CakePHP with LAMP on Ubuntu 18.04. Prerequisites A running Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 18.04 Initial […]

ADVERTISEMENT

Install CakePHP on Ubuntu 18.04 – Google Cloud. CakePHP is a rapid development framework for PHP which uses popular design patterns like Front Controller, Associative Data Mapping and MVC.

This guide, explains the steps to install CakePHP with LAMP on Ubuntu 18.04.

Prerequisites

  • A running Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 18.04
  • Initial Ubuntu Server Set up.
  • A running Cloud SQL instance, see How to set up Cloud SQL in Google Cloud

With the above completed prerequisites I assume you have your Apache, PHP installed and Cloud SQL is configured.

ADVERTISEMENT

1. Install Required Packages

CakePHP requires some additional extensions like php-intl

You might also like

How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago
How To Install Php-Fpm With Apache On Ubuntu 22.04

How to Install PHP-FPM with Apache on Ubuntu 22.04

1 year ago
sudo apt install php-intl

2. Install Composer

CakePHP can be installed by Composer, so you can go ahead install composer.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer

To verify the installation run the composer command.

ADVERTISEMENT

3. Create CakePHP Project

Once Composer is installed you can create a new CakePHP project using composer.

Now quickly move into the html directory.

ADVERTISEMENT
cd /var/www/html

Create new project.

sudo composer create-project --prefer-dist cakephp/app myapp 

This command will create a new CakePHP project in /var/www/html/myapp directory.

ADVERTISEMENT

4. Set up Correct Permissions

Set correct permissions to the newly created project.

sudo chown -R username /var/www/html/myapp
sudo chmod -R 755 /var/www/html/myapp
sudo chmod -R 777 /var/www/html/myapp/tmp

5. Configure Apache

Enable Apache rewrite module.

ADVERTISEMENT
sudo a2enmod rewrite

Edit the apache2.conf file and enable Allow Override for /var/www directory.

sudo nano /etc/apache2/apache2.conf

Replace Allowoverride None to Allowoverride All for /var/www directory and save the file.

Finally, edit the 000-default.conf file and replace the Document root to your CakePHP project path.

sudo nano /etc/apache2/sites-enabled/000-default.conf

Replace DocumentRoot /var/www/html with DocumentRoot /var/www/html/myapp/webroot and save the file.

Now visit your web browser with your external IP address. You shall see the welcome page of CakePHP.

Cake Php Welcome Page

6. Set up Database

Now you can connect your application to Cloud SQL.

sudo nano /var/www/html/myapp/config/app.php 

Replace the following in the file.

  • Cloud_SQL_IP_ADDRESS: Your Cloud SQL Instance public IP address.
  • CLOUD_SQL_USERNAME: Your Cloud SQL username.
  • CLOUD_SQL_USER_PASSWORD: Your Cloud SQL password for the username.
  • CLOUD_SQL_DATABASE_NAME: Your Cloud SQL database name.
     'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'Cloud_SQL_IP_ADDRESS',
/*
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
//'port' => 'non_standard_port_number',
'username' => 'CLOUD_SQL_USERNAME',
'password' => 'CLOUD_SQL_USER_PASSWORD',
'database' => 'CLOUD_SQL_DATABASE_NAME', /
* You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
*/
//'encoding' => 'utf8mb4',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,

Save the file. That’all!

Conclusion

Now you have learned how to install CakePHP on your Ubuntu server in Google Cloud.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: Compute EngineUbuntu 18.04
ShareTweetSendShare
Cloudbooklet

Cloudbooklet

Leave a Reply Cancel reply

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

Related Posts

How To Install And Setup Mern Stack With Nginx On Ubuntu

How to Install and Setup MERN Stack with Nginx on Ubuntu

2 years ago
Best Performance Wordpress With Google Cloud Cdn And Load Balancing

Best Performance WordPress with Google Cloud CDN and Load Balancing

2 years ago
Install Cpanel On Ubuntu

How to Install cPanel & WHM on Ubuntu 20.04

2 years ago
How To Install And Setup Csf

How to Secure your Ubuntu server with CSF Firewall

2 years ago

Follow Us

Trending Articles

Cloud Vps Server

Top 10 Advantages of a Cloud VPS Server

September 19, 2023

HeyGen AI: Free AI Video Generator to Create Amazing Videos

AI Statistics and Trends: What You Need to Know in 2023

5 Best Laptop for Minecraft in 2023: Top Picks for All Budgets

Top 10 Features Expected in Latest Microsoft Copilot Update

AI Powered 3D Models to Create 3D Designs in Breeze

Popular Articles

Nsfw Ai Story Writers

Top 9 NSFW AI Story Writers to Try Today

September 11, 2023

Best 10 Instagram Video Downloader Apps and Websites for 2023

10 Best AI Song Generator in 2023 (Free and Paid)

9 Best Bulk Email Service Providers of 2023

10 Best AI Drawing Generators to Create Stunning Art

How to Use Adobe AI Audio Enhancer to Fix and Edit Your Recordings

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.