環境變數修改 設定>關於>進階系統設定>環境變數>Path(編輯)
C:\AMP\php-7.4.30
選擇
「php.ini-development」(開發環境)
或
「php.ini-production」(生產環境)
(兩者的設定差別:https://qiita.com/ucan-lab/items/86f1498de569f4a5e16b)
擇一改名為php.ini作為基礎設定
extension=curl ;使用cURL實現Get和Post請求的方法
extension=mbstring ;多字節字符串(用於切中文字)
extension=openssl ;SSL配置
extension=php_psr.dll
extension=php_phalcon.dll
date.timezone = Asia/Taipei
zend_extension = "C:/AMP/php-7.4.30/ext/php_xdebug.dll"
xdebug.mode = debug
xdebug.start_with_request = yes
.ini設定參考(https://ithelp.ithome.com.tw/articles/10284851?sc=pt)
設定完後用 php -m 可確認功能是否開啟及是否有缺.dll檔
(.dll檔放在php根目錄的ext中)
修改路徑(line37)
Define SRVROOT "c:\AMP\Apache24" #資料夾位置
設定dir_module(line285)
DirectoryIndex index.html index.php #設定.php可被讀取
新增php類型(line423)
AddType application/x-httpd-php .php
新增php路徑(最後)
PHPIniDir "C:\AMP\php-7.4.30\php.ini" # php.ini位置
LoadModule php7_module "C:\AMP\php-7.4.30\php7apache2_4.dll"
4-1.LoadModule rewrite_module modules/mod_rewrite.so (line423)
4-2.修改Directory(line234)
<Directory />
Options FollowSymLinks # 不顯示出目錄
AllowOverride All # 讓.htaccess可被修改(安全性問題)
Require all denied # 全部來訪的都通過
</Directory>
4-3.修改Directory路徑為專案路徑(line253)
DocumentRoot "${SRVROOT}/htdocs/專案資料夾"
<Directory "${SRVROOT}/htdocs/專案資料夾">
Options FollowSymLinks # 不顯示出目錄
AllowOverride All # 讓.htaccess可被修改(安全性問題)
Require all denied # 全部來訪的都通過
</Directory>
4-4.找到所有的“AllowOverride None”行將其更改為“AllowOverride All”
用管理員開cmd 並cd到Apache目錄中的bin(C:\AMP\Apache24\bin)
輸入安裝指令
httpd -k install
電腦管理>服務>Apache右鍵啟動
Apache設定參考
(https://httpd.apache.org/docs/2.4/mod/core.html#options)
(https://ithelp.ithome.com.tw/articles/10225101)
詳見(https://docs.phalcon.io/4.0/en/webserver-setup)