Skip to content
ii02735 edited this page Dec 28, 2022 · 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.1

Setting up the project

Setting up the environment

Copy the file config.sample.php in the root of the project (as config.php) and make the changes needed for your environment.

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

'display_errors' => 'Off',
'log_errors'     => 'On'

Change the timezone to your timezone.

'timezone' => 'Europe/Amsterdam'

Change the language if you want to have the application run in your localized language. Currently supported languages are: English (en), Dutch (nl), German (de), French (fr), Danish (da), Spanish (es), Italian (it) and Russian (ru).

'language' => 'en'

Choose a URL scheme. Currently you can choose between using URL paths (e.g. http://yourdomain.com/configuration) or query strings (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.

'uri_scheme' => 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 needs to be added.
The password should be a password_hash compatible hash. To disable authentication (allowing users access without logging in) simply clear the username and password:

'username'  => '',
'password'  => '',
'whitelist' => [
    'localhost',
]

The whitelist key in the configuration array contains a list of (IP) addresses which are allowed to log in. For more information about the supported IP addresses and ranges see the Whitelist chapter of the wiki.

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 2.2-:

<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,QSA]

</VirtualHost>

Example configuration for Apache 2.4+:

<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
  FallbackResource /index.php

</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 /index.php;

    location ~* \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass /var/run/php-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 query string URLs.

'uri_scheme' => Router::QUERY_STRING