15 49.0138 8.38624 1 0 4000 1 https://sankaranand.com 300 true 0
theme-sticky-logo-alt

How to troubleshoot problems while installing Magento in localhost

11 Comments

I have to agree that most of us face a lot of issues while installing the latest version of Magento 1.4.2.0 in localhost. The version was released on December 8, 2010. So I thought of writing an article that would sort out the basic issues one would  face during magento installation. I am not much familiar with magento and this is my first experience trying it.

Invalid Base url ( Please enter a valid URL. Protocol is required (http://, https:// or ftp://):

You will face this error usually when the base url entered is like http://localhost/…./, you can easily resolve this issue either by simply replacing localhost with “127.0.0.1” . So your url goes like this

http://127.0.0.1/magento/

or else you can force magento to accept your localhost as url by modifying the validation.js file which is present in the magento installation directory at js\prototype\validation.js (note I don’t recommend doing this for any live servers, just for development and testing purpose).

go to line 500 where you will see something like this

['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {


return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
}],

remove all the regular expressions present and simply return true. So the above code will be changed to something like this

['validate-url', 'Please enter a valid URL. http:// is required', function (v) {
return true;
}],

and for extra care , I would advise you to

Check the Skip Base URL Validation Before the Next Step option to prevent any validation of url. So the final selection would be like this

Maximum Execution time exceed error.

If you believe or not, Magento will create about 318 tables in your database. I was astonished becoz I used to work with very light content management systems like wordpress etc and this is the first time I am trying a powerful e-commerce site like Magento which has hell lot of tables.

This is the reason why many of us end up with an error “Maximum Execution time exceed error.” The default maximum time execution limit for php which we have configured is not enough to posses such a powerful system.

So if you are using a distribution system like xampp or lamp, you can simply find the php folder and configure the php.ini file

Usually php.ini file can be found in c:\xampp\php\php.ini

find two values which usually present at line 440 and 450. Change the default value to either 0 or 3600

max_execution_time = 3600
max_input_time = 3600.

assigning value as zero (0) would give it infinite time for execution.

These are the common issues one face during the installation of latest version of Magento 1.4.2.0.

Unable to login after Magento installation in localhost:

After the installation, I faced another problem. It wont allow you to login if you have used localhost as your base url instead of 127.0.0.1. This is because it wont accept cookies from localhost. You can resolve it by commenting out unwanted variables in session cookies in Varien.php. This file can be found in app/code/core/Mage/Core/Model/Session/Abstract/

go to line 78 (varies based on versions) and you will find the array as shown below

$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
'domain' => $cookie->getConfigDomain(),
'secure' => $cookie->isSecure(),
'httponly' => $cookie->getHttponly()
);

comment the last three lines see example below.

$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
// 'domain' => $cookie->getConfigDomain(),
// 'secure' => $cookie->isSecure(),
// 'httponly' => $cookie->getHttponly()
);

Make sure you remove the comma after getPath(). Check screenshot

If you come across any other issues do comment below to let me know.

Previous Post
The Great Escape
Next Post
The Silent National Anthem – Please Stand up and Watch
Sankaranand

Scrum Master and Project Manager with 9+ years of experience handling web, mobile and cloud projects. He is a PSM1 and CSM certified.

