DevOps Monkey Goodness

How To Install RoundCube With hMailServer, Windows 2008, IIS7 and MSSQL 2012

This article describes how to install RoundCube on Windows 2008, IIS7 and SQL Server (MSSQL) 2012 with hMailServer.  I couldn’t really find much out there regarding this setup so here are the steps:

              Install PHP for IIS

  1. Install PHP using the web platform which will automatically configure IIS, a reboot may be required.
    http://www.microsoft.com/web/gallery/install.aspx?appid=PHP53
     
  2. This installs PHP 5.3 but for the PHP SQL Server 2012 drivers you’ll need 5.3.6 upwards so I updated to the latest version which at the moment is 5.4.4:
    – Download the latest version http://windows.php.net/download
    – Extract to C:\Program Files (x86)\PHP\v5.4.4
     
  3. Update IIS to use PHP 5.4.4
    – In IIS Manager select your site, and in the IIS section select “PHP Manager”

    – Next select “register new PHP version”, on the next screen navigate to C:\Program Files (x86)\PHP\v5.4.4\php-cgi.exe
    – Next select “change PHP version”, on the next screen select v5.4.4
     

  4. Download RoundCube and extract to your target IIS folder.
    http://www.roundcube.net/download

  5. Give write permissions to the IIS user on folders “temp” and “logs”

    Enable SQL Server in PHP

  6. Download the PHP 3.0 Drivers for SQL Server (this includes support for 2012)
    – http://www.microsoft.com/en-us/download/details.aspx?id=20098 (select SQLSRV30.exe)
    – Run SQLSRV30.exe and extract files to C:\Program Files (x86)\PHP\v5.4.4\ext
     
  7. To enable SQL Server edit the php.ini file located in C:\Program Files (x86)\PHP\v5.4.4\php.ini
  8. Search for “extension=”, you should see the commented out section, add the following entry:
    extension=php_sqlsrv_54_ts.dll

    Check Your PHP Configuration (optional step)

  9. On the root of your RoundCube installation create a new info.php file with the following contents:
    <?php
    // Show all information, defaults to INFO_ALL
    phpinfo();// Show just the module information.
    // phpinfo(8) yields identical results.
    phpinfo(INFO_MODULES);
    ?> 
     
  10. Navigate to the info.php file and check the stream for “SQLSRV”

     
  11. Create SQL Server Database 
  12. You’ll need to manually create a new database, I called mine RoundCube
  13. Next run the provided script against the new db to create the schema, the MSSql script can be found here:
    C:\inetpub\escortvision.com\roundcubemail-0.7.2\SQL\mssql.initial.sql
  14. Create a new sql server user and grant access to the RoundCube database

    Configure RoundCube 

  15. Navigate to your website where RoundCube is located and run http://www.yourwebsite/installer
  16. On screen 1 click next to get to the config screen
    – Select MySQL (don’t worry we’ll change this afterwards), I found that SQL server was not displayed in the list
    – Update the application name, SMTP server
     
  17. Edit the \config\db.inc.php (located in RoundCube)
    – Find the variable $rcmail_config[‘db_dsnw’] = 
    – Update to $rcmail_config[‘db_dsnw’] = ‘sqlsrv://user:password@localhost/RoundCube’;
     
  18. Progress to the check config screen and makesure the DB and write permissions are working

 

Remember to remove the info.php file and the installer directory!

Other useful things that you might like to do in RoundCube 

– Cannot see the ‘Drafts’, ‘Sent’, ‘Junk’ and ‘Trash’ folder

By default these aren’t displayed/created, in config\main.inc.php edit the following:

$rcmail_config[‘create_default_folders’] = true;

 

No Comments Yet

Leave a Reply