0

我写了一个基于 Yii 框架的 web 应用程序,现在倾向于使用 Microsoft Azure 云服务。

我感到完全迷失了,我找不到一个关于这个的教程。

如何配置数据库适配器?可以使用 SQLSRV 驱动程序完成吗?

4

4 回答 4

0

查看http://azurephp.interoperabilitybridges.com/tutorials上的一些教程

这些教程将解释如何为 Windows Azure 设置获取 PHP 的开发环境。

特别是这个应该对你有用http://azurephp.interoperabilitybridges.com/articles/build-and-deploy-a-windows-azure-php-application

于 2012-05-29T19:54:18.823 回答
0

Yii,MVC 框架是基于 PHP 的,所以你真正需要的是使用 Azure PHP SDK 来启动。我的第一个建议是从以下链接下载适用于 Windows Azure 的 PHP SDK:

http://azurephp.interoperabilitybridges.com/articles/setup-the-windows-azure-sdk-for-php

您将使用下面描述的脚手架,因此请正确学习:

http://azurephp.interoperabilitybridges.com/articles/using-scaffolds

在上面的脚手架中有两个示例,您可以下载并自己尝试(示例已经连接到 SQL Azure,因此您可以了解它是如何完成的):

https://github.com/Interop-Bridges/Windows-Azure-Sample-Kit-4-PHP

最后下载 Yii 并将其放入脚手架文件夹的根目录并进行测试。最后,当测试完成时,您可以部署到 Windows Azure。

I hope you may need some help in last step however if you finish using sample application through documentation, you can get Yii in your application easily.

于 2012-05-29T20:13:46.753 回答
0

For anyone else finding this question, Re. The database, Azure supports PDO with the SQL Server native driver.

Download the SQL Server PDO extensions from here: http://sqlsrvphp.codeplex.com/

Extract and place the dll(s) into a folder called php/ext under your role/bin folder and also add a line into a php.ini file in the php folder like this: extension=php_pdo_sqlsrv_53_ts.dll

So you end up with:

  • webrole/bin/php/php.ini
  • webrole/bin/php/ext/php_pdo_sqlsrv_53_ts.dll

Then in your php code, you can use the database like any other PDO objects. The connection string will be like this: $conn = new PDO( "sqlsrv:Server= MyServerName ; Database = MyDatabase ", "UserName", "Password123");

This is all I've done and it works fine since PDO is already included by default in the Azure version of PHP.

于 2013-04-09T09:37:28.633 回答
0

If you happen to get interested here is a tutorial on how to deploy Yii Framework to Jelastic cloud: Web Development with Yii Framework

于 2013-06-06T15:06:20.513 回答