Skip to content
This repository has been archived by the owner on Mar 11, 2018. It is now read-only.

Setting Up a Local Environment on Linux (Apache)

czmj edited this page Aug 20, 2017 · 4 revisions
  • Install LAMP (if not already done)
  • Install Postgres according to your package manager or from source
  • Make sure the PHP plugin for postgresql is installed using # apt-get install php5-pgsql or the equivalent for your package manager
  • Execute the following commands in psql interactive shell...
CREATE DATABASE wordpress;
CREATE USER wordpress WITH PASSWORD 'wordpress';
GRANT ALL PRIVILEGES ON DATABASE wordpress to wordpress;
  • In your Apache config, add a SetEnv directive like SetEnv DATABASE_URL postgres://wordpress:wordpress@localhost:5432/wordpress
  • Change the first line of your wp-config.php to use $_SERVER["DATABASE_URL"] if DATABASE_URL not found in $_ENV:
if (isset($_ENV["DATABASE_URL"]))
  $db = parse_url($_ENV["DATABASE_URL"]);
else
  $db = parse_url($_SERVER["DATABASE_URL"]);

  • (Re)start Apache, and open http://localhost/wp-admin in a browser.

  • For people new to Apache and want to avoid doing a lot of poking around in Apache's configs, create a sh script that looks like the following in your git repo:

#! /bin/sh
cp -r * /var/www
chmod a+rwx -R /var/www

This will copy all of the files to the default web directory and add the correct permissions to the files. Make sure to run the script with sudo.

Clone this wiki locally