Ruminating with WordPress

Some notes on WordPress.

Specifically notes on adding a second WordPress website on IIS 7.0


This page is about adding one extra, may be two or three extra WordPress sites on a IIS web server. OK but what about several million?
There is multisite.


Web Platform Installer 

Install WordPress using the Platform Installer.

It gets installed here.

C:\Program Files\Microsoft\Web Platform Installer

The installer will check it is the latest version, before going off to the Web to get the latest (hopefully tested) versions of whatever you might what to install. (Scary! - we don't do this in my day job! Whatever happened to a staging environment?)

So, what happened?

So you followed the links and installed WordPress on your IIS server. You will have been congratulated on installing it. But what happened? What did you do?

Well, you let some freeware install some software on your web server - that's what! 

"We" installed...

Microsoft WebMatrix

C:\Program Files (x86)\Microsoft WebMatrix

As well as PHP, MySQL, and Wordpress


Install HeidiSQL - a good friend! Go find it and install!

What's the issue? What's my gripe?

IIS binding doesn't work as I expect. If you have more than one binding (as in and pointing to the same WordPress installation you end up with the original WordPress site, not a "new" one.

In hindsight - it's obvious why - WordPress ignores the IIS binding and just steams ahead with the site defined in the MySQL database, the name of which is in the WordPress folder. No clever dynamic "Oh what site was it that I am processing from the remote client?" See multisite.

My solution

Copy the WordPress folder...

Copy the entire tree - I imaginatively added a 1 to testwp.

Use IIS to add the second website...

Edit wp-config.php in the new, copied folder tree, and change the database that this new WordPress site will use. In my example the new site will use "wordpress552".

define('DB_NAME', 'wordpress552');

Go to HeidiSQL and create a new empty database using...

CREATE DATABASE `wordpress552`;
GRANT ALL PRIVILEGES ON wordpress552.* TO 'wordpressuser55'@'localhost';

Look - evidence!

wordpressuser55 is the MySQL user account WordPress created at installation time. For now I will let this ride.

Go to the new site....

... and it will respond with... 

... and we have a virgin WordPress website! Not the original!

Eating ones own dog food

Having installed my third instance...will I use WordPress?

So you want to see the big images eh? 

What do I get on my Samsung phone..

No image!  

After cursing Chrome, Samsung, Vodafone I found the culprit is somewhere within WordPress; PHP; and the Platform Installer.

Let's follow my reasoning...

Images on the desktop fine, but not showing on the Chrome browser on a mobile phone. Images sent to a browser list a set of alternatives. That's new to me = live and learn!

The HTML looks like this...

<img class="size-medium wp-image-18" src=""
alt="a test" width="300" height="188"
srcset=" 300w, 768w, 1024w, 1152w"
sizes="(max-width: 300px) 100vw, 300px" />
The srcset attribute lists attributes for the browser to select.

By copy and pasting to a browser I soon see that the larger images were no being sent. Server 500 errors. The smaller thumbnails were fine.

What error? Good old Chrome console reveals: "Failed to load resource: the server responded with a status of 500 (URL Rewrite Module Error.)"

I check the rewrite module is installed. Seems to be part of the Platform Installer's magic. No problems.  That's a bit of a wild goose chase.

I go to the WordPress Admin and attempt to edit the image.

Oh! The image is not displayed! That exonerates Chrome, Samsung, Vodaphone.

The image is present in the folder (C:\testwp_anotherurl\wp-content\uploads\2016\02\2016/02/test.jpg)

I add the security group "Everyone" to the image, giving god like permissions.

It works!

I remove "Everyone" to the image...

It still works! Must be a cache somewhere... I restart IIS, kill the PHP process, and use an incognito browser...

Something has fixed it! What fixed it?... something added "<machinename>users" with "List folder / read data" after I had removed "Everyone".

I move on - not liking magic fixes that are not re-creatable.

Big Clues

Upload user pictures fails on (IIS) installs with c:\windows\temp as upload_tmp_dir.

I look at the PHP manager on the server IIS management screen.

I make 2 edits to php.ini...

upload_tmp_dir = C:\inetpub\temp\uploads
; was...
;upload_tmp_dir = C:\windows\temp

and at the end of the file I comment out the duplicate entry... 

error_log = "C:\Windows\temp\PHP70x64_errors.log"

I create the folder C:\inetpub\temp\uploads.

I upload new images using WordPress. All works well!