Jump to content
xisto Community
Sign in to follow this  
Little Asterisk

How To Test Wordpress Locally Turn your PC into a server

Recommended Posts

When you're programming for Wordpress (coding a Wordpress theme), the tiny disadvantages of PHP can be seen in their full form.

 

Why?

Because, to code for Wordpress, you need a server.

 

Why?

Because PHP is a server-side programming language. That means that it's not possible to try running a PHP script on your own PC without any additional programs.

 

And that's a problem, because...?

You either have to use a free online hosting service (there are many out there) or buy one (again, there are many out there). However, experience shows that it's much easier to just test files locally - because there's no connection or testing problems, and everything goes much easier.

 

How to "fix" that?

XAMPP is a great solution (for Windows, there is also MAMPP for Mac and Linux). I recommend choosing the "Basic" package since you won't need more for installing Wordpress.

 

After downloading the program (EXE), run the file and install XAMPP. They recommend installing directly in the C:\ path, but I haven't seen any differences with another (C:\Program Files\...) choice (however, that doesn't mean that the same will be OK for you!). Wait until the application installs, and then run it by double-clicking on "xampp-control" in your installation folder.

 

You should now click on the "start" button next to "Apache" and "MySQL". If the PC asks you something about safety of XAMPP and blocking the application, choose "unblock" or something similar. The application itself should now look like this (image from an 4-year old interview):

 

Posted Image

 

Go to LOCALHOST and, if everything is correct, your screen should have a nice, big logo of XAMP in the center of your browser (if not, something went wrong - check again if you did everything correct).

 

Now, the way I installed Wordpress on XAMPP follows:

Firstly, navigate to LOCALHOST/phpmyadmin/ and create a database under the "My SQL localhost" screen (you should notice a "Create new database" label). Under the label, choose a name for your database and click on "Create".

 

Go back home by clicking on the house button in the upper left part of the screen. Next, click on the "Privileges" tab and choose "Add new user".

 

Choose "use text field" from the drop-down menu for your name and password, but "local" for Host (and enter a name of "localhost" in the appropriate text box). Check all privileges, since not much people (if anyone) will be visiting and/or trying to hack your site (even if they do, there's not much they could do with it - no purpose...). Click on "Go" to create the new user.

 

In the "Add privileges on the following database" choose your Wordpress database's name.

 

Now, download the latest version of Wordpress and navigate to your xampp\htdocs folder. Extract the Wordpress folder there, and then configure your wp-config-sample.php file by opening it in any text editor.

 

After doing that, you can delete the old "wp-config-sample.php" file and go to LOCALHOST/wordpress/wp-admin/install.php. Click on install.

 

That's it! (Were you expecting more steps? ;)) Simply go to LOCALHOST/wordpress/wp-admin to log in to your Wordpress local installation.

 

(Sorry for lack of images here, I simply didn't have the time... If you don't understand something, just make a post and I'll try to explain)

Share this post


Link to post
Share on other sites

thank you little asterisk, good tutorial. simple and direct way of explanation, and very useful information for beginners. the first steps are the most important steps because they are the basis that every developer stands on. thank you for sharing.

Share this post


Link to post
Share on other sites

Yes, I think that way, too... I only don't like it that I didn't put any pictures up here, it makes it look ugly and maybe uncomprehending at times.However, I might post a similar tutorial on my website once I transfer to Wordpress, only a bit more descriptive and containing more images.P.S. I noticed you have nice tutorials on your site, I started learning some Wordpress functions recently and I really understood "the loop" finally when I read it on Me interest.

Edited by Little Asterisk (see edit history)

Share this post


Link to post
Share on other sites

P.S. I noticed you have nice tutorials on your site, I started learning some Wordpress functions recently and I really understood "the loop" finally when I read it on Me interest.

REALLY, now you make me smile. it is so beautiful to feel that your hard working paying back for you, in fact the most thing i wait after posting an article is the comments, sometimes i even want to show the spam ;)

glade you find it useful, and feel free to ask me anything you want.

Share this post


Link to post
Share on other sites

I'm using WAMP but I think it's the same. Anyway I installed Wordpress on localhost to test it publish post and after I make 10 or 15 posts make everything work and so I will upload all the files and Mysql database to Xisto host and start the real website. This Wamp(or Xamp or any other) is a really cool application .

Share this post


Link to post
Share on other sites

XAMPP is the best local server that i've ever used, it is even better than IIS that is supported by microsoft and should be compatible with your operating system. XAMPP is open source, easy to learn, got a lot of features and free.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.