Wednesday, 2 May 2012

PHP 5.4.1 LDAPS Fix

After taking a bit of a break from blogging, I decided that it was time that I should do something again.

Anyway, last month I took a stab at upgrading PHP to version 5.4, which contained some nice little features and performance improvements. Almost everything went fine, apart from one little thing which made me roll back to version 5.3.x, which was that no matter what I did, no matter how hard I tried, I couldn’t initiate a secure LDAPS connection over our network. This is used to do some Active Directory bits and pieces and so without using an LDAPS connection there was no hope. Everything looked fine though, it was almost as if it just didn’t want to do it for whatever reason.

Anyway, a few days ago, along came 5.4.1 which even though I have checked, doesn’t mention any changes to the LDAP / OpenSSL extensions. I thought that I would give it a go – and guess what – it worked!

In addition to the above, PHP 5.4 now supports paged LDAP results whereby it contains a fix for missing feature to retrieve more than 1000 items from an LDAP server at any one time without making changes to your Active Directory configuration.

Thursday, 16 February 2012

Fixing MySQL Error 1067 on Windows Server 2008 r2

Let me just start by saying that this has been really annoying me for some time now and obviously taking the server offline to fix this is difficult at the best of times.  Fortunately, this week I've had the time to take a look at this and see if I can sort the issue.

From looking at all of the various 'solutions' out there, it doesn't actually seem that any of them are correct.  Don't get me wrong, I'm sure there is one somewhere but I didn't manage to find it past page two of Google so I thought I would give it a go myself.  Just to save you some time, the following doesn't work despite what a lot of people will have you believe (and if they do, then you have been lucky):
  • Removing the service and reinstalling;
  • Removing and recreating the log files;
  • Repairing the install;
  • Recreating your MySQL instance;
Now the reason that it happened on my server was due to an upgrade from MySQL 5.1.x to 5.5.x a few months ago.  I thought that I had done the usual routine correctly of taking backups, downing the service, uninstalling, reinstalling and then restoring.  Job done I thought.  This has never been a problem on any other server that I've done this and so I wasn't expecting this.  All it meant was that from time to time, the service wouldn't start after a Windows reboot.  Not really a big deal but any down time at all is a big no no.

So, in essence you will actually need to do most of your preparation that you would normally do for an upgrade.  You might as well download the latest version of MySQL while you do this so firstly go and grab that.  Next, do your normal backup of your databases and also your my.ini from wherever you normally keep it.  Stop your MySQL service and then uninstall your MySQL installation.  Go to your ProgramData folder and remove your MySQL folder, and do the same in your Program Files\MySQL folder (remove your server folder just in case you have your tools or workbench installed in there).  Now go to your Users folder and have a look through there and it will normally be hidden in your Default\AppData folder.  Launch regedit and search for 'mysql' and remove any instance of it that is related to your server install.  Restart your server now.

When your server comes back on, run your nice new installer, giving it the same settings that you had before.  Set a new instance up (it can be the same service name if you like) and then it will go off and set your my.ini, your service and your security settings.  Your service should now be running straight away.  Just to check it though, stop the service and start it again.  You should find that it's running without erroring.  If it does error, not to worry, open a command prompt and browse to your bin folder inside your new installation and run the following:
mysqld -remove MySQL
Where MySQL is the name of your service that you specified.  Assuming that you have typed that in correctly it will say that it has removed the MySQL service.  Now run the instance configuration wizard again (inside your bin folder) and go through it again.

Lastly, restore your databases and users / permissions and you should be done.  Sorry that this is a bit lengthy but this worked for me and every other solution that I found didn't sort my problem.  It seems that this error goes way, way back to MySQL 4.x but nobody has worked out a way to fix this properly.  As I mentioned before, other people have posted their solutions which may have worked for them, but that could mean that this is an inconsistent error which is why it hasn't been fixed as of yet.

Tuesday, 10 January 2012

Looking for My Briefcase in Windows? Microsoft SyncToy is Your Solution!

Remember the days where you had multiple devices that could sync from one location on Windows?  Well, when Windows 7 launched I assumed that something like this would exist as a built in feature.  I was wrong.

Instead, Microsoft seems to have gotten into the habit of releasing smaller applications as addons for Windows as part of the PowerToys range; one of these is Microsoft SyncToy.  According to Microsoft, 'SyncToy 2.1 is a free application that synchronizes files and folders between locations. Typical uses include sharing files, such as photos, with other computers and creating backup copies of files and folders'.

Just last week I was in the position where I needed to have a synchronised set of data that existed on two servers (not ideal I know but it couldn't be helped in this case) and there wasn't any built in solution that I could find.  After a bit of searching around I came across SyncToy 2.1 from Microsoft.  And it does exactly what it says on the tin.  There are both 32 and 64 bit versions available here for your download pleasure.

SyncToy has a friendly interface, that gives you the choice from where you want to sync from (left folder) and where you want to sync to (right folder).  There are then three types of sync that you can do:
  • Synchronize: Does a left and right sync which includes deletes and renames;
  • Echo: Updates and new files are copied left to right including deletes and renames;
  • Contribute: Same as echo without deletes;
So far it's all easy stuff, but it's not all rosy and nice though as the application does have one major shortcoming - built in scheduling.  It can be done but it involves you setting up a scheduled task from within Windows using the following syntax: 'C:\Program Files\SyncToy 2.1\SyncToyCmd.exe -R "Your Sync Name Goes Here"' which is fairly straight forward.

So there you have it, the return of Microsoft Briefcase!  I've tested all three syncs and they all work well, as does the scheduled task.  My only criticisms are that this should be part of the OS and also the scheduling should be built in.

On a final note, I've been working on a web paper recently located over at called the Web Feed which takes a look at an in depth range of articles from around the web and also takes a look at the latest in technology news.