分享知識 傳遞快樂
1、下載PHP所需要用環境
下面這此地址都是管網下載地址:
nginx:http://nginx.org/
php:https://www.php.net/downloads.php
mariadb:https://downloads.mariadb.org/
2、配置
下載完成後,了爲方便文件管理推薦把要使用的環境放在同一個目錄下。
nginx配置
nginx 默認項目目錄在當前根目錄下的html目錄。nginx主要項目指向目錄、訪問域名或訪問地址、打開 location ~ \.php$ 下的註釋並修改 fastcgi_param 值即可。參考配置:
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
charset UTF-8;
access_log logs/host.access.log main;
location / {
root D:/WnmpServer/workspace;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root D:/WnmpServer/workspace;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
php配置
打開php目錄,找到 php.ini-development 並把重名命爲 php.ini,打開分別修改以下幾種值,如果是註釋的請打開註釋。以下是配置個人使用的配置信息,僅供參考。
此配置是本人的項目目錄,請根據個人使用情況而定
open_basedir = D:/WnmpServer/workspace
extension_dir = "./ext"
enable_dl = On
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1
extension=curl
extension=mbstring
extension=mysqli
extension=pd
mariadb配置
mariadb 沒什麼配置信息,主要是創建數據庫並設置數據庫密碼即可。在這裏就不太多介紹,詳情請參考《MariaDB安裝ZIP軟件包》
3、配置啓動方式
啓動方式有很多種,可以根據個有愛好而寫,而本人喜歡用bat來啓動服務。如有興趣請參考《windowns下如何使用bat命令啓動程序》
———————————
如有不足請留言指正
相互學習,共同進步