PHP 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。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

Handling high DPI display in C can be achieved through the following steps: 1) Understand DPI and scaling, use the operating system API to obtain DPI information and adjust the graphics output; 2) Handle cross-platform compatibility, use cross-platform graphics libraries such as SDL or Qt; 3) Perform performance optimization, improve performance through cache, hardware acceleration, and dynamic adjustment of the details level; 4) Solve common problems, such as blurred text and interface elements are too small, and solve by correctly applying DPI scaling.

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.
