分享知识 传递快乐
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命令启动程序》