View Single Post
  #1  
Old 01-28-2015, 01:23 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,988
Kyttias is on a distinguished road
Arrow [guide] Setting up WAMP w/Mysidia

WARNING: LOTS OF IMAGES.
(And they are gifs.)
What is WAMP?
WAMP is short for Windows-Apache-MySQL-PHP and it's everything you need to turn your very own computer into a server that can host websites - like Mysidia! This is great news for developers who want free testing space before they go live with their projects and pay domain fees, etc. (There are Linux and Mac equivalents, as well as some more multi-platform alternatives - LAMP/MAMP/XAMPP - and if you choose to pursue them, you can still try to follow along with this tutorial.)
Cool! How do I get it?
This part's easy. Head on over to WampServer.com (their site is also available in French and Russian, check the top right corner) and scroll down to the Downloads section. Before you choose a download, find out if your Windows is 32bit or 64bit (on Windows 8 / on Windows 7 / see related articles for others). My computer is 64bit, so I will choose this link:
Once it's done downloading, find the file. We're going to open it by right-clicking and hitting 'Run as Administrator'.
It's going to ask you what you want your default browser to be. You can go through the trouble of finding it, or not, the choice is yours. Immediately afterward it's going to ask Windows Firewall for permission. Leave just the first box checked, as this should be default.
Hit next, and then finish. (If you're curious about SMTP, it has to do with sending out e-mails. If you'd like to configure this, read this article and follow it's steps later -- but it isn't a necessary component, so we'll be leaving the default values!)
Now what?
WAMP is now installed and should be running! Find it in the lower right hand corner (it may be hiding). Right-clicking on it brings up one menu, left-clicking brings up another. Pressing 'Put Online' will activate the server (the icon will change colors as it's working - if it's ever stuck on yellow, something is very wrong!). If the icon is hiding, go ahead and drag its butt out and sit it on the taskbar so you can get to it.
Tip: If WAMP has trouble starting (getting past the icon's yellow stage) now or ever, turn off Skype completely and then try turning WAMP on. They share the same default port, and Skype is smart enough to use a different one if its first choice is taken - so you can safely turn Skype back on once WAMP is on.
WAMP installed into C://wamp. Inside, there is a folder called www. This is where your site's files will be stored. It is safe to delete the contents! The folder must stay named www. You can either move the contents of Mysidia here (after unzipping, of course), or in a subfolder. For the purposes of this example, I won't be using a subfolder (there are benefits to using subfolders, such as ease of making multiple sites).
MySQL Database Setup
Just like you would using a real host, you need to create a database to use for you site. You can name it whatever you like - just remember what you name it. From the WAMP icon in the lower right, open up phpMyAdmin. Select the 'Databases' tab and create a new one right here.
You're also going to need to set a password for the root user. The second tab at the top is SQL, and we're going to use it to run a command that will set the password. (Obviously replace yourpassword with an actual password for yourself, lol?) Put in:
Code:
SET PASSWORD FOR root@localhost = PASSWORD('yourpassword');
Now, open up the C:\wamp\apps\phpmyadmin4.1.14 folder and then open up config.inc.php - if you open in Notepad, this is fine. Find this: $cfg['Servers'][$i]['password'] = ''; (you may need to set the search to 'Up' rather than the default 'Down' to locate it, you might not). In the empty single quotes, place in the same password you created above. For good measure, restart the server using the WAMP icon.
Apache and Mod_Rewrite
Your site can be accessed by visiting http://localhost/ or http://127.0.0.1/ (or these and the name of your subfolder following the slash, if you have it in a subfolder) but not quite yet. Right now you're just going to get a 500 Internal Server error. See, Apache has modules - and on most webhosts, there are a handful of basic ones that are already turned on. But you're going to have to do that yourself! Our .htaccess file (included with the Mysidia files) is trying to access the Rewrite module - so we need to find it and enable it. Use the WAMP icon in the lower corner. You may need to scroll down to find it!
Rename Config
A new 'error' has taken the last one's place. Well, no, actually! In your Mysidia files, pop into the inc/ folder and rename config_adopts.php to merely config.php.
PHP.ini: Disabling Notices & Strict Standards
What?! More errors?! Also, no, haha. It's still just confused. Notices and, a similar warning, strict standards - are not errors, merely recommendations. Let's turn these off so we don't have to stare at them. Use the WAMP icon to open up your php.ini file, search for error_reporting = E_ALL and change the value to E_ALL & ~E_NOTICE & ~E_STRICT. You'll want to restart the server after saving these changes. Be patient and wait for the light to turn green again before proceeding.
Installing Mysidia Adoptables
The only remaining error is that it can't find the database. This is because we haven't actually installed the Mysidia framework yet, silly! Now we're going to visit http://localhost/install and set up just as we would on a normal host. I hope you remember the name of your database and the password you set! The default user for MySQL is root. You must set the Domain field as 127.0.0.1 and you must log into your site using this address. Localhost will not work for this field. If you installed into a subfolder, put the folder into the script path. I zoom through the entire install, leaving many things at their default, but please read it and take your time!
What's next?
That's all! This is all you need as a development environment. Always access your site with 127.0.0.1, not localhost - else you'll have issues logging in/staying logged in. So go ahead and bookmark 127.0.0.1. You could always open up C:\Windows\System32\drivers\etc and open the hosts file up in Notepad and add a line (after those already there, change nothing) like:
Code:
127.0.0.1       mysite.dev
^ And then you could type http://mysite.dev into the browser to access your site. But this only effects YOUR computer, and only ever will, not even others on your area network. If you know the LAN IP of your device, you could punch it in to other computers on your local/wifi network and also see your site. Set your IP to static, and you could even edit the hosts files on those computers to access your site with your special host ruled name - instead of rule with 127.0.0.1 it'd be with your static LAN IP. Get it?

If your router supports NAT Loop Back, you can easily do some port forwarding to allow others to access your site with your public IP. A variety of issues could get in the way of you sharing your site with friends outside of your local wifi network. Some can solved with a few simple steps, others may require you to buy a different router that supports NAT Loop Back, or if your ISP insists you use theirs, your only option is to find a different ISP. Sadly, I cannot guarantee sharing with others is possible, due to your router.

If you super want to give it a shot, start by port forwarding port 80, then sharing your public IP with a friend to see if it worked. If something's amiss, try disabling your computer's firewall to see if it's the culprit, or, it could be your ISP. This site will tell you if the outside world can't access a particular port on your computer.

If all goes well, you can use a service like no-ip.com to associate your public IP with a normal-looking url. You can stop giving your friends a hard to remember IP address! Public IP addresses change/refresh every couple of weeks, usually, because they're dynamic. You can call your ISP and ask for one that will never change, but they usually charge a monthly fee. However, the site I just mentioned can automatically look up your current public IP, so long as you have that site's nifty little Dynamic DNS Update Client program running, and always associate it with a url of your choosing - they have both free and paid options.

For good measure, you can also sync your WAMP www folder to a Dropbox account! It won't backup the database, you'll have to do that manually by exporting it, but it could definitely help you keep your files safe. You could even set up WAMP on various computers and use the same php files (however, each computer would be using its own copy of the database).
AGAIN note:
If WAMP has trouble starting (getting past the icon's yellow stage) now or ever, turn off Skype completely and then try turning WAMP on. They share the same default port, and Skype is smart enough to use a different one if its first choice is taken - so you can safely turn Skype back on once WAMP is on.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 01-28-2015 at 01:50 AM.
Reply With Quote