Skip to content

Installation

Serghei Iakovlev edited this page Jan 20, 2018 · 11 revisions

Creating a project

Install Composer into a common location or in your project:

$ curl -sS https://getcomposer.org/installer | php

If that does not work, try this instead:

$ php -r "readfile('https://getcomposer.org/installer');" | php

Then create a project as follows:

$ php composer.phar create-project phalcon/forum

Creating a database

Then you'll need to create a database and initialize a schema. In the example below we use phosphorum as database name.

$ echo 'CREATE DATABASE phosphorum CHARSET=utf8 COLLATE=utf8_unicode_ci' | mysql -u root
$ cat schemas/forum.sql | mysql -u root phosphorum

Setting up environment variables

Phosphorum uses .env file to getting environment variables. Open the .env file and configure project credentials.

Initial test data

You can create fake entries on an empty Phosphorum installation by running:

$ /usr/bin/php /var/www/forum/forum seeder:populate

Note: This example use the following environment:

  • Full path to the PHP: /usr/bin/php
  • Full path to the Forum: /var/www/forum
  • CLI runner: forum

Built-in filename-based cache busting

If you're not using the build script to manage your filename version revving, you might want to consider enabling this, which will route requests for /css/style.20110203.css to /css/style.css.

To understand why this is important and a better idea than all.css?v1231, read: github.com/h5bp/html5-boilerplate/wiki/cachebusting.

Usual Nginx configuration you may need to:

location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$ {
  try_files $uri $1.$2;
}

Directory permissions

Directories within the storage directory as well as public/assets directory should be writable by your web server or Phosphorum may not run. Most folders should be chmod 755 and files chmod 644.

You can use these commands on Linux/BSD based OS to set permissions:

# Note: You'll need to replace www-data by proper web-server user

# Change owner for all files inside storage/cache directories
# except `.gitignore' to www-data
find $(pwd)/storage/cache ! -name .gitignore -exec sudo chown www-data:"$USER" {} \;

# Change owner for storage/cache, storage/logs, storage/pids and public/assets
# directories to www-data
sudo chown www-data:"$USER" $(pwd)/storage/cache
sudo chown www-data:"$USER" $(pwd)/storage/logs
sudo chown www-data:"$USER" $(pwd)/storage/pids
sudo chown www-data:"$USER" $(pwd)/public/assets