Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Migrating localhost Silverstripe to live site


Go to End


4 Posts   3929 Views

Avatar
Marc Lester Comia

Community Member, 2 Posts

2 November 2015 at 10:57pm

Good day,
Silverstripe version 3 +
I have a trouble migrating my localhost silverstripe to a live site. In my localhost everything is fine up and running now I decided to transfer my localhost silverstripe to live site. "What i did"
1.) from my HTDOCS folder of my xampp i copy the localhost silverstripe "htdocs/silverstripe" i did not include the folder[silverstripe].
2.) I export the localhost database and I create a new database name in live site then imported the 1905035_silver.sql
3.) I check the mysiqte/_config.php
$databaseConfig = array(
'type' => 'MySQLDatabase',
'server' => 'pdb3.biz.nf',
'username' => '1905035_silver',
'password' => 'secret(^__^)', <=== nevermind this
'database' => '1905035_silver',
'path' => ''
);
4). When i browse the site example "silverstripe.co.nf" it redirect me to Error 403 Forbidden.

Can anybody help me to fix the problem and also if you can give me steps to do? i don't think that what i did is correct maybe i missed something to do. I'm hoping that the SILVERSTRIPE developer or the editor can create a basic screenscast for migrating silverstripe local to live site.

I really appreciate your help. Cheers mate..

Avatar
helenclarko

Community Member, 166 Posts

4 November 2015 at 9:27am

Hi Marc Lester Comia,

When moving my local sites over to a web server, I tend to leave the install.php file available online (Atleast while the site is not live).
The install.php file can be a great tool for letting you know what needs to be enabled/dissabled on your webserver, I would start here.

Once your webserver passes all the install.php checks (DONT HIT INSTALL SILVERSTRIPE), you should move on to checking your .htaccess file for mod_rewrite rules. Often on xampp server you will have multiple folders with different websites inside each, you may have changed your mod_rewrite rules to allow silverstripe to work from a "/silverstripe" folder.
When moving over to the web server, you would usually copy the install folders (Framework, cms, themes, mysite, e.t.c) over to the root of your "/htdocs" folder.

However you are not limited to installing this way and if you wish to have a silverstripe folder within "/htdocs" which then holds you install files (Framework, cms, themes, mysite, e.t.c), you will need to modify your ".htaccess" file within the "silverstripe" folder.

You would need to add this:

	SetEnv HTTP_MOD_REWRITE On
	RewriteEngine On
	RewriteBase '/silverstripe'

-helenclarko

Avatar
Marc Lester Comia

Community Member, 2 Posts

4 November 2015 at 12:10pm

Hi helenclarko

Thank you for giving me the idea really appreciate. I have lots of question please help me.

Question #1
After i modify the mod_rewrite /silverstripe to / . then i browse my site example "silverstripe.co.nf" do i need to the "silverstripe.co.nf/dev/build" and "silverstripe.co.nf/?flush=1"? . sorry for this question i think this is stupid but I am confuse how to use dev/build and flush=1 and ?flush. I am thinking if i used one of this and i get error on the live site another uploading again queued files 15,000 + using ftp filezilla.

Question #2
ss_environment.I am using _ss_environment.php in my localhost? my ss_environment.php located on htdocs/_ss_environment.php. I am thinking how to include this when migrating local to live site here is my code snippet:

// mysite/_config.php
<?php

global $project;
$project = 'mysite';

global $database;
$database = '';

require_once('conf/ConfigureFromEnv.php');

// Set the site locale
i18n::set_locale('en_US');
?>


<?php
//_ss_environment.php

define('SS_DATABASE_USERNAME', 'root');  //change to live site db name
define('SS_DATABASE_PASSWORD', ''); //change  to live site db pw
define('SS_ENVIRONMENT_TYPE', 'dev');
define('SS_DATABASE_CHOOSE_NAME', true);
define('SS_DEFAULT_ADMIN_USERNAME', 'myadmin');
define('SS_DEFAULT_ADMIN_PASSWORD', 'myadmin');
define('SS_SEND_ALL_EMAIL_TO', 'mymail@mymailcom');
?>

Do i need to add this into my live site under public_html/_ss_environment.php all together in (Framework, cms, themes, mysite, e.t.c) ?
How about the

define('SS_ENVIRONMENT_TYPE', 'dev'); 
what would be the value when migrating into live site?

- Marc lester Comia

Avatar
helenclarko

Community Member, 166 Posts

4 November 2015 at 3:56pm

Hi Marc Lester Comia,

To answer Question #1:
You can do both together, "silverstripe.co.nf/dev/build?flush=1". I recommend doing this.

To answer Question #2:
Currently I'm not using ss_enviroment, so I could be very wrong with these answers.
A lot of those variables should already be defined within your _config.php file.

define('SS_DATABASE_USERNAME', 'root'); //change to live site db name
define('SS_DATABASE_PASSWORD', ''); //change to live site db pw
define('SS_ENVIRONMENT_TYPE', 'dev'); //change 'dev' to 'live' when site is live
define('SS_DATABASE_CHOOSE_NAME', true);
define('SS_DEFAULT_ADMIN_USERNAME', 'myadmin'); //set admin username (both this and password can be removed if you already have an admin account)
define('SS_DEFAULT_ADMIN_PASSWORD', 'myadmin'); //set admin password
define('SS_SEND_ALL_EMAIL_TO', 'mymail@mymailcom'); //not really required on live site

-helenclarko