System configs

Contents...

All framework configuration files are PHP files. Except for rare exceptions, a configuration file contains PHP code returning a named array of parameters as shown below:

  <?php
  
  return array(
      'param_1' => 'value_1',
      'param_2' => 'value_2',
      ...
  );
  

These files reside in directory wa-config/.

apps.php

File apps.php contains the list of installed applications and allows managing their "visibility" in the main backend menu.

Example of file apps.php:

  <?php
  
  return array(
      'contacts' => true,
      'stickies' => true,
      'guestbook' => true,
      'installer' => true
  );
  

APP_ID's of the installed applications are used as the named array keys. Value true for a key tells the system to display the corresponding application name and icon in the framework backend.

routing.php

This is the system-wide HTTP request routing configuration file which distributes the entire URL space among applications.

Example of system file routing.php:

  <?php
  
  return array(
      'site.ru' => array(
          array('url' => 'blog*', 'app' => 'blog'), 	
          array('url' => 'shop*', 'app' => 'shop'), 	
          array('url' => 'guestbook/*', 'app' => 'guestbook'), 	
          array('url' => '*', 'app' => 'site'), 	  
        )
  );
  

Read more about frontend request routing.

db.php

File db.php contains database connection parameters.

Example of file db.php:

<?php
  
  return array(
      'default' => array(
          'type' => 'mysql',
          'host' => 'localhost',
          'user' => 'wafw_user',
          'password' => 'my-strong-password',
          'database' => 'wafw'
      ),
  );
  

config.php

File config.php stores several system settings.

Example of file config.php:

  <?php
  
  return array(
      'debug' => true,
      'backend_url' => 'admin',
      'mod_rewrite' => true,
  );
  

Below is the list of parameters used in file config.php:

  • debug: acceptable values are true / false. This parameter enables of disables the display of detailed information on error occurring during the script operation. It is advisable to set this parameter to true during the application development.
  • backend_url: relative path to the backend. Default value is webasyst.
  • mod_rewrite: true or false. This parameter defines whether mod_rewrite rules should be supported. The default value is automatically determined during the framework installation.
  • default_host_domain: default domain that should be used by framework’s system classes in the cases when the framework’s current domain cannot be determined. For instance, when a CLI controller is executed.
  • default_root_url: default root URL that should be used by framework’s system classes in the cases when the framework’s root URL cannot be determined.
  • image_adapter: string ID of the image processing library selected in the system settings.
  • trusted_proxies: array of IP addresses of proxy servers, used by a web-hosting server, with any of which found in the value of the server variable REMOTE_ADDR the real user IP address is determined by alternative means such as server variable HTTP_X_FORWARDED_FOR.
  • disable_mail_ssl_until: string in the format supported by the strtotime() function to denote the date and time until which the verification of SSL certificates is disabled for the connection to email servers. Can be used to temporarily ensure connection to a mail server with broken certificates setup which is known to be safe to use.

net.php

File net.php contains default parameters which must be used for connection to remote resources using waNet class.

Template to create a net.php file:

array(
      'timeout'             => 15,
      'verify'              => true,
      'md5'                 => false,
      'log'                 => false,
      'proxy_host'          => null,
      'proxy_port'          => null,
      'proxy_user'          => null,
      'proxy_password'      => null,
      'interface'           => null,
      'priority'            => array(
          'curl',
          'fopen',
          'socket',
      ),
      'ssl'                 => array(
          'key'      => '',
          'password' => '',
          'cert'     => '',
      ),
  );

You need to leave only those entries in this file which you need to override default values from the options in waNet class.

Array items’ descriptions

  • timeout: period of time, in seconds, during with response will be expected from a remote server.
  • verify: whether remote server’s SSL certificate must be verified.
  • md5: whether Content-MD5 header must be sent.
  • log: name of log file to save error messages to.
  • proxy_host: proxy server’s host name.
  • proxy_port: proxy server’s port number.
  • proxy_user: user name to connect to a proxy server.
  • proxy_password: password to connect to a proxy server.
  • interface: name of network interface to be used for connections via curl.
  • priority: array to define the priority of connection methods; the first method in the list, which proves to be supported by a remote server, will be used to send a request.
  • ssl: PEM certificate parameters to be for connections via curl:
    • key: name of file with an SSL key
    • password: password for the PEM certificate
    • cert: name of file with a PEM certificate