Ready-to-Go Apps for UniServer

UniServer, Part 2

[Note: I’ve edited this article to reflect the latest updates to the application plugins.]

UniServer has a list of plugins to give you a head-start on installing applications and other functions.

For version 5.6-nano there are several CMS applications and a Wiki. You can Google these individually for detailed information on their usage.  In this series I’m not going to review any of these apps; we’ll save that for later.
*V56_Drupal  Content Management System
*V56_Joomla  Content Management System
*V56_Moodle  Courseware Management System
*V56_WordPress  Content Management System
*V56_Xoops  Content Management System
*V56_MediaWiki  Wikipedia’s Wiki System

There are also several utility programs set up as plugins. The advantage of all these as plugins is that they are ready-to-run as soon as they are installed. Installation usually consists only of running the plugin’s .exe, which unzips into the UniServer stack. That’s very convenient.

Let’s do one right now; I’m selecting WordPress as an example.

Step one is to download the plugin, which you can do from here at Sourceforge.net.  Let’s go through executing this, so that you get it into the right location. First, the core UniServer for our example is in C:\UniServer.  Second, when you execute the downloaded file, it will offer to extract the files to wherever you put the download, which you typically don’t want to do. This means we need to specify the UniServer directory, C:\UniServer.

After the extraction, you will have “instant” WordPress. To get started, we’ll open a browser and go to http://localhost/wordpress/. Remember that if you changed the MySQL password like you were supposed to, you should see:

Error establishing a database connection

which means that WordPress can’t get to MySQL. Let’s fix that by opening Windows explorer and going to C:\UniServer\www\wordpress. Find wp-config.php and open it with Notepad or your favorite text editor. Several lines down you should find:

/** MySQL database password */
define('DB_PASSWORD', 'root');

Change the password to what it should be and save the file.

Now when you go back to http://localhost/wordpress/, you should be presented with the “UniCenter Test” WordPress blog front page.

Next, let’s get into the administration area for WordPress.   In the lower-right corner under Meta, click on Login to get to the Admin login page. Use “admin” and “root66” to get logged in.

The best part is that all this information is in the Read_me_WordPress.txt file, which you can find in both C:\UniServer\www and www\doc. There’s more information there to help you resolve some common problems. Also, the UniServer Wiki has even more information.

This installation is quick and simple, getting you up almost instantaneously.

Mail Call!

One obstacle that I think most people would like to overcome pertains to outbound email. WordPress (and all the other apps as well) uses email to send out account and operations notifications.  In our local environment, how do we satisfy that need?

Let me give a quick overview of the email send operation, but remember that this is also a simplified explanation; email handling can get really complicated.  The situation is that we want to be able to send email to various addresses.  You have a client (like Outlook Express, Thunderbird, etc.) or other program (like WordPress) that will send the messages.  Sending a message involves a Simple Mail Transport Protocol (SMTP) server that is listening on TCP port 25 for a request (or on another port for secure or authenticated transfers).

There isn’t a server in Windows, nor one included in Uniserver, so we need an outside server for this. One choice is to use your ISP’s SMPT server.  Then you need to format the message, connect to the server and send the message using the SMTP protocol. Lucky for us, PHP has a built-in function, mail(), to perform all these protocol details. It allows you to send emails to an open SMTP server (meaning that the server doesn’t require authorization; it just accepts the message).  Using your ISP’s server will do, but this likely won’t be a portable solution. If you have UniServer installed on a laptop or USB memory and want to use it in a different location, you need that portability.  A good alternative would be to use Gmail, Hotmail, or some other free email service that allows direct connection to the SMTP server.

However, the challenge (I’ll save you some frustrating experimentation and debugging) is that Gmail and Hotmail require authorization before the SMPT server will accept messages, but the PHP mail() function doesn’t provide for it. While there is a replacement mail() function available through PEAR, the UniServer developers decided to use a different and simpler solution. This is msmtp, which is included with the 5-Nano series. They were even nice enough to integrate it into PHP.  When you have  configured this to use your desired email service, applications running under UniServer are able to send messages to (and through) your email.

Configuring msmpt is simple; it’s done by editing the configuration file,  msmpt.ini, located in C:\UniServer\msmtp.  The comments tell what’s necessary, and the UniServer Wiki has even more details (it’s a really useful resource).  I’d also suggest you don’t try to add a section to use Yahoo! mail’s free service, since only the paid version allows for SMPT connection.  Instead, just set up a Gmail or Hotmail  account for your portable connection, or use your ISP’s email if that’s not a concern.

Getting messages from your account is a different story.  It can be done using Post Office Protocol 3 (POP3, or simply POP).  The only problem in using PHP for this is that there aren’t any built-in functions to handle it (but there are some add-ons).  However, since we can now use the regular Gmail, Hotmail or other client program (probably web-based) that you already are familiar with, it’s not something we need to do programatically.

Leave a Reply