[resolved] Convert Azure Website (shared) to Multisite (9 posts)

  1. rjrapson
    Posted 3 years ago #

    I've created a WordPress site from the Azure Gallery, and successfully converted it to use SQL Azure for the database. The single instance website works fine.

    I'm now trying to convert that site to Multisite, using sub-directories, not sub-domains because I figured it would probably be much easier in an Azure setting, and I'm not having any success. I made the necessary change to the wp_config to allow Multisite, and I can run the Network Setup. I turned on debugging because it wasn't working, and When the setup page loads, I get this error, three times:

    WordPress database error: [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near 'wp_site'.]

    once above the dashboard, and twice after the header "Create a network of WordPress sites", but the page loads.

    When I click on install, I get this error:

    The page cannot be displayed because an internal server error has occurred.

    I've tried it with both 3.4.1 that is installed when the WordPress site is created, and after upgrading to 3.4.2.

    If I re-run network setup, it tells me that a network is already installed and the database error messages increase to 4 after the header. The multisite database tables appear to all be created.

  2. rjrapson
    Posted 3 years ago #

    Seems to be a problem with the SQL Server for php driver, using the pdo_sqlsvr driver works.

  3. rjrapson
    Posted 3 years ago #

    That definitely fixed it.

  4. helixten
    Posted 2 years ago #

    How did you get wordpress to connect to the sql azure? what was in you config.php?

  5. rjrapson
    Posted 2 years ago #

    There were a couple of steps

    first, after you create your database, make sure you can log into it using the manage link. That insures that the firewall rules are correct.

    Next, make sure you link your database to your website and unlink the mysql database that is linked when you create it.

    then, drop the wp-db-abstraction in mu-plugins, making sure to move the db.php from that plugin folder to the wp-content folder.

    Edit the \mu-plugins\wp-db-abstraction\translations\sqlsrv\translations.php file, the regex on line 726 should be changed

    from: $pattern = '/LIMIT\s*(\d+)((\s*,?\s*)(\d+)*)(;{0,1})$/is';
    to: $pattern = '/LIMIT\s*(\d+)((\s*,?\s*)(\d+)*)$/is';

    otherwise, you won't see your posts on the main page.

    Delete any config.php file in your wwwroot folder

    In your browser address bar, type in the following http://yoursite.azurewebsites.net/wp-content/mu-plugins/wp-db-abstraction/setup-config.php

    Enter the following: database name
    user name, in the format user@dbservername
    database host dbservername.database.windows.net
    database type PDO SqlSrv
    table prefix - whatever you want

    click submit. You should get a confirmation page with a Run the Install button. Click that and it should start the WP install.

    A note on the database - when you create it, make sure you create it in the same region as your website (east us, west, europe, whatever.) Otherwise, you could incur data expenses as every call will be cross-region and also, it's much slower. It is possible to move the database if it is created in the wrong region, but it's a pain and there are other issues as well, especially if you setup multisite WP.

  6. helixten
    Posted 2 years ago #

    Hey that is great worked so far. What did you uses for your web.config?

  7. GlobeMan
    Posted 2 years ago #

    Hey, I did exactly what you wrote, but still have the same issue after changing the web.config.
    Anything I have to do differently there? But something else now broke as well, I can't even login. Would be great if someone has a solution.

  8. Have you tried using the WP MU Domain Mapping plugin yet? I am trying to find the correct configuration to support it now

  9. Spencer Cameron
    Posted 2 years ago #

    You guys might be interested in Project Nami. It was built specifically for the SQL Azure platform and can be installed in an Azure Website in just a few minutes. A handful of enterprise level sites have already adopted the platform. Multisite and single site installs work for subdomain and non-subdomain installs and a working web.config is included, as well.

Topic Closed

This topic has been closed to new replies.

About this Topic