cancel
Showing results for 
Search instead for 
Did you mean: 

SETTING UP A MAGENTO SITE ON LOCALHOST

SETTING UP A MAGENTO SITE ON LOCALHOST

Hi,

I am facing issue in porting our live code base to local host for development purpose and to test locally before uploading the changes on live server.

Magento version : 1.9.2.2 CE

Challenges i am facing are 

1. live db is quite big having some 50k plus products so it is not feasible to dump the data on each developers pc, so we have hosted the db server on public ip machine for every developer to connect to that db by doing changes in app/etc/local.xml 

<host><![CDATA[Static IP of the database server]></host>
<username><![CDATA[username]]></username>
<password><![CDATA[PASS]></password>
<dbname><![CDATA[DB_NAME]]></dbname>
Does the db needs to be hosted locally only,if it is so how will multiple developers work since it is not feasible to dump db on each developer machine.
2. On running in wamp server it keeps on redirecting to live site
 
Steps undertaken to port to local host
1.Took the dump of mysql database and code base.
    copied the codebase in www folder of wamp server under directory named live.
   Dumped the db on public ip machine and it is accessible from each developer machine 
2. Edited app/etc/local.xml file and put correct mysql hostname, username, password, and database name
3.Updated base URL in core_config_data table by executing the following command
   UPDATE core_config_data SET value=”http://127.0.0.1/live/” WHERE path=”web/unsecure/base_url”;
UPDATE core_config_data SET value=”https://127.0.0.1/live/”  WHERE path=”web/secure/base_url”;
 4. edited the .htaccess file to point to local host
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://127.0.0.1/live/$1 [R,L]
   Not sure whether this is the correct way
 
After doing all this activity i am still getting redirected to live site on entering url https://127.0.0.1/live/
 
Secondly i am not able to open admin panel also.
 
If someone can help me this regard, I will be grateful as i am new to magento 
 
 
 
6 REPLIES 6

Re: SETTING UP A MAGENTO SITE ON LOCALHOST

Just to add i have deleted content in var/cache and var/session folder too

Re: SETTING UP A MAGENTO SITE ON LOCALHOST

You can definitely run MySQL on a separate machine. It doesn't have to be run locally.

You do not need to setup the redirects as changing the Magento Base URL should suffice.

You may need to look around and see if there's anything else is causing the redirect to the live site, for example hardcoded links.

If you can't get this to work at worst case you may want to consider setting a host entry at your local computer to point the live domain to your local environment instead so you do not need to change the Base URL.

Re: SETTING UP A MAGENTO SITE ON LOCALHOST

Hi James,

Thanks for your reply, i will try to figure out any hard coded link if any.

 

I have one more doubt regarding working on magento , we have a team of 5 developers now once the live code base has been copied on local system we are maintaining the list of files that are changed locally and then only those files are replaced in the live code base.

But suppose if we add some attribute via admin panel how will i come to know which file has been modified since there is very less documentation about what magento does in the backend.

 

Regards

Kiran

 

Re: SETTING UP A MAGENTO SITE ON LOCALHOST

If you make any changes at Magento Admin, this will be reflected in the database.

I am not a developer so I may be wrong but I believe that you can either copy your dev environment to the live environment (and merge the other data like customer and order details) or you can document any changes you've made to the dev environment to be replicated at the live environment.

Re: SETTING UP A MAGENTO SITE ON LOCALHOST

Hi James,

Thanks a lot for the guidance, actually i am quiet new to magento ie some of my doubts may be very basic one.

 

Regards

Kiran Bhushan

 

Re: SETTING UP A MAGENTO SITE ON LOCALHOST

  1. Connect to a central database server instead of hosting the database locally on each developer's machine. Modify the app/etc/local.xml file with the correct remote database server details for each developer's setup.

  2. If you're redirected to the live site after porting, clear the cache, verify the core_config_data table values for web/unsecure/base_url and web/secure/base_url, and ensure the .htaccess file is properly configured.

  3. If you can't access the admin panel, check the admin panel URL, file permissions, and consider clearing the admin session.