Magento Shows Install When Already Installed

The way to solve this problem is to find out why Magento is trying to install itself again. The problem is to find out what flag Magento uses to indicate it is installed.

You may have already looked in index.php, the core_config_data table, or mage.php for an answer and found none. It’s not immediately clear how Magento determines how it’s installed.

Magento Installation Flag

In my case I had moved the entire Magento directory. Upon doing a diff, I noticed that /app/etc/local.xml was omitted for whatever reason. This configuration file gets created in the installation, so it would appear that if it’s missing Magento assumes it hasn’t been installed.

The solution is to fill out your local.xml accordingly. It should look similar to this in version 1.6.1:

/app/etc/local.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0"?>
<!--
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage_Core
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
-->
<config>
    <global>
        <install>
            <date><![CDATA[Tue, 20 Dec 2011 03:38:21 +0000]]></date>
        </install>
        <crypt>
            <key><![CDATA[958fe8f51af3f99d5ba64b1f7848f6f6]]></key>
        </crypt>
        <disable_local_modules>false</disable_local_modules>
        <resources>
            <db>
                <table_prefix><![CDATA[]]></table_prefix>
            </db>
            <default_setup>
                <connection>
                    <host><![CDATA[localhost]]></host>
                    <username><![CDATA[your_mysql_username]]></username>
                    <password><![CDATA[your_mysql_password]]></password>
                    <dbname><![CDATA[your_mysql_database]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>
            </default_setup>
        </resources>
        <session_save><![CDATA[files]]></session_save>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[admin]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>
<?xml version="1.0"?>
<!--
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage_Core
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
-->
<config>
    <global>
        <install>
            <date><![CDATA[Tue, 20 Dec 2011 03:38:21 +0000]]></date>
        </install>
        <crypt>
            <key><![CDATA[958fe8f51af3f99d5ba64b1f7848f6f6]]></key>
        </crypt>
        <disable_local_modules>false</disable_local_modules>
        <resources>
            <db>
                <table_prefix><![CDATA[]]></table_prefix>
            </db>
            <default_setup>
                <connection>
                    <host><![CDATA[localhost]]></host>
                    <username><![CDATA[your_mysql_username]]></username>
                    <password><![CDATA[your_mysql_password]]></password>
                    <dbname><![CDATA[your_mysql_database]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>
            </default_setup>
        </resources>
        <session_save><![CDATA[files]]></session_save>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[admin]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

Just fill out your database information and the crypt key. If possible find your previous local.xml and use it instead.

Continued Troubleshooting

Once fixed there are a few more steps to take if you are still having problems:

  1. Clear the Magento cache. Delete the /var/ folder completely to do this.
  2. Truncate the core_url_rewrite table: TRUNCATE core_url_rewrite
  3. Update your virtual host if you moved to a new directory like I did.
  4. Update the website URL if needed. You’ll find two options in the core_config_data table to change base URLs.

Upon visiting my admin panel I was greeted with an Internal Server Error. Instead of putting in my .htaccess file that was missing, I moved the entire install over again. Only, this time I verified the move was complete.

Preventing This Problem in The Future

The issue in my case was with using svn export to export my project and put it in a new directory. This omitted files not in version control – very bad!

If you have an issue with files not making it over a better solution is to tar or zip the install and then move it.

 

Discussion

Leave a Reply