在自己Windows上安装WordPress 开发/测试环境
参考了以下文章,为了避免网站过期,在此附上原文:
1.基本步骤
文章翻译自 Installing WordPress Locally Under Windows XP 由 剑指天下 测试并校订
近几周,Denis 给大家分享了不少如何创建属于自己的 WordPress 主题,但是我们大部分用户都是在网络上的 BLOG 上来做测试,速度相对来说很慢,而且也不容易修改代码。这里给大家简单的讲一下如何在 Windows XP 系统上安装 WordPress 来做本地测试。
首先,你必须有一个基于Apache、MySQL、PHP的编程调试环境。我们推荐使用 XAMPP LITE,可以从下面的链接下载。
将 XAMPP LITE 安装好以后,打开服务器,将 Apache 和 MySql 两个服务打开。如下图所示。
下载最新版的 WordPress ZIP 文件夹,解压并存放在 C:\xampp\htdocs 目录下。
当你第一次使用 WordPress 的时候由于你并没有创建与 BLOG 相配套的数据库,所以会产生错误。我们所需要做的就是在浏览器上输入:http://localhost/phpmyadmin/。进入数据库管理界面。选择 utf8_unicode_ci 和 utf8_general_ci 作为数据库格式,数据库名可以自定义。
在网页上打开 http://localhost/wordpress/。当你第一次使用 WordPress 的时候由于你并没有创建与 BLOG 相配套的数据库,所以会产生错误,我们所要做的就是点击 create a wp-config.php file 链接,然后根据后面的步骤继续创建数据库。

