/php73-codeigniter3-postgre

PHP 7.3 + Codeigniter 3 + PostgreSQL

Primary LanguagePHP

Apache httpd + PHP 7.3 + Codeigniter 3 + PostgreSQL 9.4

Step 1. Build

docker-compose build

Step 2. Up

docker-compose up -d

Step 3. Installing PHP dependency packages

docker-compose exec php composer install

Test

docker-compose exec php composer test
# or `docker-compose exec php php vendor/bin/phpunit -c application/tests/`

Confirmation

PHP Info

cat <<'EOF' > phpinfo.php
<?php

phpinfo();

EOF

open http://localhost:8080/phpinfo.php

Show PotgreSQL Tables

cat <<'EOF' > postgresql.php
<?php

$pdo = new PDO('pgsql:host=postgres;port=5432;dbname=postgres;user=postgres;password=secret');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sql = <<<SQL
SELECT pg_statio_user_tables.relname
    FROM pg_catalog.pg_class, pg_catalog.pg_statio_user_tables
    WHERE relkind='r'
          AND pg_catalog.pg_statio_user_tables.relid=pg_catalog.pg_class.relfilenode
SQL;

$stmt = $pdo->query($sql);
var_dump($stmt->fetchAll());

EOF

open http://localhost:8080/postgresql.php