# Deploying a PHP Application with MySQL on AWS vs Nimbuz

> When it comes to deploying a PHP application in the cloud, two options stand out: AWS EC2 and Nimbuz Platform. Both are powerful, but they take very…

- URL: https://blog.nimbuz.tech/blog/deploying-a-php-application-with-mysql-on-aws-vs-nimbuz/
- Author: Manoranjith
- Published: 2025-09-11
- Updated: 2025-12-13
- Category: Deployment Guides
- Tags: aws, php, database

When it comes to deploying a PHP application in the cloud, two options stand out: **AWS EC2** and **Nimbuz Platform**. Both are powerful, but they take very different approaches. One focuses on **flexibility, control and complex to deploy.** while the other is designed for **simplicity, speed and very easy to deploy.**

* * *

### Deploy a PHP Application on AWS EC2 with Apache & MySQL

Deploying a PHP application on AWS is very complex and more command needs to deploy in AWS. By the end of this guide, you’ll have a running **PHP + Apache + MySQL** application hosted on an **Ubuntu EC2 instance**.

#### Step 1: **Launch an EC2 Instance**

1.  Sign in to your AWS Console and go to **EC2**.
2.  Click **Launch Instance** and configure the following:
    -   **AMI**: Ubuntu Server 22.04 LTS
    -   **Instance type**: `t3.micro` (Free-tier friendly)
    -   **Key pair**: Create/download `.pem` file
    -   **Security Group**: Add rules for
        -   SSH (TCP 22) → Your IP
        -   HTTP (TCP 80) → Anywhere
        -   HTTPS (TCP 443) → Anywhere
3.  Launch the instance and note the **Public IPv4 address**.

