Scorpio requires a central config file. This is a requirement for the system to function and will always be checked during the initialisation process. Fortunately, Scorpio comes bundled with a sample config file to make it easier to create this initial file.
We will now copy this file and update it with the database settings we created earlier and adjust the logging level.
First change to the data/config folder:
cd /home/sites/scorpio/data/config
Note: in earlier version the master config file was located in /libraries. This has been deprecated in favour of the /data/config folder. For backwards support, the libraries folder will still be checked last.
Now copy the sample file to create the config.xml file:
cp sample.config.xml config.xml
We need to edit the sample to set our database user and password, so do that now. Note the additional -w parameter on nano. This preserves any word wrap which would otherwise be applied by nano - potentially breaking the file.
nano -w config.xml
The sample config.xml file comes with a variety of settings already laid out. You can change the author, copyright and version if you like - these relate to YOUR application NOT to Scorpio. The parameters that have to be updated are the database user details and password. You should change the value component to whatever user you created. If this was "scorpio" then enter that. Do this for each user.
Why are there three users? Well Scorpio is intended to be used on the CLI as well as a web-app and to help differentiate running processes a separate database username will be used by each type of application. This then allows the web process to run on a minimum amount of permissions while leaving a CLI script with greater access.
daemon processes are long running background processes that can have custom permissions if needed.
You may want to change the logLevel at this point as the sample config file of "64" is a full debug output. The various logLevels are held in the systemLogLevel class file under libraries/system/log/level.class.php.
An example of a modified config file is below, this includes additional override parameters on the database details:
<config>
<section name="app" override="">
<option name="author" value="Your name" override="" />
<option name="copyright" value="your copyright" override="" />
<option name="version" value="your version 0.1" override="" />
</section>
<section name="database" override="1">
<option name="dsn" value="%TYPE%://%USER%:%PASSWORD%@%HOST%/%DATABASE%" override="1" />
<option name="userWeb" value="scorpio" override="1" />
<option name="userScript" value="scorpio" override="1" />
<option name="userDaemon" value="scorpio" override="1" />
<option name="userPassword" value="DB_PASS_YOU_CREATED_EARLIER" override="1" />
<option name="system" value="scorpio_system" override="1" />
<option name="wurfl" value="scorpio_wurfl" override="1" />
<option name="logging" value="scorpio_logging" override="1" />
</section>
<section name="system" override="1">
<option name="logType" value="systemLogWriterFile" override="1" />
<option name="logLevel" value="16" override="1" />
<option name="isProduction" value="0" override="1" />
</section>
</config>
When you are happy, save the changes and exit nano (Ctrl+O, Ctrl+X).
Finally we can check on the CLI to see if the config is OK. The easiest way to accomplish this is by running the dbUpdate.php script in the tools folder. This will test not only that the files are OK, but also the main config file and the database connection.
Change to the tools folder:
cd /home/sites/scorpio/tools
And then run the script without any parameters. If all works as it should, you should see the help information for the script.
php dbUpdate.php
To check that the database settings are correct, run the command again but check the update status. This will query the database:
php dbUpdate.php --status
This should run without error and display a table showing no updates are needed. You may need to resize the terminal to have the output display in a sensible manner. If you are directly on the command line, then the output will overflow the screen (it is formatted for ~120 characters).
Posted by: Dave Redfern (Writer), in Tutorials on 19 Nov 2008 @ 21:32
Tags: apache, installation, linux, mysql, php, scorpio, tutorial,
Contents:
Related Articles
This
work is licenced under a
Creative Commons Licence.