Support » Plugin: WP Db Abstraction » Fresh WP 3.5 install not compatible

  • Following issues were found:

    1) The plugin custom wp_config creation doesn’t fill db name, db user, db password after running as part of standard installation.

    2) Db tables are created, but admin user INSERT query is broken:
    The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.]
    INSERT INTO wp_users (user_pass,user_email,user_url,user_nicename,display_name,user_registered,user_login) VALUES ( N’$P$BAmfj0IhgDY1F1dBbnLUaYjN9pGKQg/’, N'[email was here]’, N”, N’admin’, N’admin’, N’2012-08-15 12:16:58′, N’admin’)

    3) During WP setup (?step=2) you get tons of PHP warnings like this:
    PHP Warning: mysql_free_result(): supplied resource is not a valid MySQL result resource in C:\Trabajo\wpsqlserver\wp-includes\wp-db.php on line 1122

    I still haven’t tried installing with MySQL and then trying to upgrade. But right now with latest version this plugin is NOT COMPATIBLE.

Viewing 4 replies - 1 through 4 (of 4 total)
  • i just installed the plugin with sql server and this is what i got
    Point 1)
    Yes it does not fill the data but you can change that by hand
    Point 2)
    At first i got the same error but i change the Loggin language to English and everything worked

    Point 3
    Fixing point 2 got me none of those errors

    For those still having issues with this plugin:

    This plugin does work with wordpress 3.5 and sql server 2005 (not tested on 2008 or 2012 yet, but will be trying an install on 2012 soon) with some slight tweaks to the plugin, but it was quite a nightmare finding the information in one place. Many thanks and credits go to the people of this forum for finding these fixes of which I take no credit for myself. However, there was no complete guide as to which fixes are required to get this to work, so I compiled the following information which I hope is useful for people wanting to install brand new wordpress sites using mssql and iis7.5.

    This post assumes you have already installed the php_sqlsrv_54_nts.dll extension on your php fast-cgi module and set display_errors to off. Also to prevent warnings regarding unexpected mysql query formats from being sent to the browser you need to append ~E_WARNING to the error_reporting value in your php.ini file.

    Before the installation is started the following files in the plugin must be amended:

    In translations.php:

    Make sure extra parenthesis has been removed from $pattern = '/LIMIT\s*(\d+)((\s*,?\s*)(\d+)*)(;{0,1})$/is';
    The resulting line will be: $pattern = '/LIMIT\s*(\d+)((\s*,?\s*)(\d+)*);{0,1}$/is';

    In mu_plugins\wp-db-abstraction\drivers\sqlsrv.php the following line needs to be added to the end of function db_connect():

    @sqlsrv_query($this->dbh,'SET DATEFORMAT ymd');

    This will correctly allow for datetime to be interpreted by wordpress due to the way in which mssql formats datetime. The format of course can be changed within wordpress itself later to correspond to the preferred date format.

    Finally, make sure url rewrite 2.0 is installed on the iis7.5 server and the following web.config file is in the root of the wordpress installation:

    <?xml version="1.0" encoding="UTF-8"?>
            <rule name="Main Rule" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <action type="Rewrite" url="index.php/{R:0}" />
            <add value="index.php"/>
    <httpErrors errorMode="Detailed" />

    Once these small modifications have been completed the installation can then be started. Absolutely no modifications to the core code of wordpress are required for this to work.

    The only problems I’ve found after installing are:

    – using permalinks will break the site
    – scheduled posts don’t seem to run.
    – posts will not save if they contain backslashes.
    – when creating a new post, “post immediately” is not displayed because wordpress will not find a post with an unassigned date (0000-00-00 00:00:00). ms sql does not allow this in datetime fields. Instead the date and time of when you clicked “add new” will be displayed which is taken from the autodraft I believe. Nothing to worry about here but thought it was worth noting.

    These are minor problems that do not affect the main functionality of the site it seems. Hopefully these small issues will be addressed.
    Otherwise everything else is perfect.

    Well done and many many thanks to the authors of this plugin and the users who found these fixes.

    In addition to the above (as I have edited that post too many times it seems!), there is a great fix to the backslash bug which can be found here:

    Hi Static Deadlock,

    Thank you for sharing your valuable research information.

    I have crafted an ugly solution for the out of bounds conversions error that happens when inserting new posts.

    In the db-abstraction\drivers\sqlsrv.php look for:

    function query( $query, $translate = true ) {
    if ( ! $this->ready )
    return false;

    And append directly after:

    $query = str_replace(“N’0000-00-00 00:00:00′”, “N’1900-01-01 00:00:00′”, $query);

    It’s probably not the ideal solution, but it gets the job done, without having to resort to even uglier corrective database triggers 😉

    All queries will be checked, replacing the incompatible date value!

    Regards, Jan

    btw, using your web.config I got permalinks working properly, so not sure why you claim using permalinks will break the site,
    ooh yeah one last thing, I’m using SQL Server 2012 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fresh WP 3.5 install not compatible’ is closed to new replies.