My local sites run much faster, plus testing products on my local machine is much safer than testing on a "live site" – not to mention much cheaper without the cost of web hosting.
Setting up a local server environment for WordPress isn’t difficult and will save you time in the long run since you won’t have to install and uninstall a fresh copy of WordPress online each time you test or develop something for WordPress.
There are many options for Windows. I’ve previously looked at how to set up a localhost using WAMP. In this tutorial I’ll walk you through how to set up WampServer for local WordPress development which will including , creating a MySQL database, and installing WordPress. I’ve included optional steps for setting up Multisite.
Before I proceed with this tutorial I will like to briefly answer these very important questions ;what is WordPress? what is WampServer? and why you need a local development server. so lets get started.
what is WordPress?
WordPress is a content management system (CMS) which is free and open-source and is based on PHP and MySQL. WordPress needs installed on a web server to function , which either is part of an Internet hosting service or is a network host itself; the first case may be on a service like WordPress.com, [update]. WordPress is reportedly the easiest and most popular blogging system in use on the Web supporting more than 60 million websites.
for example, and the second case is a computer running the software package WordPress.org. An example of the second case is a local computer configured to act as its own web server hosting WordPress for single-user testing or learning purposes. Features of WP include a plugin architecture and a template system. WordPress is currently being used by more than 26.4% of the top 10 million websites as of April 2016.
What is WampServer?
WampServer is a popular Windows web development environment that allows you to create web applications with Apache2, PHP and a MySQL database
WordPress isn’t a stand-alone application and needs server software to run. WampServer provides the necessary server environment so you can install and run WordPress on your local machine rather than on the internet.
Installing WampServer
Head over to the WampServer site and download the latest version of the software if you have WampServer already installed on your device you may want to skip this step. WampServer is an open source project and is free to use.The WampServer site offers two versions of the software – 32 BITS or 64 BITS. Click on the version you prefer.
A warning message will display. Click on “download directly,” and you’ll be taken to the SourceForge website. The download will automatically start in 5 seconds.
The WampServer executable file is small at just 41.5MB, compared to XAMPP, which is 125MB.
You may receive warnings about installing the software on your computer. As you would when installing any software on Windows, use your best judgment, though it’s best to ignore the warnings if you want the installation to continue.
The WampServer setup wizard will guide you through the installation.
The next window will ask you to agree with the software’s terms and conditions. Check “I accept the agreement” and click “Next.”
Next, select where you would like to install the software and click “Next.” The default is c:\wamp, which I’m going to use for this tutorial I will like you to do same.
In the next window, you can choose to create shortcuts so you can quickly and easily access WampServer on your computer. I’m not going to create any for this tutorial.
Once installed, you may be prompted to choose your default browser. In my case, I chose Google Chrome.
You’ll then be prompted again to specify the SMTP server and the email address to be used by PHP. These settings aren’t all that important, so just leave the defaults and click “Next.”
Fill in your details or just leave the defaults.
Installation is now complete! Click “Finish” and the software will launch.
This green icon indicates that you have successfully installed WampServer |
If you click “Finish” and the software doesn’t launch and you run into any errors, like the one below
For Windows 32BIT: Install the Visual C++ 2010 SP1 Redistributable Package x86 : VC10 SP1 vcredist_x86.exe
For Windows 64BIT: Install the Visual C++ 2010 SP1 Redistributable Package x64 : VC10 SP1 vcredist_x64.exe
Depending on your local machine, you may have to install one or both of these files. If WampServer still doesn’t work, trying installing Visual C++ Redistributable for Visual Studio 2012 Update 4.
If you continue to have any issues, check out the WampServer forums.
If any security warnings pop up, such as firewall warnings, be sure to allow access otherwise the software won’t work.
If you click “Finish” and the software does launch, a WampServer icon will appear in the systems tray.
The color of the WampServer icon allows you to quickly determine the status of your servers.
1. If the icon is red, the server isn’t running and is offline. You may need to restart WampServer or check out the WampServer forums for more help.
2. If it is orange, the server is partially running, i.e. Apache may be running and the MySQL service is offline. Click on the WampServer icon and check the service status next to Apache and MySQL to see if they are running. You may need to restart WampServer, and if it still doesn’t work, check out the WampServer forums.
3. If the icon is green, it means the server is running and you should be able to access localhost from your browser.
To test it, go to “http://localhost” in your browser you should see the WampServer default page if every thing went well with your installation.
Setting Up Your MySQL Database
Before we install and run our WordPress installation , we need a database.Click on the WampServer icon in your system tray and then click on phpMyAdmin.
A page will open in your browser
Click on “Databases” near the top-left and you’ll be prompted to create a new database. I’ve called mine “WP”.
When you’ve entered a name, click “Create” and close the window.
Download and Install WordPress
Download the latest version of WordPress from WordPress .org as the time of writing this post the latest version was 4.6.1.In order to get WordPress working with WampServer you need to unzip WordPress to the right folder. Extract WordPress to the C:/wamp/www/ folder.
Next, open your WordPress folder, find the wp-config-sample.php file and rename it wp-config.php. Open the file and scroll down until you see the following lines:
Update your wp-config.php file with your database details.
These lines of code define the login details for your database. Replace “database_name_here” with the name of your database, which in my case is “WP.”
Replace “username_here” with “root” and leave “password_here” blank.
Save the file and close it.
Now we can get on with installing WordPress.
Open your browser and go to http://localhost/wordpress/
You should see the welcome screen for the famous five minute WordPress installation process.
Famous five minute install
Enter your details and click “Install WordPress.”
Your WordPress installation is now complete!
Setting up WordPress Multisite(optional)
Setting up Multisite on a localhost provides a quick and easy way to test/develop themes and plugins away from a live site.Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:
Click on the WampServer icon in your system tray and ensure your Apache and MySQL servers are running.
Login to your localhost site in your browser and under “Tools” you will now have a new option,
Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.
Enter a name for your network and your email address, then click “Install.”
WordPress will prompt you to edit your wp-config.php and .htaccess files.
Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:
Edit your wp-config file to get Multisite up and running.
Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.
Your .htaccess file should look like this:
Edit your .htaccess file to complete your Multisite installation.
Multisite should now be enabled and working on your WordPress site!
Your Multisite network should now be up and running!
In conclusion
WampServer offers a relatively easy way to run a local server environment on your Windows machine, allowing you to test and develop locally rather than online.
Running WordPress locally will save you a lot of time since you won’t have to install and uninstall a fresh copy of WordPress each time you test themes and plugins with your web host.
While WampServer is free and open source software, it’s easy to run into trouble setting it up on Windows. While putting this tutorial together I ran into a bunch of issues trying to get Apache working. XAMPP is relatively easier to setup and I would recommend that as a more reliable alternative.
Overall, setting up a server environment is relatively painless and something I would recommend to any WordPress developer or hacker.
0 comments:
Post a Comment