How to use MySQL with Sitemagic CMS

By default Sitemagic CMS stores data in secure XML files. This allows Sitemagic CMS to run without any configuration at all which makes Sitemagic CMS the easiest CMS to install on the planet. But if you want to host a larger website with lots of data and many visitors, you may want to consider using MySQL for data storage.
Notice that this feature is for advanced users. You will start with a completely empty website if you switch to MySQL, and you will not be able to install any demo data along with our different design templates. So if you want to use MySQL, make sure to make this decision as early as possible, as there is no easy way to migrate an existing website to MySQL - it's a manual process.
Any files uploaded will be preserved, and will therefore still be available from Content > Files after switching to MySQL.

  1. Create the tables defined in tables.sql using e.g. PHPMyAdmin.
    The file is found in the root of the website.

  2. Find the file
    base/SMDataSource.classes.php
    and rename it to
    base/SMDataSourceXml.classes.php

  3. Find the file
    base/SMDataSourceSql.classes.php
    and rename it to
    base/SMDataSource.classes.php

  4. Open the file config.xml.php for editing.
    The file is found in the root of the website.

  5. Fill out the database connection string and save the file
    <entry key="DatabaseConnection" value="localhost;database;username;password"/>

Reload the website to test the connection. The website should now be empty. All it contains is the design, the functionality to build a new website, and any files you previously uploaded.
Get Sitemagic CMS