dqan70724 2017-02-07 06:12
浏览 52

如何在microsoft AZURE服务器(PaaS)中安装msodbcsql

Okay, so basically I have now deployed an Web App in Azure, but I cannot seem to make it to connect to a separate SQL SERVER. I have provided all the desired App settings for the connection but it seems no good.

Now I search for possible causes:

  1. PHP ext dlls are missing for msodbcsql which are

php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll

I already added this dll's and referenced them accordingly base on this document Configure via ini settings

  1. Now the uncertainty that msodbcsql is installed in Azure.

Now this is what I am having problem with.

So in my case in number 2 I tried copying the installer to Azure D:/home/

and run this in the command line

msiexec /quiet /passive /qn /i msodbcsql.msi IACCEPTMSODBCSQLLICENSETERMS=YES ADDLOCAL=ALL

which is suppose to install the .msi installer but i always get an

ACCESS IS DENIED

error.

is there another way around??

  • 写回答

1条回答 默认 最新

  • doudizhi947129 2017-02-07 09:12
    关注

    Basically Azure has already set up extension php_sqlsrv.dll & php_pdo_sqlsrv.dll for us, so we ourselves do not need to install any driver to connect SQL SERVER.

    You could check the php.ini file which can be found at D:\local\Config\PHP-<version>\php.ini with Kudu console to confirm that.

    enter image description here

    Also, you can check that with phpinfo() function in your application.

    enter image description here enter image description here

    And I have tested it with the following lines of code and got it worked.

    <?php
    $serverName = "serverName\sqlexpress"; //serverName\instanceName
    $connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);
    
    if( $conn ) {
         echo "Connection established.<br />";
    }else{
         echo "Connection could not be established.<br />";
         die( print_r( sqlsrv_errors(), true));
    }
    ?>
    

    enter image description here

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致
  • ¥15 禅道二次开发编辑版本,上传不了发行包