搭建wordpress开发环境
安裝php
PHP下載地址:http://windows.php.net/download/
和MySQL一樣,下載包是一個zip壓縮包,只需解壓縮即可。將它解壓縮到 D:\WNMP\php-5.5.6-Win32-VC11-x64目錄下:
配置php
將php.ini-production文件復制并重命名為php.ini,并用Notepad++(沒有安裝此軟件的話就使用記事本)打開php.ini:
| ; extension_dir = “ext” | extension_dir = “ext” |
| ;extension=php_gd2.dll | extension=php_gd2.dll |
| ;extension=php_mbstring.dll | extension=php_mbstring.dll |
| ;extension=php_mysql.dll | extension=php_mysql.dll |
| ;extension=php_mysqli.dll | extension=php_mysqli.dll |
| ;extension=php_pdo_mysql.dll | extension=php_pdo_mysql.dll |
| ;cgi.force_redirect = 1 | cgi.force_redirect = 1 |
| ;cgi.fix_pathinfo=1 | cgi.fix_pathinfo=1 |
| ;cgi.rfc2616_headers = 0 | cgi.rfc2616_headers = 1 |
安裝MySQL
請閱讀我寫的文章《在Windows7_x64下安裝MySQL(zip壓縮包)》
安裝Nginx
Nginx下載地址:http://nginx.org/en/download.html
當前可以選擇下載穩定版本1.4.3,或者選擇最新版本1.5.6,本文選擇下載最新版。與php和mysql一樣,下載包是一個zip壓縮包,將它解壓縮到D:\WNMP\nginx-1.5.6目錄下:
配置Nginx
Nginx的配置文件是在安裝目錄的conf文件夾下的nginx.conf,并用Notepad++(沒有安裝此軟件的話就使用記事本)打開它:
查找并定位到以下配置:
| 1 2 3 4 | location / { ? ? ? ? ? root ? html; ? ? ? ? ? index ?index.html index.htm; ? ? ? } |
修改為:
| 1 2 3 4 | location / { ? ? ? ? ? root ? html; ? ? ? ? ? index ?index.html index.htm index.php; ? ? ? } |
繼續往下查找并定位到以下配置:
| 1 2 3 4 5 6 7 | #location ~ \.php$ { ? ? ? # ? ?root ? ? ? ? ? html; ? ? ? # ? ?fastcgi_pass ? 127.0.0.1:9000; ? ? ? # ? ?fastcgi_index ?index.php; ? ? ? # ? ?fastcgi_param ?SCRIPT_FILENAME ?/scripts$fastcgi_script_name; ? ? ? # ? ?include ? ? ? ?fastcgi_params; ? ? ? #} |
將#號去掉,并改為:
| 1 2 3 4 5 6 7 | location ~ \.php$ { ? ? ? ? ? root ? ? ? ? ? html; ? ? ? ? ? fastcgi_pass ? 127.0.0.1:9000; ? ? ? ? ? fastcgi_index ?index.php; ? ? ? ? ? fastcgi_param ?SCRIPT_FILENAME ?$document_root$fastcgi_script_name; ? ? ? ? ? include ? ? ? ?fastcgi_params; ? ? ? } |
在Nginx的根目錄下
創建php-cgi-start.vbs文件,添加以下內容:
| 1 | createobject("wscript.shell").run "D:\WNMP\php-5.5.6-Win32-VC11-x64\php-cgi.exe -b 127.0.0.1:9000 -c D:\WNMP\php-5.5.6-Win32-VC11-x64\php.ini",0 |
創建nginx-start.vbs文件,添加以下內容:
| 1 | createobject("wscript.shell").run "D:\WNMP\nginx-1.5.6\nginx.exe",0 |
創建service-start.bat文件用于啟動web服務器,添加以下內容:
| 1 2 3 4 5 6 | echo off; php-cgi-start.vbs echo php-cgi started. Nginx-start.vbs echo nginx started. exit; |
創建service-stop.bat文件用于關閉web服務器,添加以下內容:
| 1 2 3 4 5 6 | echo off echo Stopping nginx... taskkill /F /IM nginx.exe > nul echo Stopping PHP FastCGI... taskkill /F /IM php-cgi.exe > nul exit |
以后只需用鼠標雙擊service-start.bat啟動web服務,運行service-stop.bat關閉web服務。
配置完成后Nginx的安裝根目錄如下:
安裝wordpress
將wordpress壓縮包解壓到D:\WNMP\nginx-1.5.6\html\目錄下(這個目錄是我們已配置的nginx默認根目錄),并將文件夾重命名為wp,如下:
連接mysql數據庫創建一個由wordpress專用的數據庫:
C:\Windows\System32>mysql -h localhost -u root -p123456 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.5.25-log MySQL Community Server (GPL)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database wordpress; Query OK, 1 row affected (0.00 sec)mysql> create user wp_admin@localhost identified by '123456'; Query OK, 0 rows affected (0.00 sec)mysql> grant all privileges on wordpress.* to wp_admin; Query OK, 0 rows affected (0.00 sec)在瀏覽器訪問:http://localhost/wp即可訪問wordpress安裝頁面(注意:nginx已啟動)
創建配置文件
現在就開始
提交
進行安裝
接下去就跟普通的網上注冊一樣簡單了。
轉載于:https://www.cnblogs.com/mophee/p/3435964.html
總結
以上是生活随笔為你收集整理的搭建wordpress开发环境的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数学知识巧学JCF(Java Colle
- 下一篇: L_C_4 1