2018年3月18日 星期日

Laravel Composer Windows PhpStorm


OS: Win 10
Server: nginx

Php Version: Php 7.2.3

Composer: Laravel Management Program


Composer 安裝套件先安裝


Laravel 安裝與設定方法

建立專案   如果專案名空白就預設laravel  下面專案名是 wow
composer create-project laravel/laravel wow --prefer-dist

下載Xdebug 要對應php的版本
下載
參考說明

在 php.ini 最下面加入以下設定    注意 如果資料夾名稱有 () 將會導致錯誤
=============================
[Xdebug]
zend_extension=C:/code/nginx/php_xdebug-2.6.0-7.2-vc15-nts-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
=============================
在.../Php/中執行  
php -v

C:\Program Files (x86)\PHP
$ php -v
PHP 7.2.3 (cli) (built: Feb 28 2018 05:48:02) ( NTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
   with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans


另外一種建立專案方法:
使用PhpStorm

1. 先確定 PhpStorm的設定
Files ==>  Settings ==>  Languages & Frameworks ==> PHP
確定CLI interpreter 設定
可點進去確認
裡面也可以設定xdebug






2. 新增專案
File ==> New Project ==> Composer Project  ==> Filter package 找到 laravel/laravel
然後改 Location的名稱後,就可以按下create了




之後可以加入 GIT



啟動Server 方式

直接點選 index.php 滑鼠右鍵,Run index.php

或是在nginx 上面啟動
依照正常的nginx啟動 php方式啟動,但是記得要在設定檔修改路徑成為你要啟動的 Laravel 的public 資料夾 (預設的 index.php)
例如:
root C:\Users\XXXXXX\PhpstormProjects\Laravel01\public;

然後就可以正常啟動囉.......




2018年3月17日 星期六

Nginx + PHP + Windows


=======================
PHP5

OS: Windows 10 Home

download  nginx (windows)
https://nginx.org/en/download.html

download php5  (stable)
https://windows.php.net/download#php-5.6

Key: 如何連結 nginx 與 php5 ?

Php5 :  利用 php-cgi.exe 執行以下命令
php-cgi -b 9000

nginx: 設定檔修改   /conf/nginx.conf

1. 將以下的code 前面的 #  移除,使他們不再是註解
2. 修改  fastcgi_param 參數中的  /scripts   改為 $document_root


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.exe 目錄下執行以下命令  例如C:\code\nginx\nginx-1.12.2
start nginx

如果要重讀取設定檔
nginx -s reload

如果要停止server     
nginx -s stop


參考
http://nginx.org/en/docs/windows.html



=======================
PHP7

download php7  (stable)
https://windows.php.net/download#php-7.2

如上

=======================

可能問題
nginx 可能多重啟動,所以不能確定是跑那一個!?




砍光,重啟才能確定。