Friday, March 15, 2013

Buddypress wrong url issue and migration to new server [Solved]

Migrating a WordPress site can be something of a scary challenge, but we do it a lot, and we’ve become used to it. There are many good reasons to move a site – for example, you might set one up in a subfolder, and decide to move WP to the root. Or perhaps you’ve built a site on localhost and now need to put it on a live server.

If you do it incorrectly, you stand to lose all your widget settings, some file links and so on. This wasn’t a problem with ‘classic WP’ years ago, but these days there are many many paths stored away in the database, in various forms, and catching them all can be somewhat tricky.
Here I show you the steps we take moving a localhost site to a live domain. We’re using WPMU which is running the BuddyPress plugin suite.

The Local Install

media_1254926142419.png
Here’s our site on our localhost. As you can see, it’s pretty basic, but everything’s there that needs to be there – we know all elements of the install works, and now we want to pop it onto a live server. In this lesson, we’re going to use FileZilla and ftp the files across from our local install.

Copying the Files

media_1254926439240.png
On the left you can see we’ve navigated to our local filesystem for this install. On the right, we’re connected to the server. There are already files there, because we have an old install running. You should delete all the files and replace them with the new ones in this case, but if you are replacing a site do make sure you have a copy of everything. Merging sites is much harder than migrating – and way beyond the scope of this tutorial.
So – select and drag all the files from one side, to the other.

Moving the Database

media_1254927088021.png
Our preferred tool for administering databases is mySQL Administrator. A free tool that really simplifies a lot of DB Admin tasks. Use this to take a backup of your database. You’ll need to create a new backup project.
  1. Click Backup
  2. Create New Project
  3. Select the Schema you’ve been using
  4. Click to move it across, selecting ALL tables (unless you have multiple installs in one database, in which case, just the tables for the install you’re interested in)
  5. Give it a name
  6. Save Project
  7. Execute the Backup

Backup Done

media_1254927164402.png
You should now have a backup.
Because the server we’re using doesn’t allow connections on Port 3306, we’re going to use phpMyAdmin there. This is no problem at all, but if you were using mySQL administrator you could use the restore tools there. If you’re doing this kind of project you should really know how to use these tools anyway – I’m only explaining these steps for completeness sake and showing you a migration I’m doing myself that’s likely to be typical.

Editing the SQL

media_1254927350304.png
A database backup is done simply as a big set of SQL statements that you can run. If you’re migrating to a different database you’ll need to edit the CREATE and USE statement to tell it which database to use.
Be very careful with this database dump by the way – database dumps are a very easy way for hackers to get into your system and find out lots of information you’d rather not give away.

Importing The Database

media_1254927962875.png
Now you need to Import the Database. We’re using phpMyAdmin for this. If you have any tables there already, it’s probably best to drop them. All of them. Like I say, if you’re merging you’re going to need more help than this guide can provide.
  1. Click on the Import tab
  2. Select your file (if it’s bigger than your sever’s upload limit then you’ll have to speak to your admin guys about how to do this.
  3. Press the Go button!
Once the import has run successfully you should see a message saying something like "Import has been successfully finished, 95 queries executed." – and it can be an awful lot more than 95 queries! It can also take quite some time. If you need to handle large datasets it’s far easier to use the mySQL Administrator tools – phpMyAdmin can get clunky.

Visit the Site

media_1254928211787.png
If you try to visit the new uploaded site at the moment you’ll get a Fatal Error because all sorts of things are confused.
You need to change the wp-config.php file.

Changing wp-config.php DB Settings

media_1254928518189.png
Change 1, 2, and 3 to match your server’s database settings.
Change 4 to the appropriate path. Most installs are in the root directory, so that would mean $base = ‘/’;
Change 5 to the domain name in use.
Change 6 from ‘/buddypress.11/’ (or whatever your local path is) to the new path, like in 4, so in most cases that will be ‘/’ also.

Search & Replace on the Database

media_1272277924659.png
You now need to run a search and replace on the database – including all incidences of code within serialised PHP strings. There is an excellent and free utility written by Interconnect IT, called the Safe Search and Replace Tool.
I can’t emphasise enough that it’s important to handle serialised PHP correctly. If you don’t, then settings will go missing, fields will get corrupted, and your site runs a severe chance of not working on the new location. It’s a pain, but it’s important.
So, download the program, place it in your blog’s root folder and then run it by visiting the appropriate URL.
If you’re getting confused at this point, perhaps you shouldn’t run the program. Just saying, because it can cause plenty of damage!

Running the Script

media_1254930511307.png
Simply visit http://www.example.com/searchreplacedb.php in your browser to fire off the script. This will run. If you experience a time-out, or too much output, you may need to go into the script and remove any echos that are slowing it down. I’ll probably comment this out in due course anyway, but for diagnostics purposes I’ve left it. Once run, you should see something like the above at the bottom. Even a very large search and replace should only take a few seconds.

Some Tweaks

Check that you can navigate your site in its new location.
You may have to modify .htaccess to fix paths, and you may need to check your uploads folder for media. But that’s it. All should be good.

Extra Steps for WordPress MU

media_1254930620452.png
If you’re using WordPress Single User, then that’s it. You’re all done!

But in this example, we’re running BuddyPress on WordPress MU, and that means one extra step. In phpMyAdmin you need to open up (1) wp_blogs, (2) click the browse tab, and (3) click the edit tab for each row. If you have a lot, you may wish to run another searchreplacedb.php against the database, looking for localhost.localdomain and buddypress.11 and swapping them appropriately.

Friday, January 11, 2013

Indian Army : Ghost Solder on Duty Reporting Sir..


“Harbhajan Baba ki Jai” (Glory to Harbhajan Baba), cry out many voices in unison as tourist buses, packed with both Indian and foreign tourists, cabs full of people and private vehicles, all cross the bridge over the Teesta River to enter the border sate of Sikkim in India. Harbhajan Baba is revered across Sikkim as a sacred person. 

This is his story:
nathula pass.jpg
Nathula Pass

The late Harbhajan Singh enrolled in the Punjab Regiment in 1966, joining the army at an early age. He became a Sepoy (a rank in the Indian Army) and found himself posted on the misty heights of the China - Indian border, near Nathula Pass. 

Two years later, while escorting a mule caravan from his battalion headquarters at Tukla to Deng Chukla, he fell into a fast- flowing stream and was washed away.

The army searched for his body, but it wasn’t found until he began appearing in the dreams of other Sepoys in his unit. In the dream, he informed his colleagues that he was no longer alive and told them where to find his body. He also told them that he would continue to be a soldier always and not tolerate in lax patrolling of this sensitive border. 

When a search party was dispatched to the spot that had been described in the dreams, Sepoy Harbhajan Singh’s body was found. He was cremated with full military honors, and a memorial shrine was made at Chhokya Cho dedicated to his memory. This shrine is a three-room complex where there is a bed laid out for him and his uniform and boots displayed for the visitors. The caretakers swear that each morning the bed sheets are crushed as if someone has slept in the bed the previous night and the carefully polished boots are soiled and covered with mud.

There are also many army reports of a lone man patrolling the area. Soldiers deployed in the area often talk of a lone uniformed man on horseback patrolling the region. Forces on the other side of the border have also confirmed these reports and claim that they too have seen the ghost rider.

Over the years, soldiers here have claimed seeing Harbhajan Singh in their dreams where he instructed them of unprotected areas from where the Chinese could attack. His instructions generally proved accurate and the legend of Baba Harbhajan Singh grew.
There are also stories of battle-weary soldiers who have nodded off during their patrols being woken up with stinging slaps. Obviously, this ghost does not tolerate laxity in duty.

Baba Harbhajan Singh
Baba Harbhajan Singh

The Indian army continued to promote this Sepoy as if he were still alive. A paycheck would be sent home to Punjab every month and he was given annual leave on September 14 every year, when soldiers would pack his trunk with basic essentials. Two soldiers would accompany the trunk of ‘Capt Harbhajan’ all the way to Punjab by train, and it would be brought back after a month the same way. This tradition continued for years until he was retired a few years back.

When I visited the shrine of Harbhajan Baba on my way to see the Nathula border, I witnessed this incredible scene of a dead man’s belongings being packed in a trunk, and being seen off by his fellow officers for a month’s leave.

At 14000ft, located amidst towering mountains, broken by gushing waterfalls and colorful heather and gorse bushes, this shrine attracts devout believers from all over India. Following the twisting narrow roads at a steep incline, vehicles snake their way to this shrine and all people passing through this area, civilians and soldiers alike, generally stop at the shrine to pay obeisance to the revered Baba. Not doing so is supposed to bring bad luck.

Baba Harbhajan Singh Shrine




Way to Nathula

Perhaps the Chinese are just as superstitious as we are because at the monthly flag meetings between the two nations at Nathula, even today the Chinese set a chair aside for the ghost of Harbhajan Baba.

As the Indian flag flutters in the icy winds, it grows misty. Cold fingers of fog creep up to wipe out the sun and it is not difficult to imagine a lonely figure guarding his country’s borders with a zeal that has lasted beyond death.

Believe me, this shrine with its resident ghost sent shivers down my spine when I heard the story of this patriotic ghost soldier while sipping hot tea the caretakers offer to all who come to visit this shrine in the remote border area.


Way to Nathula1

Popular Posts