【PHP分享】Windows本地開發環境搭建

來源:互聯網
上載者:User

1. Nginx+PHP安裝

  1. 下載 Nginx,安裝到指定目錄,如D:\nginx-1.7.5。

  2. 下載 PHP,安裝到指定目錄,如D:\php。註:window環境下的PHP二進位包括安全執行緒版本和非安全執行緒版本,選擇相應的版本安裝後獨立安裝的擴充包需要和其保持一致。

2. 環境配置

1).Nginx配置:

# nginx.confserver {    listen       80;    server_name  localhost;    access_log  logs/localhost.access.log;    location / {        root   D:/localhost/trunk;        index  index.html index.htm index.php;    }    error_page   500 502 503 504  /50x.html;    location = /50x.html {        root   html;    }    location ~ \.php$ {        root           D:/localhost/trunk;        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;    }}

2).配置本地Host

127.0.0.1 localhost

3.啟動/停用服務指令碼

#start_service.bat@echo offREM 每個進程處理的最大請求數,或設定為 Windows 環境變數set PHP_FCGI_MAX_REQUESTS=1000echo Starting PHP FastCGI...RunHiddenConsole D:/php/php-cgi.exe -b 127.0.0.1:9000 -c D:/php/php.ini echo Starting nginx...RunHiddenConsole D:/nginx-1.7.5/nginx.exe -p D:/nginx-1.7.5
#stop_service.bat@echo offecho Stopping nginx...taskkill /F /IM nginx.exe > nulecho Stopping PHP FastCGI...taskkill /F /IM php-cgi.exe > nulexit

最後,雙擊start_service.bat啟動相應服務。

4.訪問localhost/index.php即可看到首頁

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.