There are lots of WYSIWYG applications that let you create a static HTML page and then preview what it'll look like before you actually upload the new pages to your web host. However, if you have a PHP-based website like a WordPress blog, things aren't quite that simple. You need a web server that can handle PHP and MySQL at the very least.
Here at MUO, we've covered a number of ways to install your own local web server like Dave's review of Linux web server software, as well as his review of XAMPP for Windows. These are great if you intend on using the same computer for all of your development work, but if you travel a lot, wouldn't it be nice to have a portal PHP web server installed on your thumb drive or portable hard drive where you can test changes anywhere, even if there's no Internet access? One of the easiest portable solutions for this is Server2Go.
Bring A Working Web Server Anywhere
Compared to the configuration work it takes to set up a working web server, the ease with which you can install and run Server2Go on a portable drive is unbelievable. This is a perfect solution for me, because I want to make some design changes to my blog template without the risk of taking down my entire site. So, in order to accomplish this feat, I decided to test drive Server2Go.
When you download Server2Go and extract the files, you'll see that the directories are set up like a regular web server with "htdocs" being the public directory where your web pages will go. No installation required.
All you have to do is copy those files and directories to your portable drive. Now, if your only goal is to test your website that's written in either straight HTML or PHP, you're done. Just copy your site to htdocs and you can view it by launching the web server (running Server2Go.exe) and then going to http://127.0.0.1:4001/ � the default localhost IP configured in pms_config.ini.
This is pretty slick because you will have a fresh web server to test any website that you want at any time and anywhere. But what if you want to load up a complete PHP site with a back end SQL database?
Server2Go was originally made to run off of a read-only CD, so the default setup will not save MySQL database changes. If you want to configure the server to keep all of your settings, you need to edit pms_config.ini so that LocalMirror=0, OverwriteLocalMirror=0, and DeleteDatabaseFiles=0.
Do this edit before you move on or you'll lose all of your configurations. When you're done, open up phpMyAdmin by going to http://127.0.0.1:4001/phpmyadmin/ and log in as root without any password.
Now, set up your database. This needs to be the database name that you use for your regular website. In the case of a WordPress blog, you'll make it whatever you configured in wp-config.php on your live blog.
Also create a new user with the same user id that you use on your live WordPress blog. You do this in phpMyAdmin by clicking on the SQL tab and typing:
"CREATE USER 'my_id'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'my_id'@'localhost'
WITH GRANT OPTION;
CREATE USER 'my_id'@'%' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'my_id'@'%'
WITH GRANT OPTION;
Now that your database is ready to go, move a fresh copy of WordPress to your new portable web server by copying all of the WordPress files to the htdocs directory.
Remember to edit wp-config-sample.php with the database and user information, and rename the file to wp-config.php. Run "http://127.0.0.1:4001/wp-admin/install.php" and you should see the following screen.
You now have a working local installation of WordPress! The next step is to just export your database and import it into your local WordPress installation. We've covered lots of backup procedures at MUO, but one of my favorites was Dean's on the database backup plugin. I won't go into the details here, but I highly recommend that plugin to transfer over your entire database.
Keep in mind that even though the database backup will move over all posts and comments, the theme and formatting will not carry over. To do this, you need to copy your entire wp-content directory from your online blog to the fresh install of your local one. Enable the required plug-ins and configure the theme to match your online setup. Once you're done, you have an exact local replica of your entire online website or blog.
Here's a local copy of my own blog running on Server2Go.
Now I can tweak the template and other aspects of my blog � including testing new plug-ins and widgets � before they ever go live on the actual online website. After taking my website down a few times just by playing around with a new widget, this feels a whole lot safer.
Give Server2Go a shot on your own portable thumb drive or hard drive and let us know how it goes. What other ideas do you have for making use of such a portable and fast to set up web server? Share your thoughts in the comments section below.
Image Credit : El Frijole
Do you like MakeUseOf articles? Don't forget to share our articles with others! It's really important to us.
More articles about: DIY, local server, portable app, web server, webmaster tools
--
Source: http://www.makeuseof.com/tag/portable-test-web-server-server2go/
~
Manage subscription | Powered by rssforward.com
No comments:
Post a Comment