Skip to content

naufal-yafi/podman-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php mysql

Running Laravel & CodeIgniter with Podman

This setup is used to run Laravel and CodeIgniter projects locally using Podman.

podman-compose up

Init Machine

If you don’t have a Podman machine yet, initialize and start it:

podman machine init
podman machine start
podman-compose up -d --build

Codeigniter Setup to Get ENV

  1. Place your .env file inside the CodeIgniter project directory
  2. Update your hooks.php to correctly load .env
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../..');

Session Configuration

Update config.php in CodeIgniter:

$config['sess_save_path'] = '/tmp';

cURL

# don't use http://localhost:8000

$request = curl_init('http://laravel:80' . '/api/login');

Permissions

Laravel

chmod -R 777 storage bootstrap/cache

Codeigniter

chmod -R 777 /tmp
chmod -R 777 application/logs
chmod -R 777 application/cache

Access Container (Bash)

podman exec -it {CONTAINER_NAME} bash

Import Database

podman exec -i {DB_CONTAINER_NAME} \
mysql -u {DB_USER} -proot --force {DB_NAME} \
< app/{PROJECT_FOLDER}/{SQL_FILE}.sql

Restart Services

podman-compose down && \
podman-compose up --build

About

This setup is used to run Laravel and CodeIgniter projects locally using Podman.

Topics

Resources

Stars

Watchers

Forks

Contributors