I made the site i was feeling proud...i posted it on facebook saying we would be up and running and I had the formallity of transfering it over to the webserver. We should be up in 2 hours i said, I was very very wrong
This may be a bit obvious to some experienced users but for me it was quite complex and my computer took much verbal abuse, i blamed everything on windows and swore to get a mac!!
So how to we go from local development to deployment and hosting?
So a few facts
I created my site locally on WAMP server with PhpMyAdmin to manage the database
My hosting provider has an apache server with SQL + PHP
Now I know there are a few tutorials on how to restore/backup/transfer sites but neither worked so here’s my solution
Fresh Install on Server:
I installed a fresh install of Modx on my server
---there are instructions for this and they are quite simple to follow in the Wiki
Note: I had to create a database first before i installed Modx and then i linked Modx to that database
Tips: when you you create a new database on your server please take down all the details on a beer mat before proceeding (and don’t worry if your server names the database for you... you can fix this later!!
....before i go on i’ll try to highlight the files that i needed to change fix to complete the install...if my methods don’t work you should know where to start looking! ps. error codes used with google are dynamite for fixing stuff
Testing the clean install:
When installing into your public folder i didnt have any trouble it worked perfectly...
when installing into a sub folder, you need to edit your HTAcess file to ’point’ to your new path
I was initially gonna post a full workaround for this but i think the reader should go and read about Htaccess config in more depth as well its got a ton of useful stuff SEO optimisation and security!
suffice to say that if i installed it in a modx subfolder part of my htaccess file should look like this
RewriteEngine On
RewriteBase /modx
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
further imformation can be found about this on the wiki
Now...What Next?
After the install was completed my new database filled with a fresh install
I removed install files from Server
simpily the install directory
I then FTP’d a copy of my local ’WAMP’ Modx replacing all my webserver files
The Database
Now this is where i had the problem
My webserver doent let you create a new unpopulated database from PhpAdmin (otherwise i wouldnt of had any problems)
but creates one for you and defines it...
So bearing that in mind lets export our WAMP one
In phpmy admin
select your modx database usuall called ’modx’
select export
make SQL is the type
Don’t worry about the naming template
just select Zip for compression and Export
you should now get a zip contaning an*.sql file...
...unzip and save the SQL file
your Database is exported sir and ready for import
..................................................................................
Access your SQL panel on your server (mines is phpmyadmin)
now so we can match settings the easy non techical way
export your modx freshly installed database!!
.......................................................................................
ok now lets open that SQL file
you might see something like this
-- --------------------------------------------------------
--
-- Table structure for table `modx_active_users`
--
CREATE TABLE IF NOT EXISTS `modx_active_users` (
`internalKey` int(9) NOT NULL default ’0’,
`username` varchar(50) NOT NULL default ’’,
`lasthit` int(20) NOT NULL default ’0’,
`id` int(10) default NULL,
`action` varchar(10) NOT NULL default ’’,
`ip` varchar(20) NOT NULL default ’’,
PRIMARY KEY (`internalKey`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=’Contains data about active users.’;
--
-- Dumping data for table `modx_active_users`
--
INSERT INTO `modx_active_users` (`internalKey`, `username`, `lasthit`, `id`, `action`, `ip`) VALUES
(1, ’admin562’, 1240405874, NULL, ’2’, ’87.177.11.233’);
-- --------------------------------------------------------
This sholud be in the second paragraph down
I want you to copy the lines
INSERT INTO `modx_active_users` (`internalKey`, `username`, `lasthit`, `id`, `action`, `ip`) VALUES
(1, ’admin562’, 1240405874, NULL, ’2’, ’87.177.11.233’);
and replace the ones in your SQL wamp export
this should take care of the settings without getting to techinical
...
Now in your WAMP export go in and delete this section...the header
...
-- phpMyAdmin SQL Dump
-- version 3.1.2
--
http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 22, 2009 at 05:39 PM
-- Server version: 5.0.77
-- PHP Version: 5.2.9
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `web53-admin-4`
--
CREATE DATABASE `53-admn-4` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `53-admn-4`;
...
you have to do this otherwise you are copying a database (your WAMP) to another database that already exists (your webserver
...
if you do these sections you won’t get an errors like this
#1044 - Access denied for user ’myname’@’localhost’ to database ’database_name2’
or
#1007 - Can’t create database ’database_name1’; database exists
...
So now we have done that lets set up our data base from the fresh install ready to be populated with our wamp info
right access your server Db from phpAdmin or whatever and drop all tables....(dont delete the database but drop the tanbles...there will be a screen to do this its not to hard to find)
...
Now we can import our export wamp SQL easily...go to import select the file n ’get it up u’ it works a treat!
Now i was going to go into the third step
configuring the config.ini.php file but i don’t have time
that ’ll be part II
but just to say its in your manage/includes directory
and you have to edit it to provide user, password and account details...written on the beermat!!
hope that help someone
thanks
Jamie
I’ll be posting my site soon for feed back