11 Comments

  • March 16, 2011 at 11:12 pm
    Muthu

    Great Job…. thank you so much….. 🙂

    Reply
  • June 7, 2011 at 11:30 pm

    Another solution is to add a line in your hosts file (/private/etc/hosts for OSX users, /etc/hosts for Unix/Linux users) such as:
    172.27.0.1 test.magento.com
    and then to use the corresponding URL while installation:
    Base URL = http://test.magento.com

    Reply
  • November 23, 2011 at 3:06 pm
    sameer gandhi

    hi,

    you can disable javascript and refresh you page and then continue with the setup.

    Reply
  • December 28, 2011 at 6:11 pm

    I was having same problem and it resolve. Thanks for such nice post.

    Reply
  • January 1, 2013 at 2:09 am
    ali

    thanks bro it help me alot 🙂

    Reply
  • February 12, 2013 at 2:12 pm

    WordPress blogs Site owner – Do you know could save 5-10 or so minutes every single day while using software? I been using it on my own sites and yes it constitutes a massive difference.

    Reply
  • August 17, 2015 at 11:47 am
    Abhimanyu

    hello… I am facing problem while installing Megento in wamp server…
    following error ….occurs…plz..help..

    Zend_Db_Statement_Exception Object
    (
    [_previous:Zend_Exception:private] =>
    [message:protected] => SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for ‘period’, query was: CREATE TABLE `coupon_aggregated_updated` (
    `id` int UNSIGNED NOT NULL auto_increment COMMENT ‘Id’ ,
    `period` date NOT NULL default ” COMMENT ‘Period’ ,
    `store_id` smallint UNSIGNED NULL COMMENT ‘Store Id’ ,
    `order_status` varchar(50) NULL COMMENT ‘Order Status’ ,
    `coupon_code` varchar(50) NULL COMMENT ‘Coupon Code’ ,
    `coupon_uses` int NOT NULL default ‘0’ COMMENT ‘Coupon Uses’ ,
    `subtotal_amount` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Subtotal Amount’ ,
    `discount_amount` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Discount Amount’ ,
    `total_amount` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Total Amount’ ,
    `subtotal_amount_actual` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Subtotal Amount Actual’ ,
    `discount_amount_actual` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Discount Amount Actual’ ,
    `total_amount_actual` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Total Amount Actual’ ,
    PRIMARY KEY (`id`),
    UNIQUE `UNQ_COUPON_AGGRED_UPDATED_PERIOD_STORE_ID_ORDER_STS_COUPON_CODE` (`period`, `store_id`, `order_status`, `coupon_code`),
    INDEX `IDX_COUPON_AGGREGATED_UPDATED_STORE_ID` (`store_id`),
    CONSTRAINT `FK_COUPON_AGGREGATED_UPDATED_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
    ) COMMENT=’Coupon Aggregated Updated’ ENGINE=InnoDB charset=utf8 COLLATE=utf8_general_ci
    [string:Exception:private] =>
    [code:protected] => 42000
    [file:protected] => C:\wamp\www\magento\lib\Zend\Db\Statement\Pdo.php
    [line:protected] => 235
    [trace:Exception:private] => Array
    (
    [0] => Array
    (
    [file] => C:\wamp\www\magento\lib\Varien\Db\Statement\Pdo\Mysql.php
    [line] => 110
    [function] => _execute
    [class] => Zend_Db_Statement_Pdo
    [type] => ->
    [args] => Array
    (
    [0] => Array
    (
    )

    )

    )

    [1] => Array
    (
    [file] => C:\wamp\www\magento\app\code\core\Zend\Db\Statement.php
    [line] => 291
    [function] => _execute
    [class] => Varien_Db_Statement_Pdo_Mysql
    [type] => ->
    [args] => Array
    (
    [0] => Array
    (
    )

    )

    )

    [2] => Array
    (
    [file] => C:\wamp\www\magento\lib\Zend\Db\Adapter\Abstract.php
    [line] => 480
    [function] => execute
    [class] => Zend_Db_Statement
    [type] => ->
    [args] => Array
    (
    [0] => Array
    (
    )

    )

    )

    Reply
  • August 17, 2015 at 12:00 pm
    Monu

    Hello Admin,
    I am facing problem installing Magento in Wamp Server.
    Please Help…Thankyou in Advance…
    This is the error I am Getting…

    There has been an error processing your request

    Error in file: “C:\wamp\www\magento\app\code\core\Mage\SalesRule\sql\salesrule_setup\upgrade-1.6.0.0-1.6.0.1.php” – SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for ‘period’, query was: CREATE TABLE `coupon_aggregated_updated` (
    `id` int UNSIGNED NOT NULL auto_increment COMMENT ‘Id’ ,
    `period` date NOT NULL default ” COMMENT ‘Period’ ,
    `store_id` smallint UNSIGNED NULL COMMENT ‘Store Id’ ,
    `order_status` varchar(50) NULL COMMENT ‘Order Status’ ,
    `coupon_code` varchar(50) NULL COMMENT ‘Coupon Code’ ,
    `coupon_uses` int NOT NULL default ‘0’ COMMENT ‘Coupon Uses’ ,
    `subtotal_amount` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Subtotal Amount’ ,
    `discount_amount` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Discount Amount’ ,
    `total_amount` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Total Amount’ ,
    `subtotal_amount_actual` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Subtotal Amount Actual’ ,
    `discount_amount_actual` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Discount Amount Actual’ ,
    `total_amount_actual` decimal(12,4) NOT NULL default ‘0.0000’ COMMENT ‘Total Amount Actual’ ,
    PRIMARY KEY (`id`),
    UNIQUE `UNQ_COUPON_AGGRED_UPDATED_PERIOD_STORE_ID_ORDER_STS_COUPON_CODE` (`period`, `store_id`, `order_status`, `coupon_code`),
    INDEX `IDX_COUPON_AGGREGATED_UPDATED_STORE_ID` (`store_id`),
    CONSTRAINT `FK_COUPON_AGGREGATED_UPDATED_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
    ) COMMENT=’Coupon Aggregated Updated’ ENGINE=InnoDB charset=utf8 COLLATE=utf8_general_ci

    Trace:
    #0 C:\wamp\www\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(645): Mage::exception(‘Mage_Core’, ‘Error in file: …’)
    #1 C:\wamp\www\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb(‘upgrade’, ‘1.6.0.0’, ‘1.6.0.3’)
    #2 C:\wamp\www\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb(‘1.6.0.0’, ‘1.6.0.3’)
    #3 C:\wamp\www\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
    #4 C:\wamp\www\magento\app\code\core\Mage\Core\Model\App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
    #5 C:\wamp\www\magento\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Model_App->_initModules()
    #6 C:\wamp\www\magento\app\Mage.php(684): Mage_Core_Model_App->run(Array)
    #7 C:\wamp\www\magento\index.php(83): Mage::run(”, ‘store’)

    Reply
  • September 8, 2015 at 7:00 pm
    Raj

    whenever we return true in ‘validate-url’ and try to continue we got database connection error,can you help me how to shot out it?

    Reply
  • October 6, 2015 at 12:27 pm

    nice solution bro

    Reply
  • September 15, 2016 at 11:37 pm

    Thankyou. I solved a problem with the installation of magento 9.1.2.4 thru this troubleshooting. God bless you!

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: