News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF tutorials: How to setup a localhost for testing

Started by ɔɔɔɔɔɔuɥoɾ, July 18, 2010, 12:36:10 AM

Previous topic - Next topic

ɔɔɔɔɔɔuɥoɾ

SMF tutorials:

How to setup a localhost for testing

In this Tutorial you will be learning how to set up a localhost so you can test and practice your PHP without dooming your forum.
Using a locally hosted forum makes editing really easy and fast with no uploading. I will be using Xampp in this tutorial, their are other software's that do the same thing, choose which every is your preference.


1st of all, install the Xampp, this is relatively easy, just follow the on screen instructions and then, if default settings were used you localhost files will be located C:\Xampp\htdocs, we erase (or move to another folder) the current files that are in their. This is where we extract the SMF installer zip file to.



If you don't have Winrar, zips can be extracted without any additional software in Windows (XP or above), whichever method you use, just make sure index.php extracts to the htdocs folder along with the rest of the root files and folders. I recommend leaving the smf installer zip inside htdocs, simply because when your done testing, you can simply extract here again and start a fresh installation easily.

Now, We have the installer files ready its time to setup our database for smf to use, this is simple too. We simply go to phpmyadmin and add an account.

http://localhost/phpmyadmin/ is the default address

Click on Privileges, Click on Add New User. Fill in the Login Information form.





On the Host part, use the drop down menu to select Local.

On the password drop down menu, select Use text field.

Now before creating the account, check the Global privileges area, Click the Check All then click Go in the right bottom corner



Tip: Since were using localhost for testing only, I set my database name the same as the password and user I will use for smf, ordinarily this is a no-no, but since its only local and were testing we can use this, because then we can have Firefox remember the password so every time we use the installer it will remember our database info as well as our smf login information.

Now we got that done, we use the usual method to install smf, We just type localhost in our web browser to start the smf installation process
When we get to the create admin account, providing we saved the login information (using Browser) from logging into database, it should be pretty much filled, all to fill is the confirmation password for the new admin account and the database password. Once we do that were done, we have our forum set up and ready to do all our testing.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

cicka


ɔɔɔɔɔɔuɥoɾ

Your Welcome,

Not quiet sure where this belongs, maybe their is/should be a tutorial board somewhere in the forum, I think little tutorials to explain little things in small dose's will help out smf users a lot, especially newcomers that overlook the smf online manual

(I made this tutorial myself)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

cicka

Quote from: ♪ JohnCcCcCc ♫ on July 18, 2010, 12:20:41 PM
Your Welcome,

Not quiet sure where this belongs, maybe their is/should be a tutorial board somewhere in the forum, I think little tutorials to explain little things in small dose's will help out smf users a lot, especially newcomers that overlook the smf online manual

(I made this tutorial myself)

Yes, I am sure it will help the new admins a lot.

~DS~

I am trying to figure how to make them secure...

Thank you for sharing.

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

sAce

Why are you creating another user ? you can simply use the root user with no password

ɔɔɔɔɔɔuɥoɾ

#6
Well, for speed, Since we will be erasing and re using the smf installer several times, I had the idea to have the browser remember the password, thus less typing for us, to complete the speedy idea, I though to use the same name in smf, I don't think SMF allows blank passwords, thus we create a password for both.

Using this method it takes me mere seconds to create a complete new forum with new database too

1. Extract Zip over other files
While that's getting done

2. Drop all the tables from the database.

3. Run the SMF installer, almost all the forms are already filled, thanks to Firefox remembering our settings.
Since the SMF admin account and database password are the same, it remembers for both (localhost URL)



Quote from: Delita Heiral on July 18, 2010, 02:11:55 PM
I am trying to figure how to make them secure...

Thank you for sharing.
Im not a mac user,thus unsre about 2 of those errors.
You can make the MySQL secure by adding the admin account with a password, you can also add a password to the root account, just to make sure its not throwing that "un-secure" error


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

sAce

Well do one installation every 2nd day, and the only thing i change is the user to root, and it that much of work now, is it ?

But your method is fine, but speed , nah!!

And blank passwords are not allowed for users, but Db settings does take blank passwords

ɔɔɔɔɔɔuɥoɾ

Quote from: S-Ace on July 18, 2010, 03:20:01 PM
Well do one installation every 2nd day, and the only thing i change is the user to root, and it that much of work now, is it ?

But your method is fine, but speed , nah!!

And blank passwords are not allowed for users, Db settings does take blank passwords
Exactly why I create a db account with a password ;)

I make, well try to make mods, and when I do I have to be checking for errors in the log, a lot, since I'm not that good yet, I'm still  a beginner, (take a look at my mods, link in sig) So every time I make a revision to the mod I'm creating, I need to start with a completely clean forum, so every time I fix something, which is usually several times per day, this seems quiet needed.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

sAce

anyway, at the end of the day getting it done matters, right ?

ɔɔɔɔɔɔuɥoɾ

Quote from: S-Ace on July 18, 2010, 03:31:31 PM
anyway, at the end of the day getting it done matters, right ?

I would assume newcomers like me will face the same difficulties, so I may as well help them out.

And yes, its getting done :)

Any better place for this tutorial?


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

sAce

Two boards can accept this, Install & upgrade or Tips and tricks

ɔɔɔɔɔɔuɥoɾ

Quote from: S-Ace on July 18, 2010, 03:50:13 PM
Two boards can accept this, Install & upgrade or Tips and tricks

Request to move to Tips and Tricks then? ...


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers


yakyakyak

Please read the tutorial step-by-step

Every stage is so well documented

Quote
Now, We have the installer files ready its time to setup our database for smf to use, this is simple too. We simply go to phpmyadmin and add an account.

http://localhost/phpmyadmin/ is the default address


Reefie


A world without a reef is a world in chaos

ɔɔɔɔɔɔuɥoɾ

Quote from: Reefie on September 01, 2010, 03:15:23 PM
simple and effective thanks for sharing

Thank you, I'm glad this could help you :)


Feedback is welcomed, I'm sure I have documented everything well, if you don't think so, please reply and tell me :)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

KensonPlays

JohnCcCcCc, did you know in xampp settings you can create a password for the root? Look around, you can find it :)

Owner of Mesozoic Haven

ɔɔɔɔɔɔuɥoɾ

Yes, I know that, but I used this way so I can show members how to create additional accounts also, this way people reading the tutorial can learn more from it ;)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

lucas-ruroken

Adk Portal 3.1 is coming....

Design your universe!

KensonPlays

Ok, I kept "root" and changed password, because it is faster to type "root" rather than "kcmartz" or "administrator".

Owner of Mesozoic Haven

ɔɔɔɔɔɔuɥoɾ

The add user was intended for learning purposes, also, for testing, you can set your smf pass and username the same and have your browser remember it, Read a few posts up, I already explained this, the quickest way to set up a forum from scratch.

I have managed to do it in less than 10 seconds ;)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

KensonPlays

Install a whole SMF? wow. It takes me around 2-3 minutes!
Both localhost, and a live site!

Owner of Mesozoic Haven

ɔɔɔɔɔɔuɥoɾ

See, I don't post this information for nothing, it all has a purpose, you just need to read "all" the details, in 1st post and replies.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

KensonPlays

... i read them. i was just stating that.

lets GET BACK on TOPIC now ok?

Owner of Mesozoic Haven

ɔɔɔɔɔɔuɥoɾ

Quote from: Kcmartz on September 09, 2010, 01:12:33 PM
... i read them. i was just stating that.

lets GET BACK on TOPIC now ok?

Actually we're still on topic for the most part, but if it was off it would be you needing to get back on topic :P


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Kat9119

I'm using XAMPP and I have gotten fresh installs to work. But I really need an exact copy of the one I'm currently using.

I tried to just copy all files and put it in the directory I'm supposed to. But I can't do that because #1 all the database data is different and #2 there is no install file. There might be more issues too but I'm not sure.

So, how do I exactly go about doing this?

ɔɔɔɔɔɔuɥoɾ

Well, you will need to transfer your database to your local host also you can make a backup from your online forum using phpmyadmin, then simply import that into your localhost also using phpmyadmin.
Everything should go well if you download your forum files and place them into the directory where you want your forum.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Kat9119

Quote from: ɔɔɔɔɔɔuɥoɾ on October 09, 2010, 03:33:09 PM
Well, you will need to transfer your database to your local host also you can make a backup from your online forum using phpmyadmin, then simply import that into your localhost also using phpmyadmin.
Everything should go well if you download your forum files and place them into the directory where you want your forum.

Thats what I was thinking. Am I going to have issues with the database name and username/password in the SMF files vs the local database?

xenovanis

You can import the database in phpMyAdmin. Just setup a new database, you can use the same name if you want.

After restoring the database, run repair_settings to set up a connection to it and to restore the paths and urls.

What is repair_settings.php?
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

Ok, when I go into the phpMyAdmin of my localhost, I click on the database I want, and choose to import. I upload my real database...but it never actually uploads? All it says in the bar at the bottom is "sending request to localhost" and nothing ever happens....

Kat9119

Ok, turns out the database I guess was too big at 40mb, so I zipped it and was able to import it this time.

I named my database the same name as my live forum, added all my backed up files, and ran repair_settings.php I still get a Connection error:

Connection Problems
Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.

The paths and URLs are set & the username is root and no password database name is the same as the old one and same as the one I just set up...

I do notice if I go into the local phpmyadmin there are only 61 tables instead of 70 something on my live site.

Any suggestions on something I could be doing wrong?

xenovanis

Are you sure your database name is the same? On hosting packages, databases usually have a prefix which they don't specifically have on your localhost.

If your database is too large to import through phpmyadmin, you can use the source command to import the database:
Copy the database sql file to the /xampp/mysql/bin directory
Windows -> Start -> Execute -> cmd
Go to the mysql bin directory using cd commands (like cd xampp -> cd mysql -> cd bin)
Enter commend: mysql -u root -p
Enter command: connect {database}  (database name here)
Enter command: source (databasebackup.sql} (filename of the backup here)
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

#33
Yup, my database is NAME_NAME and so when I made the new one I just copy and pasted it into the local phpmyadmin (and double checked it was right on my live forum) and when I did the repair settings I made sure it was the same as well, it auto filled out my old password and username, and I'm guessing since its all local I would just input the "root" as user and no password, When I leave it auto filled out it gives me an error that the SQL info isn't correct.

Could it have something to do with the fact that Flashchat & coppermine are integrated but I haven't put up databases for those? I'm not interested in having those in the test area anyhow

I notice that the following tables are missing as well:
smf_message_icons
smf_moderators
smf_ob_googlebot_stats
smf_package_servers
smf_permissions
smf_personal_messages
smf_pm_recipients
smf_polls
smf_poll_choices
smf_sessions
smf_settings
smf_smileys
smf_themes
smf_topics
smf_xlinks

xenovanis

Well, that should work then. No idea why it's not working. Unless the most essential tables from your database are missing.

After saving repair_settings the first time, where you corrected the mysql settings, at the bottom of the page, were there more links to correct? If SMF can't find the database, repair_settings will only show the fields for the mySQL info and the path and url to your forum. If the MySQL information is entered correct, after saving, additional fields for avatars, attachments and themes paths and url's will should appear.
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

Whoops, updated my above post with more info.

There are three links to correct, the forum url, forum directory and sources directory, thats all that shows at the bottom. But there are no errors showing on the page

xenovanis

Weel, before trying to connect, you should import the database properly. The settings table is a keytable, without that your forum won't function anyway.
See my previous post on using the source command:
http://www.simplemachines.org/community/index.php?topic=391328.msg2814098#msg2814098
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

#37
I went in, selected the missing tables, and exported them then imported them. When I saw that was one of the missing tables I figured that was my issue. Repair settings does work.

However, now I have a new problem LOL. As soon as I get into the forum it tells me I'm banned. I'm guessing I need to edit a table to fix this issue, but I'm not quite sure what I'm doing. I'm gonna attempt to just delete the ban table, and hope that works. I guess I can always import it again if not lol

Thank you for your help. I'm learning a lot though :)

xenovanis

Using source is cool though. You get all these lines running in your screen, like in DOS :)

Since it's your local host, you could truncate the smf_ban_items table. This should clear all bans.
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

Quote from: xenovanis on October 10, 2010, 02:57:44 PM
Using source is cool though. You get all these lines running in your screen, like in DOS :)

Since it's your local host, you could truncate the smf_ban_items table. This should clear all bans.

Hum, Not sure what you mean. I emptied both ban tables, then tried again...couldn't get in. Then I dropped both tables, and couldn't get in...

xenovanis

Well, dropping tables that are part of the installation wouldn't be a good idea now, would it?

Did you try clearing your cache after truncating the ban tables?
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

I just figured I'd give it a test to see if it would work LOL. But nothing.

I did clear everything with ATFcleaner and nope, still says "sorry guest you are banned" if I try to login with my info says the same thing...

xenovanis

Odd.. Can you see what's logged in the smf_log_bans table? Just sort by id from high to low.
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119


xenovanis

Click browse to see the content. This is the structure ;)
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

Hahaha, oopsy. Nope, if I try to click on that I get an X and can't see it

xenovanis

So, you see a message you're banned, yet no trigger is logged?

Can you see the latest errors added to the smf_log_errors board?
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

Yup, I can see the latest. Just says the same thing, that "Sorry Guest, you are banned from using this forum!" and the localhost IP 127.0.0.1 and the session number

xenovanis

Hey, what's the table fc_bans doing? Anything in there perhaps?
"Insanity: doing the same thing over and over again and expecting different results."

Kat9119

Can't browse that one so I'm not sure. But that should just be flashchat

Kat9119

#50
Ok, so, I went into my live site. Browsed the ban triggers. Someone had banned the IP of the localhost and it was a migrated ban from yrs ago when we used phpBB. So I unbanned it. Exported the database again, and imported it and reran repair_settings.php

Most of it seems to be fine, except some small template issues which I have no idea why they'd look different...for example, I have the random quote mod installed, and the background color for it is wrong. Also, the whole forum should be in a table, and its not...these are the #1 reasons I wanted to have a local forum so I could test how mods would look being that its in a table and some mods don't work well with it.

So, I need to figure these things out. I figured maybe it had something to do with the theme settings. So I went into the admin panel for that, and switched everything to the localhost (thought repair settings should have done that) but it still didn't fix it. 

I was going to attach two pics, but now there are no options to do that...so maybe its not allowed now...weird

EDIT: Ok, all fixed! I had to go into Themes & Settings and click on "attempt to reset" thank you SO much for sticking with me and helping me out! Much much appreciated

ɔɔɔɔɔɔuɥoɾ

I get here all late, but welldone :)
Now you can do all your testing :)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Advertisement: