search
HomeBackend DevelopmentPHP TutorialPHP on Windows Azure 入门教授教养系列(3) ――在Windows Azure中部署Wordpress

PHP on Windows Azure 入门教学系列(3) ――在Windows Azure中部署Wordpress

PHP on Windows Azure 入门教学系列(3) ――在Windows Azure中部署Wordpress
2010年07月28日
  部分文章因为博客兼容性问题,会影响阅读体验。如遇此情况,请访问原博客
  本文是PHP on Windows Azure 入门教学系列第三篇文章。请上一篇文章中,我们已经成功的在Windows Azure中运行了PHP应用,并结合了SQL Azure的使用。本文会讲解如何将Wordpress部署至Windows Azure。请读者按顺序阅读本教学系列,因为本文会用到上一篇文章中所创建的项目。
  代码: 1. 点击这里下载Wordpress 程序包。Wordpress默认使用MySQL作为其数据库。而我们下载的Wordpress程序包是由http://wordpress.visitmix.com/网站改写过的。将其解压至PHP_WebCgiRole)(请参考第一篇文章) 项目目录下,如下图:
  
  2. 将上图wp-config-sample.php文件重命名为wp-config.php文件(该文件是Wordpress的配置文件),并打开,填入数据库连接信息(请参考本教程第二篇文章),如下图: 
  
  注意将DB_TYPE 改为sqlsrv,以连接SQL Azure数据库。 3. 打开wp-settings.php,找到147行,注释掉如下语句:
  if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )           die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 4. 打开wp-admin目录下的setup-config.php,找到57行,注释掉如下语句:
  if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') ) wp_die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );        我们说过Wordpress默认以MySQL作为数据库,所以Wordpress会检查PHP是否加在了php_mysql.dll模块。(当然您也可以在php.ini文件中移除掉;extension=php_mysql.dll的注释 以加载mysql 模块。) 5. 打开Web.Config,在  tag内添加如下配置。(错误信息的显示模式为详细,同时添加URL重写的支持)
                                                                                                                   6. 目前为止,我们的程序已经可以部署至Windows Azure之上。但是这里我们先给Wordpress添加使用Windows Azure Storage的功能。 7. 先从这里,下载到 Windows Azure Storage for WordPress 插件。以及这里,下载到Windows Azure SDK for PHP v1.0.1。
  8. 在插件解压后放入wp-content 下plugins目录下。 将SDK解压后,将library下Microsoft文件夹添加入PHP_WebCgiRole项目目录下。如下图:
  
  9. 在php.ini中找到;extension=php_curl.dll,将其分号去除,移除掉注释。因为该插件会用到CURL
  模块。 10. 参考第二篇文章,将项目部署至Windows Azure。通过网址打开所部署的网站,如下图
  
  11. 输入 博客名称 和Email 地址,点击Install Wordpress 来安装博客。并按照后续提示,进行操作。
  12. 在后台控制面板,点击plugins 下的Installed 的标签,在右面我们会看到Windows Azure Storage for Wordpress 插件,点击Activate 以激活它。如下图: 
  
  13. 激活之后,在Settings 下,点击Windows Azure 标签,进入插件的设置界面。我们看到我们需要填写Store Account Name和Primary Access Key,以及选择默认的Storage Container。
  我们先填入Store Account Name和Primary Access Key,点击Save Changes。之后重新刷新页面,我们能看到Default Storage Container该下拉菜单内便列出了可选的Container,选择一个之后 再点击Save Changes。 
  
  Store Account Name和Primary Access Key可以在Windows Azure portal 找到如下图:(小红框内为Store Account Name,大红框内为Primary Access Key)  
  
  14. 之后,当我们在Wordpress内撰写文章时,我们便能插入存储于Windows Azure Storage 内的多媒体文件了,如下图: 
  
  好了,至此,我们已经将Wordpress部署至了Windows Azure 的hosted service中,后台数据库使用了SQL Azure,而多媒体文件的存储使用了Windows Azure Storage。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

How to make PHP applications fasterHow to make PHP applications fasterMay 12, 2025 am 12:12 AM

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

PHP Performance Optimization Checklist: Improve Speed NowPHP Performance Optimization Checklist: Improve Speed NowMay 12, 2025 am 12:07 AM

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

PHP Dependency Injection: Improve Code TestabilityPHP Dependency Injection: Improve Code TestabilityMay 12, 2025 am 12:03 AM

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

PHP Performance Optimization: Database Query OptimizationPHP Performance Optimization: Database Query OptimizationMay 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool