Alternative location (path) for the config.inc.php file in OJS 3.1.0

By default the config.inc.php file is located in the base directory of OJS 3.1.0: /path/to/ojs/config.inc.php. I want to place it in a dedicated config directory, for example: /path/to/ojs/config/config.inc.php. Is there a standard way to do this?

I can see it’s used in 2 places:

  1. In lib/pkp/classes/config/Config.inc.php:
    define('CONFIG_FILE', Core::getBaseDir() . DIRECTORY_SEPARATOR . 'config.inc.php');.
    I could change this line to:
    define('CONFIG_FILE', Core::getBaseDir() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.inc.php');.
  2. In lib/pkp/templates/install/install.tpl:
    ...if is_writeable('config.inc.php')....
    I can ignore this as I can make the change post install.

Unless there is a standard way to do this, will 1 suffice? Is it fairly future-proof?

Hi @kasioumis,

As far as I’m aware, that should do it. I don’t think we have any plans to change our config file handling in the near or medium future, so the change should be reasonably future-proof.

Regards,
Alec Smecher
Public Knowledge Project Team