15 Commits

Author SHA1 Message Date
nick ba4569ed83 added ai files 2026-07-20 09:28:13 -07:00
code 6ddd151ed1 Switch to official php:8.5.8-fpm-trixie image, fix extension/FPM build issues
Rebuild on the official PHP image instead of Sury's repo on bare Debian.
Fixes surfaced along the way: missing pkg-config/libonig-dev broke the
zip/mbstring extension builds, purging libzip-dev also auto-removed the
libzip5 runtime lib the compiled zip.so needs, phpredis needed bumping to
6.3.0 for PHP 8.5 header compatibility, and the php-fpm.conf listen
directive sed didn't match the commented-out default line so FPM never
created its unix socket, causing 503s from Apache's proxy_fcgi handler.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-20 16:27:40 +00:00
nick 546c49767f Upgraded to Trixie and php8.5.3 2026-03-20 08:49:15 -07:00
nick a5deb07a66 fixed env format and added phpmyadmin doc 2025-06-08 18:15:16 -07:00
nick 9fd3d7142d fixed the readme links 2025-03-26 18:19:10 -07:00
nick c185b80b4f updated name in docker-compose 2025-03-21 18:21:19 -07:00
nick 9dcb385cf1 fix path 2025-03-21 17:42:30 -07:00
nick e6b9d42097 change name to corxn 2025-03-21 17:39:39 -07:00
nick 0be607a1ae correct image 2025-03-21 13:22:29 -07:00
nick f59517b318 fixed up readme 2025-03-15 00:51:54 -07:00
nick c8021f204d php version 8.4.5 debian rebuild v6 2025-03-15 00:38:49 -07:00
nick 125e461786 Fixed apache config 2025-01-14 18:53:28 -08:00
nick 6d154446d3 v5.0.0 2025-01-14 17:05:44 -08:00
nick 8684050d1d updated to version 4 with podman support 2024-07-18 13:40:36 -07:00
nick fa910780a3 added sample data and php.ini updated php version, did not build 2024-06-04 16:41:12 -07:00
12 changed files with 545 additions and 142 deletions
+1
View File
@@ -0,0 +1 @@
data/
+23
View File
@@ -0,0 +1,23 @@
<VirtualHost *:80>
ServerName localhost
DocumentRoot /data/public
<Directory /data/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
DirectoryIndex index.php index.html
# PHP-FPM handler
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
# Docker-friendly logging
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
</VirtualHost>
+53
View File
@@ -0,0 +1,53 @@
# AGENTS.md
This file provides guidance to AI coding agents (e.g. opencode, DeepSeek-based agents) when working with code in this repository.
## What this is
CORXN is a Docker image definition (not an application) — a single `Dockerfile` built `FROM php:8.5.8-fpm-trixie` (official PHP image, Debian Trixie base) with Apache + Redis extension layered on top, intended as the base runtime for the [Novaconium PHP Framework](https://git.4lt.ca/4lt/novaconium). There is no application code here; the repo's output is the built Docker image `4lights/corxn`.
## Key files
- `Dockerfile` — builds the image: installs Apache via `apt`, builds PHP extensions (`mysqli`, `pdo_mysql`, `mbstring`, `zip` via `docker-php-ext-install`; `redis` via `pecl`) against the base image's pinned PHP 8.5.8 (`xml` and `curl` are already built into the base image, so they aren't reinstalled), enables `mpm_event` + PHP-FPM via `proxy_fcgi`, sets security headers, compression, keepalive, and MPM tuning, and configures logrotate. PHP custom config is loaded from `/php`, layered in front of the base image's default `conf.d` via `PHP_INI_SCAN_DIR`.
- `000-default.conf` — Apache vhost, copied into the image. `DocumentRoot` is `/data/public`; PHP requests are proxied to the PHP-FPM unix socket at `/run/php/php-fpm.sock`. Logs go to stdout/stderr (`/proc/self/fd/1` and `2`) for Docker-friendly logging.
- `php.ini` — custom PHP settings copied into the image at `/php/php.ini` (uploads, timezone `America/Vancouver`, OPcache tuned for production with `validate_timestamps=0`, sessions backed by Redis at `tcp://redis:6379`). Can be overridden at runtime by bind-mounting a different file to the same path.
- `start.sh` — container entrypoint: starts `php-fpm` (daemonized) then runs `apachectl` in the foreground.
- `docker-compose.yml` — sample compose stack showing the intended usage: `corxn` container + `redis` + `mariadb`, with `./test` (or an app checkout) mounted to `/data` so the app's `public/` dir is served.
- `test/public` — a minimal PHP app used to sanity-check the built image (see Testing below).
## Building and testing
Build the image:
```bash
docker buildx build --no-cache -t 4lights/corxn:latest --load .
```
To bump the PHP version, change the base image tag in the `FROM` line (e.g. `php:8.5.9-fpm-trixie`) — the official image is versioned exactly, no separate pin mechanism needed.
Test the build:
```bash
mkdir -p data/uploads && sudo chown -R 33:33 data/uploads && chmod 775 data/uploads
docker compose up -d
# Visit: http://localhost:8000/test.php
# Verify: file upload works and green checkmarks appear
```
(UID 33 is `www-data` inside the container.)
View logs: `docker logs corxn`
## Publishing (requires explicit user confirmation before pushing)
```bash
sudo su
docker buildx build --no-cache -t 4lights/corxn:8.5.8 -t 4lights/corxn:latest --load .
docker login -u <username>
docker push 4lights/corxn:8.5.8
docker push 4lights/corxn:latest
```
## Architecture notes for changes
- Any consuming app is expected to be mounted at `/data`, with its web-servable code under `/data/public` (matches `DocumentRoot` in `000-default.conf`).
- PHP config changes belong in `php.ini` (image default) — downstream users override it by bind-mounting their own file over `/php/php.ini`, so avoid assuming values in `php.ini` are final.
- Because `opcache.validate_timestamps=0`, PHP file changes require a container restart/FPM reload to take effect — relevant when iterating on `test/public` during image testing.
- Sessions and app-level caching are expected to go through the `redis` service (session handler already wired to `tcp://redis:6379`); MariaDB is the expected DB backend (see `docker-compose.yml` env vars).
+53
View File
@@ -0,0 +1,53 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## What this is
CORXN is a Docker image definition (not an application) — a single `Dockerfile` built `FROM php:8.5.8-fpm-trixie` (official PHP image, Debian Trixie base) with Apache + Redis extension layered on top, intended as the base runtime for the [Novaconium PHP Framework](https://git.4lt.ca/4lt/novaconium). There is no application code here; the repo's output is the built Docker image `4lights/corxn`.
## Key files
- `Dockerfile` — builds the image: installs Apache via `apt`, builds PHP extensions (`mysqli`, `pdo_mysql`, `mbstring`, `zip` via `docker-php-ext-install`; `redis` via `pecl`) against the base image's pinned PHP 8.5.8 (`xml` and `curl` are already built into the base image, so they aren't reinstalled), enables `mpm_event` + PHP-FPM via `proxy_fcgi`, sets security headers, compression, keepalive, and MPM tuning, and configures logrotate. PHP custom config is loaded from `/php`, layered in front of the base image's default `conf.d` via `PHP_INI_SCAN_DIR`.
- `000-default.conf` — Apache vhost, copied into the image. `DocumentRoot` is `/data/public`; PHP requests are proxied to the PHP-FPM unix socket at `/run/php/php-fpm.sock`. Logs go to stdout/stderr (`/proc/self/fd/1` and `2`) for Docker-friendly logging.
- `php.ini` — custom PHP settings copied into the image at `/php/php.ini` (uploads, timezone `America/Vancouver`, OPcache tuned for production with `validate_timestamps=0`, sessions backed by Redis at `tcp://redis:6379`). Can be overridden at runtime by bind-mounting a different file to the same path.
- `start.sh` — container entrypoint: starts `php-fpm` (daemonized) then runs `apachectl` in the foreground.
- `docker-compose.yml` — sample compose stack showing the intended usage: `corxn` container + `redis` + `mariadb`, with `./test` (or an app checkout) mounted to `/data` so the app's `public/` dir is served.
- `test/public` — a minimal PHP app used to sanity-check the built image (see Testing below).
## Building and testing
Build the image:
```bash
docker buildx build --no-cache -t 4lights/corxn:latest --load .
```
To bump the PHP version, change the base image tag in the `FROM` line (e.g. `php:8.5.9-fpm-trixie`) — the official image is versioned exactly, no separate pin mechanism needed.
Test the build:
```bash
mkdir -p data/uploads && sudo chown -R 33:33 data/uploads && chmod 775 data/uploads
docker compose up -d
# Visit: http://localhost:8000/test.php
# Verify: file upload works and green checkmarks appear
```
(UID 33 is `www-data` inside the container.)
View logs: `docker logs corxn`
## Publishing (requires explicit user confirmation before pushing)
```bash
sudo su
docker buildx build --no-cache -t 4lights/corxn:8.5.8 -t 4lights/corxn:latest --load .
docker login -u <username>
docker push 4lights/corxn:8.5.8
docker push 4lights/corxn:latest
```
## Architecture notes for changes
- Any consuming app is expected to be mounted at `/data`, with its web-servable code under `/data/public` (matches `DocumentRoot` in `000-default.conf`).
- PHP config changes belong in `php.ini` (image default) — downstream users override it by bind-mounting their own file over `/php/php.ini`, so avoid assuming values in `php.ini` are final.
- Because `opcache.validate_timestamps=0`, PHP file changes require a container restart/FPM reload to take effect — relevant when iterating on `test/public` during image testing.
- Sessions and app-level caching are expected to go through the `redis` service (session handler already wired to `tcp://redis:6379`); MariaDB is the expected DB backend (see `docker-compose.yml` env vars).
+107 -134
View File
@@ -1,148 +1,121 @@
######################################################################################################################################## FROM php:8.5.8-fpm-trixie
# Documentation: https://git.4lt.ca/4lt/phpcontainer/wiki
# v3.0
#################################################################################################################################
# Use the PHP base image ARG PHP_REDIS_VERSION=6.3.0
FROM php:8.3.0-apache
# Set maintainer information
LABEL version="3"
LABEL maintainer="4 Lights Consulting <info@4lt.ca>"
LABEL description="Production-ready PHP Apache container"
LABEL org.label-schema.vcs-url="https://git.nickyeoman.com/4lt/phpcontainer"
# Set working directory and Apache document root
WORKDIR /data WORKDIR /data
ENV APACHE_DOCUMENT_ROOT /data/public/
# Install required packages # Install Apache + build deps for the PHP extensions we need
RUN set -eux; \ RUN apt-get update \
apt-get update && \ && apt-get install -y --no-install-recommends \
apt-get install -y --no-install-recommends ghostscript; ca-certificates \
logrotate \
# IMAP ssl-cert \
RUN apt-get install -y libc-client-dev libkrb5-dev libssl-dev; apache2 \
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
RUN docker-php-ext-install imap
# Install PHP extensions
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update && \
apt-get install -y --no-install-recommends \
libbz2-dev \
libgmp-dev \
libicu-dev \
libfreetype6-dev \
libjpeg-dev \
libldap2-dev \
libmemcached-dev \
libmagickwand-dev \
libpq-dev \
libpng-dev \
libwebp-dev \
libzip-dev \ libzip-dev \
; \ libonig-dev \
pkg-config \
$PHPIZE_DEPS \
&& echo "ServerName localhost" >> /etc/apache2/apache2.conf \
\ \
docker-php-ext-configure gd \ # PHP extensions (mysqli/pdo_mysql, mbstring, zip, redis)
--with-freetype \ # xml + curl are already built into the base image
--with-jpeg \ && docker-php-ext-install mysqli pdo_mysql mbstring zip \
--with-webp \ && pecl install redis-${PHP_REDIS_VERSION} \
; \ && docker-php-ext-enable redis \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-configure intl; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
bcmath \
exif \
gd \
gmp \
intl \
ldap \
mysqli \
pdo_mysql \
pdo_pgsql \
pgsql \
zip \
; \
pecl install imagick-3.6.0 && \
docker-php-ext-enable imagick && \
rm -r /tmp/pear; \
\ \
out="$(php -r 'exit(0);')"; \ # Keep the runtime shared libs the compiled extensions link against;
[ -z "$out" ]; \ # only the -dev/headers packages and build toolchain get dropped below
err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \ && apt-mark manual libzip5 libonig5 \
[ -z "$err" ]; \
\ \
extDir="$(php -r 'echo ini_get("extension_dir");')"; \ # Drop the build-only toolchain and headers now that the extensions are built
[ -d "$extDir" ]; \ && apt-get purge -y --auto-remove \
\ $PHPIZE_DEPS \
pecl install APCu-5.1.21 && \ libzip-dev \
pecl install memcached-3.2.0 && \ libonig-dev \
pecl install redis-5.3.7 && \ && rm -rf /var/lib/apt/lists/* /tmp/*
\
docker-php-ext-enable \
apcu \
memcached \
redis && \
rm -r /tmp/pear; \
\
apt-mark auto '.*' > /dev/null && \
apt-mark manual $savedAptMark && \
ldd "$extDir"/*.so | awk '/=>/ { print $3 }' | sort -u | xargs -r dpkg-query -S | cut -d: -f1 | sort -u | xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* && \
! { ldd "$extDir"/*.so | grep 'not found'; } && \
err="$(php --version 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]
# Set recommended PHP.ini settings # Apache + PHP-FPM configuration + performance tuning
RUN set -eux; \ RUN \
docker-php-ext-enable opcache; \ # Enable modules
{ \ a2enmod proxy_fcgi setenvif expires headers rewrite remoteip socache_shmcb ssl deflate \
echo 'opcache.memory_consumption=128'; \ \
echo 'opcache.interned_strings_buffer=8'; \ # Switch to MPM event
echo 'opcache.max_accelerated_files=4000'; \ && a2dismod mpm_prefork \
echo 'opcache.revalidate_freq=2'; \ && a2enmod mpm_event \
echo 'opcache.fast_shutdown=1'; \ \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini # Remote IP config
&& echo 'RemoteIPHeader X-Forwarded-For' > /etc/apache2/conf-available/remoteip.conf \
&& echo 'RemoteIPTrustedProxy 127.0.0.1' >> /etc/apache2/conf-available/remoteip.conf \
&& a2enconf remoteip \
&& sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' /etc/apache2/*.conf \
\
# Security headers
&& echo 'Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"' >> /etc/apache2/conf-available/security.conf \
&& echo 'Header always set X-Content-Type-Options "nosniff"' >> /etc/apache2/conf-available/security.conf \
&& echo 'Header always set X-Frame-Options "SAMEORIGIN"' >> /etc/apache2/conf-available/security.conf \
\
# Compression
&& echo 'AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json' > /etc/apache2/conf-available/compression.conf \
&& a2enconf compression \
\
# KeepAlive tuning
&& printf '%s\n' \
'KeepAlive On' \
'MaxKeepAliveRequests 100' \
'KeepAliveTimeout 2' \
> /etc/apache2/conf-available/keepalive.conf \
&& a2enconf keepalive \
\
# MPM Event tuning
&& printf '%s\n' \
'<IfModule mpm_event_module>' \
' StartServers 2' \
' MinSpareThreads 25' \
' MaxSpareThreads 75' \
' ThreadLimit 64' \
' ThreadsPerChild 25' \
' MaxRequestWorkers 150' \
' MaxConnectionsPerChild 1000' \
'</IfModule>' \
> /etc/apache2/conf-available/mpm-event-tuning.conf \
&& a2enconf mpm-event-tuning \
\
# Logrotate
&& printf '%s\n' \
'/var/log/apache2/*.log {' \
' weekly' \
' missingok' \
' rotate 4' \
' compress' \
' delaycompress' \
' notifempty' \
' create 640 root adm' \
'}' \
> /etc/logrotate.d/apache2 \
\
# PHP-FPM tuning (unix socket, to match the Apache vhost's proxy_fcgi handler)
&& mkdir -p /run/php \
&& sed -i \
-e 's|^;*listen = .*|listen = /run/php/php-fpm.sock|' \
-e 's/^;*listen.owner = .*/listen.owner = www-data/' \
-e 's/^;*listen.group = .*/listen.group = www-data/' \
-e 's/^;*listen.mode = .*/listen.mode = 0660/' \
-e 's/^pm = .*/pm = dynamic/' \
-e 's/^pm.max_children = .*/pm.max_children = 20/' \
-e 's/^pm.start_servers = .*/pm.start_servers = 2/' \
-e 's/^pm.min_spare_servers = .*/pm.min_spare_servers = 2/' \
-e 's/^pm.max_spare_servers = .*/pm.max_spare_servers = 5/' \
/usr/local/etc/php-fpm.d/www.conf
# Set recommended error logging # PHP custom config — /php is layered in front of the image's default conf.d
RUN { \ ENV PHP_INI_SCAN_DIR="/php:${PHP_INI_DIR}/conf.d"
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
# Enable Apache modules and configure RemoteIP COPY php.ini /php/php.ini
RUN set -eux; \ COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
a2enmod expires headers rewrite remoteip socache_shmcb ssl && \ COPY --chmod=755 start.sh /start.sh
{ \
echo 'RemoteIPHeader X-Forwarded-For'; \
echo 'RemoteIPTrustedProxy 10.0.0.0/8'; \
echo 'RemoteIPTrustedProxy 172.16.0.0/12'; \
echo 'RemoteIPTrustedProxy 192.168.0.0/16'; \
echo 'RemoteIPTrustedProxy 169.254.0.0/16'; \
echo 'RemoteIPTrustedProxy 127.0.0.0/8'; \
} > /etc/apache2/conf-available/remoteip.conf; \
a2enconf remoteip; \
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
# More Apache settings RUN a2ensite 000-default
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
EXPOSE 80 EXPOSE 80
CMD ["apache2-foreground"]
CMD ["/start.sh"]
+50 -4
View File
@@ -1,8 +1,54 @@
# 4 Lights Consulting ![CORXN Container](/_assets/corxn-logo.png)
The apache php docker container that we use for production. # CORXN - The Core Foundation of Novaconium
User Documentation: https://git.4lt.ca/4lt/phpcontainer/wiki Links: [Dockerhub](https://hub.docker.com/r/4lights/corxn), [Git Repo](https://git.4lt.ca/4lt/CORXN)
Dockerhub: https://hub.docker.com/r/4lights/phpcontainer CORXN (core-ex-en) is a lightweight yet powerful Docker-based environment designed as the core foundation for the [Novaconium PHP Framework](https://git.4lt.ca/4lt/novaconium).
It provides a streamlined stack featuring Apache, the latest PHP version, Redis, and MariaDB, optimized for high performance.
## Features
- **Base**: official `php:8.5.8-fpm-trixie` image (Debian Trixie)
- **PHP Version**: 8.5.8 (pinned)
- **Apache Web Server**: Configured to run PHP applications
- **Support for**:
- `remoteip` (reverse proxy)
- `redis`
- `mariadb`
- **Timezone**: Default set to Vancouver (`America/Vancouver`)
## Getting Started
Follow these steps to set up the PHP container on your local environment.
### Usage
#### Clone the Repository
```bash
git clone https://git.4lt.ca/4lt/corxn.git
cd corxn
```
## How to update image on dockerhub
```bash
sudo su
docker buildx build --no-cache -t 4lights/corxn:8.5.8 -t 4lights/corxn:latest --load .
docker login -u <username>
docker push 4lights/corxn:8.5.8
docker push 4lights/corxn:latest
```
# Testing
Here is how to text the build:
```bash
mkdir -p data/uploads && sudo chown -R 33:33 data/uploads && chmod 775 data/uploads
docker compose up -d
# Visit: http://localhost:8000/test.php
# Test: file upload and that green checkmarks exist
```
# Logs
```docker logs corxn```
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+39
View File
@@ -0,0 +1,39 @@
# Sample Docker Compose
services:
corxn:
image: 4lights/corxn:8.5.8
ports:
- "8000:80"
volumes:
- ./test:/data # looks for /data/public
- ./php.ini:/php/php.ini:ro # Optional override php.ini
- ./data/uploads:/data/public/uploads
restart: unless-stopped
networks:
- proxy
- internal
redis:
image: redis:7
networks:
- internal
restart: unless-stopped
mariadb:
image: mariadb:11
environment:
- MYSQL_ROOT_PASSWORD=rootpassword
- MYSQL_DATABASE=dbname
- MYSQL_USER=user
- MYSQL_PASSWORD=password
volumes:
- ./data/db:/var/lib/mysql
networks:
- internal
restart: unless-stopped
networks:
proxy:
external: true
internal:
driver: bridge
+5
View File
@@ -0,0 +1,5 @@
# PHPMYADMIN
You may want to use PHPmyAdmin for testing.
Checkout [Docker Cookbooks](https://github.com/nickyeoman/docker-compose-cookbooks/blob/master/phpmyadmin/docker-compose.yml) for an example.
+53
View File
@@ -0,0 +1,53 @@
[PHP]
; Performance
max_execution_time = 30
max_input_time = 60
memory_limit = 512M
; Uploads
upload_max_filesize = 100M
post_max_size = 100M
; Timezone
date.timezone = America/Vancouver
; Errors (production-safe)
display_errors = Off
display_startup_errors = Off
log_errors = On
error_log = /proc/self/fd/2
; Sessions
session.save_path = "/var/lib/php/sessions"
session.gc_maxlifetime = 1440
session.cookie_lifetime = 0
session.use_strict_mode = 1
; File handling
file_uploads = On
allow_url_fopen = On
; Realpath cache
realpath_cache_size = 4096k
realpath_cache_ttl = 120
; cURL
curl.cainfo = "/etc/ssl/certs/ca-certificates.crt"
; Mail (optional)
SMTP = localhost
sendmail_path = /usr/sbin/sendmail -t -i
; OPcache (IMPORTANT)
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=192
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0
opcache.revalidate_freq=0
opcache.fast_shutdown=1
; Redis
session.save_handler = redis
session.save_path = "tcp://redis:6379"
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
php-fpm -D
exec apachectl -D FOREGROUND
+151
View File
@@ -0,0 +1,151 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Server Test - Debian PHP Apache</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 20px;
padding: 20px;
}
h2 {
color: #0056b3;
border-bottom: 2px solid #0056b3;
padding-bottom: 5px;
}
p {
background: #fff;
padding: 10px;
border-radius: 5px;
box-shadow: 0px 1px 3px rgba(0,0,0,0.1);
}
.container {
max-width: 700px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
background: #fff;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
padding: 10px;
text-align: left;
}
th {
background: #0056b3;
color: white;
}
.upload-section {
background: #e3f2fd;
padding: 15px;
border-radius: 5px;
margin-top: 20px;
}
.upload-section input[type="file"] {
padding: 5px;
}
.upload-section input[type="submit"] {
background: #0056b3;
color: white;
border: none;
padding: 8px 12px;
border-radius: 5px;
cursor: pointer;
}
.upload-section input[type="submit"]:hover {
background: #003d80;
}
</style>
</head>
<body>
<div class="container">
<h1>PHP Container Test Script</h1>
<p><a href="https://git.4lt.ca/4lt/CORXN">Four Lights PHP Container: CORXN</a></p>
<h2>Server Information</h2>
<table>
<tr><th>PHP Version</th><td><?php echo phpversion(); ?></td></tr>
<tr><th>Current Date/Time (Vancouver)</th><td><?php date_default_timezone_set('America/Vancouver'); echo date('Y-m-d H:i:s'); ?></td></tr>
<tr><th>upload_max_filesize</th><td><?php echo ini_get('upload_max_filesize'); ?></td></tr>
<tr><th>post_max_size</th><td><?php echo ini_get('post_max_size'); ?></td></tr>
<tr><th>php.ini</th><td><?php echo php_ini_loaded_file(); ?></td></tr>
</table>
<h2>Redis Test</h2>
<?php
$redis = new Redis();
try {
$redis->connect('redis', 6379);
echo "<p>✅ Redis connected</p>";
$redis->set("test_key", "There are FOUR Lights!");
echo "<p>Redis test_key: " . $redis->get("test_key") . "</p>";
} catch (Exception $e) {
echo "<p>❌ Redis connection failed: " . $e->getMessage() . "</p>";
}
?>
<h2>MariaDB Test</h2>
<?php
$mysqli = new mysqli('mariadb', 'user', 'password', 'dbname');
if ($mysqli->connect_error) {
echo "<p>❌ MariaDB connection failed: " . $mysqli->connect_error . "</p>";
} else {
echo "<p>✅ MariaDB connected</p>";
$result = $mysqli->query('SELECT NOW()');
$row = $result->fetch_row();
echo "<p>Current time in MariaDB: " . $row[0] . "</p>";
$mysqli->close();
}
?>
<h2>RemoteIP Test</h2>
<p>Your IP address (from Apache's remoteip module): <?php echo $_SERVER['REMOTE_ADDR']; ?></p>
<h2>File Upload Test</h2>
<div class="upload-section">
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="testfile">
<input type="submit" name="upload" value="Upload">
</form>
</div>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['testfile'])) {
if ($_FILES['testfile']['error'] === UPLOAD_ERR_OK) {
$uploadDir = __DIR__ . '/uploads/';
$destination = $uploadDir . basename($_FILES['testfile']['name']);
if (move_uploaded_file($_FILES['testfile']['tmp_name'], $destination)) {
echo "<p>✅ File uploaded successfully to: <strong>" . htmlspecialchars($destination) . "</strong></p>";
echo "<p>Size: " . $_FILES['testfile']['size'] . " bytes</p>";
} else {
echo "<p>❌ Error moving file.</p>";
}
} else {
echo "<p>❌ Error uploading file. Error Code: " . $_FILES['testfile']['error'] . "</p>";
}
}
?>
</div>
</body>
</html>