# WordPress + Apache Configure request and database trace collection for an **existing WordPress installation** on Debian/Ubuntu with Apache and either mod_php or PHP-FPM. Setup changes the server's PHP startup configuration and installs the Collector; it does not create a WordPress site, database, administrator, or Docker lab. ## Existing server requirements - The real WordPress root in `APP_DIR`, with Apache already running as `SYSTEMD_SERVICE` (normally `apache2.service`). - Matching PHP runtime settings: `PHP_VERSION` and `PHP_BINARY`, with `PHP_SAPI=apache2` or `fpm`. The example targets PHP 8.3; installed 8.4/8.5 selections need matching packages and their own deployment validation. - For FPM, the running `PHP_FPM_SERVICE`, its `PHP_FPM_BINARY`, and the exact existing `PHP_FPM_POOL`. `WEB_GROUP` must be readable by that site's PHP workers. - Root access, Python 3.10+, and Debian/Ubuntu's `apache2ctl`, `phpenmod`, and package tooling. Composer 2 is installed if absent. Setup can build the pinned native extension when the default CLI PHP matches the selected web runtime; mixed default/web runtimes need the matching extension installed beforehand. ## Server changes Dependencies and the Composer autoloader live outside the document root in `/opt/corridora-otel//agent`. The installer enables PHP OpenTelemetry extension **1.5.0** for the selected SAPI. It preserves another installed extension version by refusing to replace it silently. For mod_php, setup enables a managed Apache configuration containing a `Directory` block for this WordPress root and an `auto_prepend_file` setting. For FPM, it adds a managed fragment for the named existing pool. It runs native Apache/FPM configuration tests before restarting services. WordPress core and `wp-config.php` are unchanged. The prepend file loads Composer before WordPress starts. If an existing prepend is configured, supply its exact `PHP_EXISTING_PREPEND_FILE` so its behavior is chained; unknown prepends are rejected instead of replaced. Inspect security-plugin and hosting bootstraps before choosing that setting. A bootstrap that already initializes OTel must be extended rather than combined with a second SDK. The PHP settings use only the loopback Collector URL and contain no Corridora ingest key. Request and `wpdb` spans are exported; PHP application logs, Apache access/error logs, host/server metrics, and browser RUM are not enabled by this PHP trace integration. Add those pipelines deliberately through the corresponding collection guides. Pinned Composer components are SDK **1.18.0**, OTLP exporter **1.6.0**, WordPress instrumentation **0.2.0**, and Guzzle adapter **1.1.0**. Version 0.3.0 of the WordPress instrumentation was excluded after its request hook failed with a missing `HttpAttributes` class. The pinned version can mark internal lifecycle spans as SERVER; do not count every SERVER span as an independent request. Full SQL text is stripped by the Collector before Corridora export. ## Set up collection Clone the repository on the existing server: ```sh git clone https://github.com/corridora/integrations.git cd integrations/wordpress-php-apache cp env.example "$HOME/corridora-wordpress-php-apache.env" chmod 600 "$HOME/corridora-wordpress-php-apache.env" ``` Edit that private file to select the actual application directory, running service, runtime paths, and stable service name. The default ingest destination is `https://ingest.corridora.ai`; replace it only with the HTTPS ingest base URL supplied for your Corridora deployment. Do not append `/v1/traces`, `/v1/logs`, or `/v1/metrics`. Load an active Corridora **ingest key** through your secret manager or a hidden prompt. The process environment overrides the configuration file: ```sh export CORRIDORA_INGEST_KEY="$(python3 -c 'import getpass; print(getpass.getpass("Corridora ingest key: "))')" sudo --preserve-env=CORRIDORA_INGEST_KEY bash setup.sh --config "$HOME/corridora-wordpress-php-apache.env" --dry-run sudo --preserve-env=CORRIDORA_INGEST_KEY bash setup.sh --config "$HOME/corridora-wordpress-php-apache.env" ``` The first command inspects the server and prints the plan. The second installs collection, starts its Collector, and restarts the explicitly named application service. The script does not create an application, database, example site, or sample workload. It reads configuration as data and never sources it as shell code. It does not overwrite the input configuration file. Keep the whole checkout: `setup.sh` invokes the shared `lib/collection.py` installer and uses this folder's `agent/` files. The [public source](https://github.com/corridora/integrations/tree/main/wordpress-php-apache) and this guide are mirrored; the old sample-launch `--start` and `--verify` modes have been removed. ## Corridora delivery The installed path is application → loopback OTLP/HTTP Collector → authenticated HTTPS Corridora ingestion. The Collector's **only exporter** is Corridora. There is no Jaeger, debug exporter, or optional alternate-backend mode. Collector Contrib **0.160.0** is downloaded from the official release with a pinned SHA-256 checksum for Linux amd64 or arm64. It runs under a dedicated `corridora-otel` system account. The receiver and health endpoint bind only to `127.0.0.1`; setup does not open firewall ports. Choose a free `COLLECTOR_PORT` and the following port for health checks. The default port differs between integration types. The Collector adds `X-CORRIDORA-KEY`. The key is stored in its protected `/etc/corridora-otel//collector.yaml`, readable by root and the Collector's group. It is not placed in the application environment, PHP settings, command-line arguments, or repository files. TLS certificate verification stays enabled. Application exporters use the local receiver without that key; the generated startup settings clear stale signal-specific exporter overrides. Traces and logs pass through an attribute processor that removes full SQL statements, query text, raw full URLs, and query strings before external export. Route/path attributes remain available. This does not replace the application's own log-message redaction policy. The Collector batches exports and uses a persistent retry queue under `/var/lib/corridora-otel//queue`. ## Verify and operate Generate traffic against the real application after setup. In Corridora, select its configured `OTEL_SERVICE_NAME` and the current time window, then inspect a request trace. Follow [stored-data verification](https://www.corridora.ai/docs/collect/setup/verification) and [the ingest reference](https://www.corridora.ai/docs/reference/ingest). A running service or successful local export test does not establish remote storage or UI visibility. Inspect the application and Collector services on the server: ```sh sudo systemctl status YOUR_APPLICATION.service sudo systemctl status corridora-otel-YOUR_INTEGRATION_ID.service sudo journalctl -u corridora-otel-YOUR_INTEGRATION_ID.service --since '10 minutes ago' ``` Repeat setup with the same ID to reconcile the same installation. Existing managed files that were changed outside setup are rejected rather than overwritten. Changing an ID creates a different installation; do not use a new ID as an update shortcut. Ingest key rotation uses the same config/ID and restarts the Collector. To restore saved startup configuration: ```sh sudo bash setup.sh --config "$HOME/corridora-wordpress-php-apache.env" --rollback ``` Rollback disables this installation's Collector, restores the previous startup configuration, and restarts the affected service. Installed dependencies, the native PHP extension if installed, and queued data remain on disk. Configuration backups and installation state are root-only. Review the application's normal shutdown behavior: forced termination can lose an in-flight SDK batch. ## Validation scope The repository's [server validation fixture](https://github.com/corridora/integrations/tree/main/tests/server) exercises existing applications, installer filesystem changes, dry runs, repeated setup, native configuration validation, rollback, and real OTLP export through a Collector to an HTTPS Corridora-format receiver using synthetic credentials. `systemctl` is simulated in the unprivileged test container; these checks do not claim a production systemd rollout or ingestion into a real Corridora account.