创建好 CONFIG 文件以后,你可以继续输入 BLOG 的名称和自己的 EMAIL 地址,随后系统会自动为默认的 BLOG 管理员 ADMIN 分配一个初始密码。用户登录以后可以自行修改。
至此,您的 WORDPRESS 个人 BLOG 创建成功了,接下来的就是您自己体验 WORDPRESS 了。
ps:在2003系统上也通用的.
2 解决permanent link问题:
Windows+Apache+MySQL+PHP (WAMP)+Wordpress 架设 (2006-2-10 16:07)
Windows+Apache+MySQL+PHP (WAMP)+Wordpress 架设 (2006-2-10 16:07)
Keyword: apache php xp 安装
在参考了(
reference:http://heijin.bokee.com/2310238.html
http://www.haospoke.com/buildapache/
http://greenisland.csie.nctu.edu.tw/wp/2005/09/03/310/
)之后,简单总结一下我的安装过程遇到的问题和经验,以方便以后的参考。
主要是配置httpd.conf 和php.ini,并记住拷贝php.ini,php5ts.dll和libMySQL.dll三个文件。
软件环境:
Microsoft Windows XP
Apache 2.053 For Win32 (x86) http://www.apache.org/
MySQL 4.1.10 For Win32 (x86) http://www.mysql.com/
PHP 5.1.2 For Win32 http://www.php.net/
MySQL Administration Tool http://dev.mysql.com/get/Downloads/MySQLAdministrationSuite/mysql-administrator-1.1.2-win.msi/from/pick
phpMyAdmin http://www.phpmyadmin.net/
把 apache + php + sql + blog 安装在 d:\website 中
一:安装 Apache并进行配置使其支持 Php
Apache有MSI和ZIP压缩包两种格式。对于网站域名,本地调试使用localhost即可。
PHP 有EXE和ZIP压缩包两种格式,我用的zip包。
– 解压缩到 d:\website\php目录
– 把d:\website\php\php.ini-dist文件,将其重命名为php.ini,并复制到c:\windows目录里
– 将d:\website\php\ 目录中的 php5ts.dll 和 libMySQL.dll两个文件复制到c:\windows\system32 目录中
– 编辑d:\website\apache2\conf\httpd.conf 文件:
– DocumentRoot “D:/website/htdocs”;
– DirectoryIndex index.html index.html.var index.htm index.php 加上 index.htm index.php
– 模块化安装Php
找到 #LoadModule ssl_module modules/mod_ssl.so 这行,在此行后增加一行:
LoadModule php5_module d:/website/php/php5apache2.dll
找到 AddType application/x-gzip .gz .tgz,在此行后增加一行:
AddType application/x-httpd-php .php
– 测试php
<html><head><title>hello</title></head><body><?php echo “hello,php”; ?></body></html>
二:安装并配置 MySQL
MySQL有EXE和ZIP压缩包两种格式,我用的是exe准备在试下zip,如果好用,就不用安装了,直接拷贝就行了。
– 就是當你完成安裝之後,它會問你是不是要進行 MySQL 的設定,當你選要而且選了詳細(detail)設定,Service Instance Configuration這個步驟時,選中間這項來設定預設的為 UTF8以支持多國語言.用utf-8编码的好处就是:当火星人在你blog留言,也不会出现乱码~~~
–配置 php.ini 并测试 MySQL
用文本编辑软件打开 c:\windows\php.ini 文件,然后修改以下内容:
将 extension_dir = “./” 改为 extension_dir = “d:/website/php/ext”
将 ;extension=php_MySQL.dll 行首的’;’去掉;
将 ;extension=php_mbstring.dll 行首的“;”去掉;
将 ;session.save_path=”/tmp”改为session.save_path=”D:/website/php/session_temp”;
–重新启动 Apache 服务测试。
<?php $link=MySQL_connect(’localhost’,’root’,’lili613′); if(!$link) echo “Error !”; else echo “Ok!”; MySQL_close(); ?>
–这一步需要设置防火墙:
Note open the port of firewall, When setting up SQL using MySQL Administrator:
Firewall (Mine:Trend Micro)->Network Security->Personal Firewall->add TCP in/out Port 3306
三、使用MySQL Administration Tool 为wordpress创建一个新的数据库
對資料庫一點都不熟悉,建議多裝一個 MySQL Administration Tool,或是像 phpMyAdmin 之類的東西。
–MySQL 的 Administration Tool 先用 root 連進去->在 Startup Variables->Security 裡面勾選 Use old passwords,然後再把 MySQL 重跑一次
–並開立一個新的 database 叫做 “wordpress”,然後把這個新建的 db 的權限(insert, update, select, alter, delete, create,drop)設定給這個使用者。
方法就是click catalogs->right click schemata plane(Mysql take schemata as database)->creat new schemata->ok
也可以通过命令行实现如七所示。
–创建数据库wordpress 这一步可以使用phpMyAdmin来完成,也可以从命令行完成。
–为了更好地支持中文,在chenwu/wp-includes/wp-db.php文件的第56行增加如下内容: $this->query(“SET NAMES ‘utf8’”);
四、phpMyAdmin 的安装配置(应该不用这步也行,不知道干什么用的)
下载 phpMyAdmin-2.6.1-pl3.zip,解压缩到WEB根目录(即 D:\website\Apache2\htdocs目录)中,重命名文件夹为 phpmyadmin。
编辑phpmyadmin\config.inc.php 文件,找到这两行内容:
$cfg[’Servers’][$i][’user’] = ‘root’;
$cfg[’Servers’][$i][’password’] = ‘123456′;
五、WordPress 的安装就非常简单了,先在MySQL中为wordpress创建一个新的数据库(参照三与七),再改一个文件就够了
从Wordpress官方网站下载压缩包2.0版本,
–打开 wp-config-sample.php 文件,改名为 wp-config.php 文件,编辑如下字段:
define(’DB_NAME’, ‘database_name’); // 数据库名
define(’DB_USER’, ‘MySQL_user’); // MYSQL用户名
define(’DB_PASSWORD’, ‘MySQL_pwd’); // MYSQL用户密码
define(’DB_HOST’, ‘localhost’); // 一般情况下保持 localhost
–最后运行 http://localhost/wp/wp-admin/install.php 根据向导完成安装,要记住密码欧。
六、开启wordpress之Permalink for WAMP+WP2
开始以为是没有这个文件的问题,就在网上搜了一堆.htaccess文件试验,看到了一堆外星文:
然后通过 search wordpress RewriteRule windows 找到别人的.htaccess文件试验
最后发现http://www.sparanoid.com/2005/11/这位仁兄的一句话给我了提示:
进入 wp 后台,开启 permalinks 即可!!
In summary, it is very simple to get the permanent link functionality (for WAMP+WP2):
I. edit httpd.config
1). enable LoadModule rewrite_module modules/mod_rewrite.so
2). find <Directory “D:/website/Apache2/htdocs”> Options Indexes FollowSymLinks, change to AllowOverride All
II. Login your wordpress site and go to the dashboard, configure it in Options/Permalinks [Edit Permalink Structure]
在WordPress中设置PermaLink的方法:
选项(Option)==>永久链接(Parmalink)设置中:wp-admin/options-permalink.php
还需要编辑一下每个目录的Slug(类别简称)属性:管理==>类别==>编辑类别中,将每个目录设置为英文名称
对于WAMP而言,.htaccess 文件是自动产生的,根本就不用管他,还得我白忙乎了一上午。
七、顺便还学习了最基本的MySQL数据库操作命令,注意一定加分号,实际上大部分可以通过MySQL Administrator实现
mysql> SHOW DATABASES;
mysql> CREATE DATABASE abccs;
mysql> DROP DATABASE;
mysql> USE abccs;
mysql> SHOW TABLES;
mysql> CREATE TABLE mytable (name VARCHAR(20), sex CHAR(1),
-> birth DATE, birthaddr VARCHAR(20)); 创建一个数据库表
mysql> SHOW TABLES;
mysql> DESCRIBE mytable; 显示表的结构
mysql> select * from mytable; mysql> insert into mytable
-> values (′abccs′,′f′,′1977-07-07′,′china′); 往表中加入记录
mysql> LOAD DATA LOCAL INFILE “mytable.txt” INTO TABLE pet; 用文本方式将数据装入一个数据库表
八、最后就是用客户端工具发布了!!
API: http://127.0.0.1/wordpress/xmlrpc.php
能看到但不能发布:Post error: TResult.GetString-Item is not a string type
不知道什么原因
九、出错分析
Test apache: http://localhost http://127.0.0.1/
Test mysql: http://127.0.0.1/phpinfo.php
[error] 500 Internal Server Error 出现500错误 –.htaccess problem
[client 127.0.0.1] File does not exist: D:/website/Apache2/htdocs/favicon.ico
[reply]
Find that whenever run localhost, even run ok, still signal error favicon.ico, but did not signal error 500.
So we can figure out that favicon.ico is not a problem
Try to compare httpd.conf, find the problems are existing in line 164 241 275
[alert] [client 127.0.0.1] D:/website/.htaccess: RewriteRule: bad argument line ‘./index.php’
even move the .htaccess to root, still get this error.
move out of the website, then things are ok.
[refer]
我试着在自己的机器上安装论坛
使用apache+php构建
所有安装都已正确(失败了好几次,呵呵),测试成功运行。
我安装的是水晶论坛,所有安装都顺利完成。
并成功打开admin.php对论坛的各项参数进行设置。
当我以为大功告成时,问题来了:
每当我试图打开index.php时,apache都会报错,并自动关闭。
为什么我用浏览器可以打开admin.php,却无法打开index.php呢?
日志中说没有favicon.ico文件,我找过了,没有该文件。
-能不能提供一份favicon.ico文件,我拷进去试试看
-www.linuxsky.net/favicon.ico
-我已经拷贝了favicon.ico文件,问题依然存在!
-favicon.ico 文件应该不是导致整个文件打不开的原因,如果你用firefox 或者 opera 打开本站会看到地址栏中地址前面有一颗小星星,这颗小星星就是那个favicon.ico 文件。
十、手工配置,绿色安装
I.apache and php are already green, i.e., run without installation, but need manual configuration, see their help files respectively.
II.sql also provide non-install zip file, also refer to its doc files.
Help file:
2.3.6. Installing MySQL from a Noinstall Zip Archive
1.Do not need to copy my.ini to C:\windows; just put it under D:\website\mysql.
non-install version has more lib files than the install one?
2.use this cmd can start the service(for both install and non-install version), then use the mysql administrator
D:\website\mysql\bin\mysqld –console
if see mysqld: ready for connections, it is ok
D:\website\mysql\bin\mysqladmin -u root shutdown
2.3.12. Starting MySQL as a Windows Service
Install the server as a service using this command:
bin:\> mysqld –install
======================================
2006-2-10 16:04
[error]在运行里输入ms-dos 命令正常可用,但在dos界面下(即运行run->cmd后出现的界面,或附件->msdos)输入任何命令都不好用,提示
如运行’ipconfig’:’ipconfig’ is not recognized as an internal or external command,operable program or batch file.
但在运行里用’ipconfig’就正常,可是一闪就没了,看不清楚
a) when I tried to run ipconfig from the DOS prompt, I got “ipconfig is not recognized as an internal or external command, operable program or batch file”
b) when I tried to run ipconfig from the Run menu, everything is ok
[answer]
i.e.,在path 里面加上C:\Windows;C:\Windows\System32;就可以了。注意是加上,千万别替代。
[refer]
find answer here:
1.http://www.techwarelabs.com/community/viewtopic.php?start=15&t=3131
well here is a variation on the same issue, what do people think?
a) when I tried to run ipconfig from the DOS prompt, I got “ipconfig is not recognized as an internal or external command, operable program or batch file”
b) when I tried to run ipconfig from the Run menu, I would get an error message telling me that ipconfig is not a recognized and that Windows could look online for the right program or I could select from a list
Well, I fixed a) by going to Computer -> Properties -> Advanced -> Environment variables and replacing the PATH command (that somehow had been repplaced leading a folder for my Treo?) with C:\Windows;C:\Windows\System32, my ipconfig/all at the DOS prompt works, thought it still doesn’t from the RUN menu.
now that a) has been addressed, do people have any thoughts about b)?
2.http://www.fas.harvard.edu/computing/kb/kb0909.html
QUESTION:
When I run ‘ipconfig’ at the command prompt in Windows, I receive the following error message: “‘ipconfig’ is not recognized as an internal or external command, operable program or batch file.” What can be done to fix this?
ANSWER:
Try specifying the full name for the ipconfig file:
c:\windows\system32\ipconfig.exe
If this works, something is probably wrong with the PATH environment variable. To see it, enter this at the command prompt:
echo %PATH%
Its value should be something like:
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
To set its value, enter this:
[hints]
search repair dos xp “is not recognized as an internal or external command,operable program or batch file.” in google
[Reference] Install WordPress for myself
http://alexhuang.org/ powered by WP
http://my.donews.com/liuren/2006/01/27/wordpress%E7%AE%80%E6%98%8E%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/ 刘韧Blog for Virtual host
http://www.qiantu.org/?p=167 WordPress的架设指南 for vitual host
http://www.swoofware.com/index.php?p=2 WIMP (Windows + IIS + MySQL + Perl/PHP/Python)
http://groups.google.com/group/WordPressCN