![](https://blog.nimbuz.tech/content/images/2025/10/image.png)

#### Step 2: Install Apache, PHP, and MySQL

SSH into your EC2 instance:

```
sudo apt update
sudo apt install -y apache2 php libapache2-mod-php php-mysql mysql-server unzip
```

#### Enable Apache:

```
sudo systemctl enable apache2
sudo systemctl start apache2
```

![](https://blog.nimbuz.tech/content/images/2025/10/image-1.png)

#### Step 3: Configure the MySQL Database

```
sudo mysql -u root
```

Run the following inside MySQL:

```
CREATE DATABASE studentdb;
CREATE USER 'myappuser'@'localhost' IDENTIFIED BY 'mystrongpassword@123!';
GRANT ALL PRIVILEGES ON studentdb.* TO 'myappuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```

![](https://blog.nimbuz.tech/content/images/2025/10/image-2.png)

```
mysql -u myappuser -p studentdb
SELECT * FROM students;
EXIT;
```

#### Step 4: Upload Your PHP Application to EC2

From your local machine, upload your PHP app ZIP file:

```
scp -i /path/to/your-key.pem ecommerce-b.zip ubuntu@<EC2-PUBLIC-IP>:/home/ubuntu/
```

After upload, verify inside EC2:

```
ls -l /home/ubuntu/
```

#### Step 5: Create Apache Web Root

```
sudo mkdir -p /var/www/html/ecommerce
sudo chown -R $USER:$USER /var/www/html/ecommerce
```

Move index.php and other files to web root

```
sudo mv /home/ubuntu/ecommerce-b/* /var/www/html/ecommerce/
sudo chown -R www-data:www-data /var/www/html/ecommerce
sudo chmod -R 755 /var/www/html/ecommerce
```

![](https://blog.nimbuz.tech/content/images/2025/10/image-3.png)

#### Step 6: Access Your Application

You can access the PHP application using the following URL.

```
http://<EC2-Public-IP>/ecommerce/index.php
```

That’s it!  You’ve successfully deployed a **PHP application on AWS EC2** with Apache and MySQL.

* * *

## **Deploying PHP Application with Mysql on Nimbuz Platform**

Deploying your application doesn’t have to be complicated. With **Nimbuz Platform**, you can set up your environment, connect your code, and go live in just a few clicks - no long command lines. Everything can be handled end-to-end from the UI.

**Sign up or log in** **to** [**Nimbuz platform**](https://app.dev.nimbuz.tech/?ref=blog.nimbuz.tech) 

Here’s a simple, step-by-step guide to get your app running on Nimbuz: 

**Step 1: Install CloudBeaver Tools**

Install cloudbeaver from **New Tool** section.

Nimbuz comes with **CloudBeaver** built in, making database management super easy. You can query, explore, and monitor your data straight from the **CloudBeaver** UI.

![](https://blog.nimbuz.tech/content/images/2025/10/image-25.png)

**Step 2: Add MySQL Tools** 

From the **New Tool** section, add **MySQL** as your database. Once installed, you can manage everything using the **CloudBeaver** UI. 

![](https://blog.nimbuz.tech/content/images/2025/10/image-26.png)

**Step 3: Click the CloudBeaver Host Link and Setup the DB in CloudBeaver** **UI**

1.  Go to **Installed CloudBeaver Tools**. 

![](https://blog.nimbuz.tech/content/images/2025/10/image-27.png)

1.  Click the **CloudBeaver Host Link** → it opens the **CloudBeaver** UI.
2.  configure the mysql in **CloudBeaver** UI.
3.  Here you can query, create tables, create schemas and manage everything visually.

![](https://blog.nimbuz.tech/content/images/2025/10/image-28.png)

**Step 4: Select Deployment**

1.  Choose a deployment type (Connect Your Code Repository):

  Now let’s bring in your app code: 

-   **Deploy from GitHub repo / Deploy from GitLab repo** → Connect your account, pick your repo and branch, and you’re ready to deploy. 
-   **Deploy zip/tar →** Just upload zip file of your code. 

Configure the port as per your app configs and let Nimbuz handle the rest. No commands, no hassle - your code runs automatically. 

![](https://blog.nimbuz.tech/content/images/2025/10/image-29.png)

2.  Set Environment Variables:

Time to set up the environment variables your app needs. 

In the **Raw Editor**, add values like this: 

```
DATABASE="studentdb"
DB_USER="root"
HOST="load-mysql"
```

These variables make sure your app connects to the right database and runs correctly

![](https://blog.nimbuz.tech/content/images/2025/10/image-30.png)

3.  Manage Secrets:

Secrets are sensitive values like usernames and passwords. Nimbuz stores them securely so your credentials are safe while your app runs seamlessly. 

```
PASSWORD="Test@123"
```

![](https://blog.nimbuz.tech/content/images/2025/10/image-31.png)

4.  Review & Deploy:

You’re almost there!

Review all your settings from the previous steps. If everything looks good, click **Submit**. Then, Nimbuz will take care of the deployment, and your app will be live in the cloud.

**Step 5: Access Your Application**

After the deployment is complete, check the Networking tab to view your app’s endpoint.

-   Click **Generate Domain** to get a **Domain URL**. You can then **access the application** using this URL.
-   **Custom Domain:** If you prefer, you can map your own custom domain.

That’s it!  You’ve successfully deployed a **PHP application** with MySQL **on Nimbuz Platform**.

![](https://blog.nimbuz.tech/content/images/2025/10/image-32.png)

### Hosting & Endpoint Setup Compared: AWS vs Nimbuz

**AWS (EC2):**

-   Developers must **manually configure hosting**: set up public IP, domain, load balancer, and routing rules.
-   **SSL setup** requires extra steps (e.g., ACM certificate, binding it to the load balancer).
-   More control but **higher complexity**.  
    Result: Time-consuming setup with more chances for misconfiguration.

In short: **Nimbuz is plug-and-play**, while **AWS offers flexibility but needs more** **manual setup**.

**Nimbuz:**

-   When you deploy an app, Nimbuz **automatically generates a public URL (endpoint)**.
-   You can enable/disable hosting directly from the dashboard.
-   **SSL (HTTPS)** can be toggled on without setting up certificates manually.  
    Result: Zero-effort to make your app accessible on the internet

* * *

### **Nimbuz Platform vs AWS EC2: Which is Easier for Deploying a PHP Application?**

| Feature / Step | AWS EC2 | Nimbuz Platform |
| --- | --- | --- |
| Database Management | **Install & configure MySQL via command line**
-   Install MySQL using package manager (apt/yum).
-   Create DB users & set permissions via mysql CLI.
-   Configure MySQL to require secure connections (TLS).

Requires manual admin work and SSH access. | **Add MySQL tools & configure from UI**

-   Enable MySQL from platform UI or install via dashboard tools.
-   Create DB users & set permissions from UI.
-   Secure connections (TLS) configured via platform settings.

Manage queries visually using CloudBeaver (integrated). |
| Environment Variables & Secrets | **Manual config**

-   Set env vars in files (.env, php.ini, Apache VirtualHost).
-   Secrets stored manually unless you add AWS Secrets Manager (extra setup).

 | **Handled from UI**

-   Set environment variables directly in dashboard.
-   Secrets stored securely by the platform with no extra setup.
-   Supports Config-as-Code (upload .env file).

 |
| Deployment Process | 

1.  Provision EC2 instance.
2.  SSH into server.
3.  Install Apache, PHP, MySQL.
4.  Configure database.
5.  Upload PHP files (scp / cp).
6.  Set file permissions.
7.  Restart services.

⏳ ~30–45 mins (longer for beginners)

 | 

1.  Pick deployment type (GitHub, GitLab, or Zip).
2.  Install MySQL, CloudBeaver (via UI if required).
3.  Add environment variables.
4.  Configure secrets.
5.  Click Submit to deploy.

⏳ ~5–10 mins

 |
| Ease of Use | 

-   More commands & manual setup.
-   Requires Linux & server admin knowledge.
-   Highly flexible for complex setups.

 | 

-   No commands needed.
-   Beginner-friendly.
-   Fastest way to get app online.

 |
| Best For | Developers / teams needing full control and custom infrastructure. | Developers / teams or startups who want apps live quickly with minimal setup. |
| Deployment Time | ~30–40 minutes (typical) | ~5–10 minutes (typical) |
| Conclusion | **AWS EC2 = Flexibility + Complexity** | **Nimbuz Cloud = Simplicity + Speed** |

  
If you’re deploying an application with simple infrastructure needs and just want to get your app online quickly, the Nimbuz Platform is the best choice for ease of use.

#### Try Nimbuz Today!

Experience seamless app deployment with **Nimbuz**. No more manual setup - just focus on building.

[Get Started Free](https://nimbuz.tech)
