We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36834
    • 25 Posts
    2.1.5-pl won't install for me out of the box. Is it just me or do the $_POST variable names not match the form names?

    Here's the code from 'setup/templates/database.tpl'

    <div class="labelHolder">
        <label for="database-type">{$_lang.connection_database_type}</label>
        <select id="database-type" value="{$config.database_type}" name="database_type">
            <option value="mysql"{if $config.database_type EQ "mysql"} selected="selected"{/if}>mysql</option>
            <option value="sqlsrv"{if $config.database_type EQ "sqlsrv"} selected="selected"{/if}>sqlsrv</option>
        </select>
         <span class="version-msg" id="database-type-error"></span>
    </div>
    <div class="labelHolder">
        <label for="database-server">{$_lang.connection_database_host}</label>
        <input id="database-server" value="{$config.database_server}" name="database_server" />
         <span class="field_error" id="database-server-error"></span>
    </div>
    <div class="labelHolder">
        <label for="database-user">{$_lang.connection_database_login}</label>
        <input id="database-user" name="database_user" value="{$config.database_user}" />
         <span class="field_error" id="database-user-error"></span>
    </div>
    <div class="labelHolder">
        <label for="database-password">{$_lang.connection_database_pass}</label>
        <input id="database-password" type="password" name="database_password"  value="{$config.database_password}" />
         <span class="field_error" id="database-password-error"></span>
    </div>
    <div class="labelHolder">
        <label for="dbase">{$_lang.connection_database_name}</label>
        <input id="dbase" value="{$config.dbase}" name="dbase" />
         <span class="field_error" id="dbase-error"></span>
    </div>
    <div class="labelHolder">
        <label for="table-prefix">{$_lang.connection_table_prefix}</label>
        <input id="table-prefix" value="{$config.table_prefix}" name="table_prefix" />
         <span class="field_error" id="tableprefix_error"></span>
    </div>


    Here's the code from 'setup/includes/modinstall.class.php'

    $included = false;
                    $database_type = isset ($_POST['databasetype']) ? $_POST['databasetype'] : 'mysql';
                    $database_server = isset ($_POST['databasehost']) ? $_POST['databasehost'] : 'localhost';
                    $database_user = isset ($_POST['databaseloginname']) ? $_POST['databaseloginname'] : '';
                    $database_password = isset ($_POST['databaseloginpassword']) ? $_POST['databaseloginpassword'] : '';
                    $dbase = isset ($_POST['database_name']) ? $_POST['database_name'] : 'modx';
                    $table_prefix = isset ($_POST['tableprefix']) ? $_POST['tableprefix'] : 'modx_';
                    $https_port = isset ($_POST['httpsport']) ? $_POST['httpsport'] : '443';
                    $cache_disabled = isset ($_POST['cache_disabled']) ? $_POST['cache_disabled'] : 'false';
                    $site_sessionname = 'SN' . uniqid('');
                    $config_options = array();


      • 9207 ☆ A M B ☆
      • 2,475 Posts
      This is probably an issue with your environment. What version of PHP, MySQL, and what browser are you using? Where is this being hosted? Do you have all the required PHP modules installed? When and how exactly does this fail?
        • 36834
        • 25 Posts
        It fails on the Database Screen. When I select 'Create or test selection of your database' I am told that the prefix modx_ is already in use with the database. This is because the default values from the script are being submitted rather than the form values entered in the previous step. So the script always connected to the modx db with a prefix of modx_. To complete the install I edited the config values. Only thing that is unusual about my server is that there is no passowrd for root with mysql as it is a local dev server.

        Environment details:

        Mac OSX 10.6.4
        Apache 2.2.15 (Unix)
        PHP 5.3.8-ZS5.5.0
        MySql 5.1.54
        MODx 2.1.5-pl traditional
        Safari 5.0.3 (6533.19.4) (but also Firefox 4.0.1)
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          Hmmm.... I've installed 2.1.5 with a custom db prefix. Are you sure your database doesn't contain tables with the "modx_" prefix? If it finds any, the script will fail.
            • 36834
            • 25 Posts
            The database had no tables in it. I only had a quick look at the scripts to solve the immediate problem, but it did appear to me that the form in the tpl files is submitting values like 'database_user' and 'dbase' whilst the $_POST values being checked in the script for the same fields are 'databaseloginname' and 'database_name'. But this has turned out to be a red-herring as the form is actually submitted by ajax and 'database.js' grabs the form values and submits them to the processor.

            You could be right, it might be an environment/browser thing - if I get time I'll look further into it - Thanks for your interest.
              • 3749
              • 24,544 Posts
              Check the db name in core/config/config.inc.php to make sure it's connecting to the DB you think it is. I've been burned by this a couple of times.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting