WordPress in a nutshell: WT-NMP

Auf Deutsch lesen: WordPress in einer Nussschale

Some of us might want to run WordPress in a sandbox, where the meaning of “sandbox” is, a nearly closed environment or a replaceable medium like an USB stick.

Sandboxes

One solution can be using Instant WordPress and install WordPress on an USB stick. Instant WordPress uses Apache, PHP and MySQL, but there are a few drawbacks. Normally the bundled version of WordPress is very old and you can not change it. The PHP- and MySQL Versions were also fixed and cannot be changed. All in all, Instant WordPress is a pretty package but not very useful with its old software versions which are not replaceable.

Another solution could be a self-made package with Nginx. Nginx became some time ago very popular because of its speed. So I downloaded it and tried to install it, but there were some conflicts with my already installed XAMPP. And by the way, it is not very easy to configure Nginx. There are several tutorials, but most of them are out of date or hard to understand.

As long as there is no other server software (like XAMPP or a standalone Apache server) installed, it is possible to use Nginx in a self-made package. Much more comfortable would be a ready-made package with Nginx, PHP and MySQL.

WT-NMP

I found WT-NMP and I was excited about it. WT-NMP is something between XAMPP and Instant WordPress. It includes a configured Nginx server, PHP and MySQL. You can download an installer or a zip archive, which can be installed in a directory on the hard disk or on a replaceable medium like an USB stick. But WT-NMP can do more: it configures itself wherever you installed it. Even if you move the already installed package, it will reconfigure itself after moving.

WT-NMP includes a lot of tools like HeidiSQL and Adminer for database management, a Regular Expression tester (for PHP (PECR) and JavaScript), XDebug, PHP XCache and PHP OPcache.
It does not includes WordPress, but I see this as advantage, because I can decide which version of WordPress I like to bundle with it. If you use the zip archive, it is possible to create your own packages and you can decide which PHP- or MySQL-version, which WordPress version or other software will be included.

How to …?

You need WT-NMP, WordPress and 5—10 minutes of your time.

Extract the zip archive of WT-NMP in a directory on your hard disk (or an USB stick or wherever you want it). In the example below I will use the hard disk D:/ and the directory WT-NMP. Then you have to configure some things. In the newly created directory you can see some sub-directories. WWW is your document root, and as you might expect, it’s the directory for your web projects. If you open this directory, you will see three other directories: project1, project2, project3 and tools.
The directories starting with project, can be deleted. They are just examples. In the tools directory are some useful tools, you can add your own tools there. If you open the index.php inside the WWW directory, you will find instructions on how to add your own tools.

The next step is to extract WordPress into your document root (the WWW directory). In this example, I extract WordPress in the directory wordpress. You could also create another WordPress installation (e.g. a WPMU installation) by extracting WordPress in a second directory.

At this point, we are ready for a first test run. Navigate to your WT-NMP directory, and start the WT-NMP manager (wt-nmp.exe). If the installation was successful, you will see the number of processes beside of each component. If the server does not start, navigate to WT-NMP/bin/nginx-[version]/logs and open the file error.log. Ok, it’s not very logical because there is another error.log in WT-NMP/logs. In the first one (WT-NMP/bin/nginx-[version]/logs) you will find startup errors. In the other one, you will find errors occurring during operating.

If the server and the components were started successfully, start your browser and open http://localhost. You will see the start page of WT-NMP, listing all your web projects and tools. As we are already here, we can also set the database for WordPress. It’s a matter of taste if you will use Adminer or HeidiSQL. Click on Adminer and add a database for your WordPress installation. Click on the Create new database link in the top, enter a name for the database (e.g. wordpress) and hit Save. Now you would create a new user for your new database. Click on the Privileges link (the one beside the key icon), then on Create user link under the table of users. Enter a name and password, check the All privileges and Grant option checkboxes and hit Save at the bottom of the page. That’s all.

Configure php.ini

Now it’s a good idea to adjust some settings in the php.ini. This step is recommended but optional. There is only one really important setting you have to change, all other settings are good enough for a basic setup.

In the next steps we only need files from the config directory. Please only edit the files in the config directory. Do not edit the files in other folders except the WWW folder. The reason is, the other files are templates when WT-NMP will be installed or moved to another directory. So, if you want to edit the php.ini, use config/php.ini and not php/php.ini as you might expect.

Lets start with the adjustment:

That’s all for PHP.

Your own server

If you don’t want to use http://localhost/wordpress/ as domain name, you have to setup your own server in the nginx.conf. Open the file, and just copy the already existing default server. Paste it after the default server and change this:

That’s all for Nginx. This is a very basic server setup but enough for the beginning. If you use Nginx intensively, please read some tutorials on how to setup a Nginx server for WordPress. You can find some good tips in the Nginx documentation or in the WordPress codex.

Mysql

I don’t have to adjust any settings in the mysql.ini. But it could be useful to raise the timeouts (wait_timeout and connect_timeout) if WT-NMP is installed on a slow USB stick.

Setup WordPress

And finally do the famous five-minute install of WordPress. Edit/create your wp-config.php or just open your new WordPress blog in your browser and let WordPress do the job.

Bonus round

If you wish to install other PHP versions (maybe you need PHP 5.2 because it’s the minimum requirement of WordPress), it is as easy as all the steps before. Just download the zip-archive of the PHP version you need (maybe visit the PHP museum). You need the NTS (non thread safe) version because Nginx uses the CGI mode of PHP. After downloading the zip archive, extract it into the bin directory of your WT-NMP installation. WT-NMP will list the new PHP version in the WT-NMP manager.

If you want to use XDebug, you also need a suitable version of the XDebug library. Just copy the library into your new PHP folder.

Conclusion

In my opinion, WT-NMP is the best package to build sandboxes with or without WordPress. It is easy to install, to maintain and to configure. It’s even easy to move a sandbox from one place to another (e.g. hard disk to USB stick).

The ability to use more than one PHP version with WT-NMP makes development a bit easier. And last but not least, Nginx is a lightweight, scalable server with high performance. We will see more Nginx servers in the near future, so it’s always good to know how to configure WordPress for another server than Apache.

Author:

I work with WordPress since... uhmmm, I think it was version 1.2 or the one before, I don't remember. It's my hobby and from time to time I spend a bit of my spare time to solve problems related to WordPress.
Sometimes I write a small plugin or a post in my blog. Sometimes I help other users on different plattforms.
So I'm not a dedicated WordPress expert, but I know what I do and I can solve most of the problems.

Find Ralf on yoda.neun12.de⁠, ⁠, ⁠, ⁠, ⁠, and .

10 Comments

  1. Daigoro – 25.01.2014 20:29

    Thanks for this tutorial. I’ve had issues with installing WT-NMP but deleting old reg keys of MYSQL seemed to clear up my issues. I’m getting stuck on the installation of WordPress.

    install.php gives me the following error:

    “Error: PHP is not running

    WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.”

    Any ideas?

    Reply

  2. Ralf25.01.2014 20:52

    Don’t know what you have installed before or what steps you made to install wt-nmp.

    After unpacking wt-nmp and starting the wt-nmp manager, you should be able to call http://localhost and see the wt-nmp page. If you can only see the message that nginx it’s working, you have to check your configuration.

    Maybe you have installed PHP before and there are some path variables left pointing to wrong directories.

    Reply

  3. Daigoro – 25.01.2014 21:46

    Ralf, thanks for your quick response. I had WAMP installed before. I had uninstalled it but MYSQL didn’t remove all traces.

    WT-NMP manager shows 2 running (Nginx), 2 running (Mysql), and 2 running (Php-Cgi). I can call localhost. I’ve added a db and user in adminer, and configured my php.ini file.

    I’m new to Nginx. Configurations for Nginx/Wordpress are not well documented. Could you point me in the right direction?

    I believe the wp-config.php file requires a db table prefix since I also see in the list of errors: ‘Your wp-config.php file has an empty database table prefix, which is not supported’. Strangely, the file already contains the default $table_prefix = ‘wp_’ prefix.

    Danke fuer deine Hilfe!

    Reply

  4. Daigoro – 25.01.2014 21:50

    Sorry, it should say 1 running (Mysql)

    Reply

  5. Daigoro – 26.01.2014 01:14

    Sorry das ich’s im falschen forum gepostet hab.

    In running install.php, I was trying to open the file from File>Open in my browser. Instead, I should have typed the following in the address bar:

    //localhost/wordpress/wp-admin/install.php

    I will now go kick myself

    Reply

  6. faruk12.04.2014 22:34

    Your PHP installation appears to be missing the MySQL extension which is required by WordPress

    Reply

    • Ralf12.04.2014 23:08

      On my sytem (win7 64bit) I have to activate the php_myslq extension (not the php_mysqld extension). And also check the extension_dir setting in php.ini

      Reply

  7. Daigoro – 12.04.2014 23:25

    Thanks for your posts, everyone. I found that my problem was related to a previous installation of PHP. I started from scratch and it worked fine.

    Reply

  8. farukest23.04.2014 01:16

    WT-NMP – PHP-CGI randomly stops running with no error log in windows server 2012. I increased memory-limit in php.ini and I disabled all unnecessary/unstable php extensions, especially xcache, xdebug and opcache , still it is stoping randomly. Any idea ?

    Reply

    • Ralf23.04.2014 15:01

      No, sorry. No idea. Maybe ask the developer? I’m not the developer, I just wrote this short tutorial.

      Reply

Leave a Reply

Your email address will not be published.