2

I am trying to set up Drush9 for Drupal8. I was able to get my site up and running using the site extensions to install composer and the Drupal installer, but now there is a Drupal update and I want to be able to perform the update through the Azure app service Kudu cmd console ([AppName].scm.azurewebsites.net).

I am following the Drupal update guide and am able to update the Drupal files using composer, but the drush database update (drush updb) fails due to mysql not being registered to the PATH.

screenshot of error

I tried running SETX PATH "D:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe" which is where the mysql.exe is located, but get an access denied.

Has anyone else had success adding an exe to the PATH, or have any other methods.

Thanks

2

You could add a App settings to you web app, like below:

enter image description here

Then, restart your web app, in Kudu console, you could check it.

enter image description here

Also, you can achieve that through an XDT Transform (XML Document Transform).

See this question.

  • I tried adding the App Setting and including the necessary nodes in the web.config but unfortunately I am still getting the same error. – Jake Jan 16 '18 at 3:18
  • When you execute env|find mysql could you see it, if possible, I suggest you could second method. You install 3rd service on Azure web app. – Shui shengbao Jan 16 '18 at 3:20
  • Yes, it shows up with a env|findstr mysql the same way it does in your screenshot above. Not sure I understand what you mean by install 3rd service on Azure web app I added a screenshot to the original post to show the error message I am getting. – Jake Jan 16 '18 at 3:24
  • Hi, it this method does not work for you? Check this link I think it should work for you. This is same with my second method. Hope it helps. – Shui shengbao Jan 16 '18 at 4:04
1

It turns out that because I also had the composer site extension installed, it has its own applicationHost.xdt which was overriding the root level one or causing a conflict.

I ended up creating a D:\home\site\applicationHost.xdt file with the following contents:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <runtime xdt:Transform="InsertIfMissing">
      <environmentVariables xdt:Transform="InsertIfMissing">
        <add name="PATH" value="%PATH%;%HOME%\SiteExtensions\ComposerExtension\Commands;%APPDATA%\Composer\vendor\bin;d:\Program Files\MySQL\MySQL Server 5.1\bin" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
        <add name="PATH" value="%PATH%;%HOME%\SiteExtensions\ComposerExtension\Commands;%APPDATA%\Composer\vendor\bin;d:\Program Files\MySQL\MySQL Server 5.1\bin" xdt:Locator="Match(name)" xdt:Transform="Replace" />
      </environmentVariables>
    </runtime>
  </system.webServer>
</configuration>

This keeps both the environment variable stuff Composer adds as well as allowing me to extend the PATH with the new directory.

Hopefully this helps someone else with a similar issue in the future.

0

You can do this to add the mysql client to the path in PowerShell:

$MysqlClientVersion=(Get-ChildItem -Name "D:\Program Files (x86)\mysql\" | Select-String -Pattern "^[\d.]+$" | % { $_.Line }) $Env:PATH += ";D:\Program Files (x86)\mysql\$MysqlClientVersion\bin"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.