Skip to content

AurelienLab/daps-p5-blog

Repository files navigation

Aurélien Lorence

Formation Développeur d'application PHP / Symfony [OpenClassrooms]

Projet n°5 - Créez votre premier blog en PHP


Codacy Badge

Project setup

Requirements

This project requires PHP 8.3 and the following php extensions:

  • curl
  • json
  • mbstring
  • pdo
  • openssl

Setup

1 - Import project sources

git clone [email protected]:AurelienLab/daps-p5-blog.git
cd daps-p5-blog

2 - Install dependencies

In projet root directory execute this command:

composer install

3 - Setup database

You'll need the empty database for this project. You can explicitly ask me for it in private message. Once you imported it, remember the database name and your mysql credentials.

4 - Configure .env

APP_ENV=dev                             # Current environment (dev|prod)
APP_KEY=generateme                      # Random string used for encryption

APP_REMEMBER_ME_LIFETIME=336            # Number of hours a user will be remembered for auto login
APP_PASSWORD_REQUEST_HOURS_VALIDITY=24  # Number of hours of password request token validity
APP_CONTACT_EMAIL=[email protected]   # Mail sender


################################
####### DATABASE CONFIG ########
################################
DB_HOST=localhost
DB_PORT=3306
DB_NAME=
DB_USER=
DB_PASSWORD=

# See https://symfony.com/doc/current/mailer.html for mailer configuration

MAILER_DSN=smtp://<user>:<password>@provider.com:2525
MAILER_DEFAULT_SENDER=[email protected]

5 - Configure web server

Your web server must target public/ folder in project directory, and have FollowSymLinks enabled. Follow this documentation for nginx or this one for apache2.

6 - Permissions

Your web server user must have rights to write in public/uploads folder and sub-folders. If you're running on Unix system with ACL You can run the following:

# Get current web server user
HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1)

# set permissions for future files and folders
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX public/uploads
# set permissions on the existing files and folders
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX public/uploads

Source: https://symfony.com/doc/current/setup/file_permissions.html

About

Repository du Projet 5 de la formationc OC PHP / Symfony

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published