Skip to content
PeeHaa edited this page Oct 30, 2014 · 20 revisions

###Getting the project

######Git clone

git clone https://github.com/PeeHaa/OpCacheGUI.git

######Download a tagged release

Download the latest tagged release.

######Composer

php composer.phar require peehaa/opcachegui:1.0.0-rc2

###Setting up the project

######Setting up the environment

Copy the file init.example.php in the root of the project (i.e. init.production.php) and make the changes needed for the environment.

It is advised to change the error reporting to log errors instead of displaying them on the page in production environments.

ini_set('display_errors', 0);
ini_set('log_errors', 1);

Change the timezone to your timezone.

ini_set('date.timezone', 'Europe/Amsterdam');

Choose a URL scheme. Currently there is a choice between using URL paths (e.g. http://yourdomain.com/configuration) and querystrings (e.g. http://yourdomain.com?configuration).
When using URL paths the webserver must support URL rewriting and all requests has to be rewritten to go through the /public/index.php file.

$uriScheme = Router::URL_REWRITE;

It is possible (and in most cases advised) to require users to log in before granting them access to the GUI. In order to setup authentication a username and password need to added.
The password should be a password_hash compatible hash. To disable authentication (allowing users access with logging in) simply clear the username and password:

$login = [
    'username' => '',
    'password' => '',
];

Once the changes are made point the init.deployment.php file to the correct file:

require_once __DIR__ . '/init.production.php';

###Setting up the webserver

There are two ways to run the project.

  1. Under a dedicated (sub)domain
  2. In a subdirectory of another site

######Under a dedicated (sub)domain

When running the project under a dedicated (sub)domain the webserver need to be set up. Note that when you want to use URL paths (e.g. http://yourdomain.com/configuration) your webserver needs to support a way to rewrite URLs.

Example configuration for Apache:

<VirtualHost *:80>
  ServerName opcache.yourdomain.com
  DocumentRoot "/path/to/OpcacheGUI/public"

  <Directory "/path/to/OpcacheGUI/public">
    Options Indexes FollowSymLinks
    AllowOverride All
  </Directory>

  # This is only needed when using URL paths
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L]

</VirtualHost>

Example configuration for Nginx:

server {
    listen      80;
    server_name opcache.yourdomain.com;
    root        /path/to/OpcacheGUI/public;

    # This is only needed when using URL paths
    try_files $uri $uri/ /index.php;

    location ~* \.php$ {
        include fastcgi_params;
        fastcgi_pass /var/run/php5-fpm.sock;
    }
}

######In a subdirectory of another site

In order to run the project in a subdirectory of an existing site the configuration needs to be change to use querystring URLs.

$uriScheme = Router::QUERY_STRING;

Clone this wiki locally