Configure NTP on Windows Time Service on Windows Server running Active Directory

Sometimes ago I needed to change NTP setting on a Windows Server which is running active directory (AD) service. Not sure why the usual way to set the NTP on Windows 7 or non-AD servers via GUI is not an option. It simply doesn’t have a GUI for you! Anyway after some Google here is the command I used. Assume the NTP server is

w32tm /config /update /manualpeerlist:,0x9 /syncfromflags:MANUAL /reliable:YES

Then force resync from the NTP source so that the source can be displayed correctly in the next command.

w32tm /resync

Finally double check if the NTP source is configured correctly

w32tm /query /source

The 0x9 flag is important as I can’t make it work without that. I still not sure what the flag does but according to the article Windows Time Service Tools and Settings this mark the server as Always time server and Automatic reliable time server.


Prevent php-cgi.exe the FastCGI Process Exited Unexpectedly on Windows Servers running MS SQL and IIS

Microsoft only loves Microsoft products and always hates the others. Recently I am working on a website using CakePHP. We are using the IIS, PHP, MS SQL configuration and well, things are just getting ugly when PHP access MS SQL database via PDO.


  • Windows Server 2012 R2
  • IIS 8.5
  • PHP 5.4 installed via Microsoft Web Platform Installer
  • Microsoft SQL Server 2012
  • CakePHP 2.4 using PDO to connect to MS SQL


php-cgi.exe crashed for unknown reason which I have completely no idea what was happening.

php-cgi.exe exited unexpectedly

My Solution

After searching on the web, here is what I found:

  1. If php-cgi.exe crashed randomly (and actually alternatively), it is possible that you have turned on persistent connection. According to this post, accessing MS SQL using PDO doesn’t like persistent connection. So just disabled the default on persistent connection in your CakePHP database configuration file.
        public $default = array(
            'datasource' => 'Database/Sqlserver',
            // Persistent connection should not be turned on for MS SQL as it will cause FastCGI to crash
            'persistent' => false,
            'host' => 'localhost',
            'login' => '',
            'password' => '',
            'database' => 'mydb',
            'prefix' => '',
            //'encoding' => 'utf8',
  2. If php-cgi.exe crashed at a particular page, it is easier to trace what’s wrong but still you may not able to find a workaround. In my case, I tried to run stored procedures and php-cgi.exe just crashed by that time! For my case, I just have to use SET NOCOUNT ON to workaround the crash.
    CREATE PROCEDURE [dbo].[sp_my_proc]
        -- ...
        -- Your code
        -- ...