Skip to content

Commit

Permalink
New post: A beginner's guide to setting up PHP on your computer
Browse files Browse the repository at this point in the history
  • Loading branch information
eerison committed Oct 28, 2024
1 parent 08f0c67 commit 9494242
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
---
author: Erison Silva
pubDatetime: 2023-11-28T10:00:00Z
title: How to setup PHP easily on your machine
slug: how-to-setup-php-easily-on-your-machine
title: A beginner's guide to setting up PHP on your computer
slug: a-beginners-guide-to-setting-up-php-on-your-computer
featured: true
draft: false
tags:
- php
- developer
- beginner
- setup
ogImage: https://blog.erison.work/_astro/how-to-setup-php-easily-on-your-machine.2b7537c4_Z6cLXe@3540w.jpeg
description: The easiest way to setup whole PHP stack locally with one command only.
description: Easily install and configure the entire PHP stack on your machine in one simple step, perfect for beginners.
---

![An astronauta carring a laptop](@assets/images/how-to-setup-php-easily-on-your-machine.jpg)

My goal with this post is you have a _PHP environment_ running on your machine quickly and easy.
I saw some people struggling to have this done, and tutorials that you need to follow a bunch of steps
for the end, you could run PHP on command line only πŸ˜”.

But on sections bellow, you going to find a setup with one **copy** and **past** command, and _you have a complete php stack running_
with a small php structure for you use as study guide in case, you are new on php land.

# Requirements
## Requirements

Before we start, you **MUST** have two tools already installed on your computer.

Expand All @@ -45,7 +42,7 @@ docker compose version

> For **Windows** users I would say that you must install [WSL][wsl_install_link] to have this working.
# Let's make this work πŸš€
## Let's make this work πŸš€

After you have done the requirements step, we can now run command to have this ready to play with php 🐘.

Expand All @@ -65,7 +62,7 @@ git clone https://github.com/shield-wall/easy-php-setup.git \
&& docker compose exec -T db sh -c 'exec mysql --defaults-extra-file=.docker/mysql/config.cnf' < .docker/mysql/dump.sql
```

# Troubleshooting
## Troubleshooting

In case the error bellow pop up on your terminal.

Expand All @@ -92,15 +89,15 @@ docker compose exec -T db sh -c 'exec mysql --defaults-extra-file=.docker/mysql/

> In case you find out other issue that is not related here, open an [issue][repository_issue_link] on github.
# Commands
## Commands

| Command | Description |
| ---------------------------------------- | -------------------------------------------------------------------- |
| docker compose up -d | Start the containers |
| docker compose down | Stop containers |
| docker compose exec php composer install | Execute some **php command** that you need, or **composer command**. |

# Frameworks
## Frameworks

This project should work, out the box, for the most _modern php frameworks_ such as [Symfony][symfony_link] and [Laravel][laravel_link].

Expand All @@ -109,7 +106,7 @@ In case you just want to use the environment, you can remove all files and keep
But if you find some strange behaviour, feel free to open an [issue][repository_issue_link]
or even better provide a PR to improve the [project][repository_link] πŸš€.

# Study guide
## Study guide

As you can see I added a tiny php structure, I did this for two reasons.

Expand Down

0 comments on commit 9494242

Please sign in to comment.