在python的virtual environment工作時,vscode的pylint會說找不到套件,
因此我們要vscode的「Folder Settings」去指定 venv 下的pylint路徑,而不是global的pylint,
順便把python路徑也一起修改:
(Windows)
"python.pythonPath": "${workspaceFolder}/Scripts/python.exe"
"python.linting.pylintPath": "${workspaceFolder}/Scripts/pylint.exe"
(Linux)
"python.pythonPath": "${workspaceFolder}/bin/python"
"python.linting.pylintPath": "${workspaceFolder}/bin/pylint"
因外由於 pylint 對 python 3.7的支援性不太好(沒事就在噴runtime error錯誤),
我們可以安裝 preview version的pylint來解決:
pip install pylint astroid --pre -U
或改用flake8也行:
pip install flake8
用flake8記得修改vscode設定:
"python.linting.flake8Enabled": true
"python.linting.pylintEnabled": false
"files.trimTrailingWhitespace": true
2018-07-17
2018-07-16
Python CGI on Apache & FASTCGI on NginX
在Apache2上修改http.conf,讓Apache能以CGI執行python:
==============================================
...
LoadModule cgid_module modules/mod_cgid.so
...
<Directory "/opt/bitnami/apache2/htdocs">
...
Options FollowSymLinks MultiViews +ExecCGI
AddHandler cgi-script .py
...
</Directory>
==========================================================
若是使用bitnami LAMP stack,需再同時修改 conf/bitnami/bitnami.conf,修改設定同上
==========================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==========================================================
在NginX上修改nginx.conf,加入以下片段,以fast-cgi執行python:
==========================================================
location ~ \.py$ {
root html;
fastcgi_read_timeout 300;
#fastcgi_pass 127.0.0.1:10240;
fastcgi_pass unix:/tmp/python-fcgi.sock; #使用.sock監聽
fastcgi_index index.py;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
==========================================================
若是使用bitnami,可以新建一個 conf/bitnami/pythonfastcgi.conf,加入如上設定,並修改 conf/bitnami.conf,加入:
include "/Applications/nginxstack-1.10.1-2/nginx/conf/bitnami/pythonfastcgi.conf";
==========================================================
然後python需安裝flup,用來當做fastcgi的gateway(即符合fastcgi協定的SERVER,這樣才能溝通):
pip3 install flup
然後寫一支 wsgi.py,並啟動(以/tmp/python-fcgi.sock監聽):
==========================================================
#!/usr/local/bin/python3
#coding=utf-8
from html import escape
import sys, os
from flup.server.fcgi import WSGIServer
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
yield '<h1>FastCGI Environment</h1>'
yield '<table>'
for k, v in sorted(environ.items()):
yield '<tr><th>%s</th><td>%s</td></tr>' % (escape(k), escape(v))
yield '</table>'
if __name__ == '__main__':
# WSGIServer(app, bindAddress=('127.0.0.1',10240)).run()
WSGIServer(app, bindAddress='/tmp/python-fcgi.sock').run()
==========================================================
修改為執行檔並執行,再執行nginx:
chmod +x wsgi.py
./wsgi.py
systemctl start nginx
uWSGI是一個軟體專案名稱,而flup本身就是一個架構在uWSGI專案之上的server,同時支援了:
wsgi-->可支援fastcgi
uwsgi-->python web server protocol
http協定
等,因此Nginx也可以改用uwsgi(設定uwsgi_pass)去執行,可參考下面最後一個鏈結
ref:
https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
https://httpd.apache.org/docs/2.4/howto/cgi.html
http://uwsgi-docs.readthedocs.io/en/latest/WebServers.html
https://segmentfault.com/a/1190000003993249
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
==============================================
...
LoadModule cgid_module modules/mod_cgid.so
...
<Directory "/opt/bitnami/apache2/htdocs">
...
Options FollowSymLinks MultiViews +ExecCGI
AddHandler cgi-script .py
...
</Directory>
==========================================================
若是使用bitnami LAMP stack,需再同時修改 conf/bitnami/bitnami.conf,修改設定同上
==========================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==========================================================
在NginX上修改nginx.conf,加入以下片段,以fast-cgi執行python:
==========================================================
location ~ \.py$ {
root html;
fastcgi_read_timeout 300;
#fastcgi_pass 127.0.0.1:10240;
fastcgi_pass unix:/tmp/python-fcgi.sock; #使用.sock監聽
fastcgi_index index.py;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
==========================================================
若是使用bitnami,可以新建一個 conf/bitnami/pythonfastcgi.conf,加入如上設定,並修改 conf/bitnami.conf,加入:
include "/Applications/nginxstack-1.10.1-2/nginx/conf/bitnami/pythonfastcgi.conf";
==========================================================
然後python需安裝flup,用來當做fastcgi的gateway(即符合fastcgi協定的SERVER,這樣才能溝通):
pip3 install flup
然後寫一支 wsgi.py,並啟動(以/tmp/python-fcgi.sock監聽):
==========================================================
#!/usr/local/bin/python3
#coding=utf-8
from html import escape
import sys, os
from flup.server.fcgi import WSGIServer
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
yield '<h1>FastCGI Environment</h1>'
yield '<table>'
for k, v in sorted(environ.items()):
yield '<tr><th>%s</th><td>%s</td></tr>' % (escape(k), escape(v))
yield '</table>'
if __name__ == '__main__':
# WSGIServer(app, bindAddress=('127.0.0.1',10240)).run()
WSGIServer(app, bindAddress='/tmp/python-fcgi.sock').run()
==========================================================
修改為執行檔並執行,再執行nginx:
chmod +x wsgi.py
./wsgi.py
systemctl start nginx
uWSGI是一個軟體專案名稱,而flup本身就是一個架構在uWSGI專案之上的server,同時支援了:
wsgi-->可支援fastcgi
uwsgi-->python web server protocol
http協定
等,因此Nginx也可以改用uwsgi(設定uwsgi_pass)去執行,可參考下面最後一個鏈結
ref:
https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
https://httpd.apache.org/docs/2.4/howto/cgi.html
http://uwsgi-docs.readthedocs.io/en/latest/WebServers.html
https://segmentfault.com/a/1190000003993249
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
2018-05-30
TOMCAT與前端PROXY代理問題
場景:
TOMCAT開HTTP 80,前端以NGINX開HTTPS 443做代理
問題:
servlet的response.sendRidirect("...")會將相對路徑轉為絕對路徑,但轉換後scheme(http)不對
解法一:
修改server.xml的Connector,加入屬性 scheme="https",但參考tomcat的Response.java原始碼,發現如果Connector跟scheme設定的port不同時,會在sendRedirect的網址加入Connector埠號,因此必須同時設定redirectPort="443"
解法二:
修改context.xml,加入屬性 useRelativeRedirects="true",強迫sendRedirect的產生的網址為相對路徑(但可能某些舊的瀏覽器會產生問題)。
REF:
https://github.com/apache/tomcat/blob/c126b1f373751380f0070c2f890cd3554af363fd/java/org/apache/catalina/connector/Response.java
https://tomcat.apache.org/tomcat-8.5-doc/config/context.html
https://tomcat.apache.org/tomcat-8.5-doc/config/http.html
附resin解法( <resin:SetRequestSecure>):
2018-04-29
JAVA與MySQL的UTFB8MB4問題
1.升級MySQL 至少 > 5.5.3,並修改/etc/my.cnf,加入以下設定後,重開機
(JDBC預設會抓資料庫的character-set-server來做character判斷)
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
2.修改資料table裡,將需要支援擴充字集的「欄位」改成utfbmb4_unicode_ci
3.升級 tomcat/lib裡的mysql-connector-java,至少 > 5.1.13,建議5.1.47(含)以上
4.tomcat修改context.xml,連線字串中加入
(characterEncoding=UTF8已預設相容UTF8MB4,此設定拿掉會直接讀資料庫的character-set-server,其實也沒影響)
(autoReconnect=true是為了能自動重新讀取資料庫設定,以避免讀到舊暫存設定)
useUnicode=true&autoReconnect=true&characterEncoding=UTF8
5.java正則表示式中,使用Pattern.compile("regex")似乎無法正常判斷unicode範圍20000 ~ 2A6D6 (42711字)及2F800 ~ 2FA1D (542字)的4 bytes字元,因此改用String.matches("regex"):
//是否全為漢字
str.matches("^[\\u4E00-\\u9FBB\\u3400-\\u4DB5\\uF900-\\uFAD9\\x{20000}-\\x{2A6D6}\\x{2F800}-\\x{2FA1D}\\(\\)]+$")
6.javascript的全漢字正則表示式:
!/^([\u4E00-\u9FBB|\u3400-\u4DB5|\uF900-\uFAD9]|[\uD800-\uDBFF][\uDC00-\uDFFF])+$/.test(STRING)
ref:
https://segmentfault.com/a/1190000000616820
http://seanlook.com/2016/10/23/mysql-utf8mb4/
CenOS上升級JRE及TOMCAT
切換為root
sudo -i
安裝tomcat9
cd /www
wget http://ftp.mirror.tw/pub/apache/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.tar.gz
tar zxvf apache-tomcat-9.0.7.tar.gz
新增tomcat使用者及群組
groupadd tomcat useradd -s /bin/false -g tomcat -d /www/apache-tomcat-9.0.7 tomcat
修改tomcat目錄owner及group
chwon -hR tomcat.tomcat /www/apache-tomcat-9.0.7
安裝jre
cd /usr/java
wget https://www.oracle.com/paht/to/jre/for/jdk-XXX-linux-x64.tar.gz
tar zxvf jre-XXX-linux-x64.tar.gz
alternatives --install /usr/bin/java java /usr/java/jdkXXX/jre/bin/java 300
rm latest
ln -s /usr/java/jdkXXX latest
修改jre路徑
update-alternatives --config java
移除原來jre
sudo update-alternatives --remove java /usr/java/jdk_oldXXX/jre/bin/java
重建並移除無用soft link
cd /etc/alternatives
ln -sf /usr/java/jdkXXX/jre/bin/* .
ln -sf /usr/java/jdkXXX/bin/* .
ln -sf /usr/java/jdkXXX/man/man1/* .
find -xtype l -delete
修改 /etc/profile
-----------------
...
export JAVA_HOME=/usr/java/jdkXXX
export CATALINA_HOME=/apps/tomcat-x.x.x
-----------------
source /etc/profile
java -version
echo $JAVA_HOME
修改 /etc/systemd/system/multi-user.target.wants/tomcat.service
將 jre跟tomcat路徑改掉
=====================
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
#restart after failure
Restart=on-failure
RestartSec=5
TimeoutStartSec=60
TimeoutStopSec=60
export JAVA_HOME=/usr/java/jdk1.8.0_172
export CATALINA_HOME=/apps/tomcat-9.0.7
Environment=JAVA_HOME=/usr/java/jdk1.8.0_172
Environment=CATALINA_PID=/apps/tomcat-9.0.7/temp/tomcat.pid
Environment=CATALINA_HOME=/apps/tomcat-9.0.7
Environment=CATALINA_BASE=/apps/tomcat-9.0.7
Environment='CATALINA_OPTS=-Xms512M -Xmx4096M -server -XX:+UseParallelGC'
#Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/apps/tomcat-9.0.7/bin/startup.sh
ExecStop=/apps/tomcat-9.0.7/bin/shutdown.sh
#ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
=====================
systemctl daemon-reload
=========
找出檔案的mod number
stat --format '%a' filename
找出有+s的檔案
find . -perm -4000
find . -perm -2000
ref:
sudo -i
安裝tomcat9
cd /www
wget http://ftp.mirror.tw/pub/apache/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.tar.gz
tar zxvf apache-tomcat-9.0.7.tar.gz
新增tomcat使用者及群組
groupadd tomcat useradd -s /bin/false -g tomcat -d /www/apache-tomcat-9.0.7 tomcat
修改tomcat目錄owner及group
chwon -hR tomcat.tomcat /www/apache-tomcat-9.0.7
安裝jre
cd /usr/java
wget https://www.oracle.com/paht/to/jre/for/jdk-XXX-linux-x64.tar.gz
tar zxvf jre-XXX-linux-x64.tar.gz
alternatives --install /usr/bin/java java /usr/java/jdkXXX/jre/bin/java 300
rm latest
ln -s /usr/java/jdkXXX latest
修改jre路徑
update-alternatives --config java
移除原來jre
sudo update-alternatives --remove java /usr/java/jdk_oldXXX/jre/bin/java
重建並移除無用soft link
cd /etc/alternatives
ln -sf /usr/java/jdkXXX/jre/bin/* .
ln -sf /usr/java/jdkXXX/bin/* .
ln -sf /usr/java/jdkXXX/man/man1/* .
find -xtype l -delete
修改 /etc/profile
-----------------
...
export JAVA_HOME=/usr/java/jdkXXX
export CATALINA_HOME=/apps/tomcat-x.x.x
-----------------
source /etc/profile
java -version
echo $JAVA_HOME
修改 /etc/systemd/system/multi-user.target.wants/tomcat.service
將 jre跟tomcat路徑改掉
=====================
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
#restart after failure
Restart=on-failure
RestartSec=5
TimeoutStartSec=60
TimeoutStopSec=60
export JAVA_HOME=/usr/java/jdk1.8.0_172
export CATALINA_HOME=/apps/tomcat-9.0.7
Environment=JAVA_HOME=/usr/java/jdk1.8.0_172
Environment=CATALINA_PID=/apps/tomcat-9.0.7/temp/tomcat.pid
Environment=CATALINA_HOME=/apps/tomcat-9.0.7
Environment=CATALINA_BASE=/apps/tomcat-9.0.7
Environment='CATALINA_OPTS=-Xms512M -Xmx4096M -server -XX:+UseParallelGC'
#Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/apps/tomcat-9.0.7/bin/startup.sh
ExecStop=/apps/tomcat-9.0.7/bin/shutdown.sh
#ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
=====================
systemctl daemon-reload
=========
找出檔案的mod number
stat --format '%a' filename
找出有+s的檔案
find . -perm -4000
find . -perm -2000
ref:
2018-03-23
修改TOMCAT的預設ROOT位置
方法一(建議):
新增一個要做為網站根目錄的資料夾(注意不可放在webapps裡,以免重複deploy)
新增 ROOT.xml 到 conf\Catalina\localhost
(ROOT名稱不可改變,且為大寫,因為路徑是以xml的檔名判斷的)
ROOT.xml 新增一行(其中path屬性可不需要,因如前述原因,是以xml的檔名為路徑)
方法二:
新增一個要做為網站根目錄的資料夾(可放在webapps裡,也可放其它地方)
修改 conf/server.xml
修改<Host>屬性 autoDeploy = fasle, deployOnStartup = false 以免自動deploy
在 <Host> 標籤中新增(需要 path = "" 即路徑為 \ )
ref:
https://stackoverflow.com/questions/715506/how-to-change-the-root-application
http://staraphd.blogspot.tw/2009/10/change-default-root-folder-in-tomcat.html
新增一個要做為網站根目錄的資料夾(注意不可放在webapps裡,以免重複deploy)
新增 ROOT.xml 到 conf\Catalina\localhost
(ROOT名稱不可改變,且為大寫,因為路徑是以xml的檔名判斷的)
ROOT.xml 新增一行(其中path屬性可不需要,因如前述原因,是以xml的檔名為路徑)
<Context path="" docBase="資料夾所在的絕對路徑,或相對於webapps的相對路徑" />
方法二:
新增一個要做為網站根目錄的資料夾(可放在webapps裡,也可放其它地方)
修改 conf/server.xml
修改<Host>屬性 autoDeploy = fasle, deployOnStartup = false 以免自動deploy
在 <Host> 標籤中新增(需要 path = "" 即路徑為 \ )
<Context path="" docBase="資料夾所在的絕對路徑,或相對於webapps的相對路徑" />
ref:
https://stackoverflow.com/questions/715506/how-to-change-the-root-application
http://staraphd.blogspot.tw/2009/10/change-default-root-folder-in-tomcat.html
2018-03-06
在WINDOWS 10上安裝Kali Linux
Windows 上面可以不用再藉助VM而直接跑Linux了!
藉助Windows Subsystem for Linux(WSL),可以在Windows 10 上跑原生的Linux二進制執行檔(ELF格式),如果Linux上的Wine是用來跑windows程式,那Windows上的WSL也許可以叫做Line(咦?)
- 「程式與功能 / 開啟或關閉Windows功能」,啟用「適用於Linux的Windows子系統」,重開機。
(或直接在有管理員權限的PowerShell裡執行
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux ) - 到Mircosoft Store,安裝Kali Linux
- 啟動Kali後,先設定使用者為root並設定密碼
- sudo apt-get install wget
- wget https://kali.sh/xfce4.sh | sudo sh //會安裝非常久...
- sudo /etc/init.d/xrdp start //啟動xrdp
- sudo /etc/init.d/xrdp stop //停止xrdp
- netstat -antup | grep xrdp //檢視是否有啟動xrdp
- sudo apt-get install aircrack-ng //安裝蹭網工具 (咦?
再用遠端桌面(RDP)連線localhost:3390
ref:
2018-01-22
mac安裝composer & php-cs-fixer
安裝 php 7.2
brew update
brew tap homebrew/dupes
brew tap homebrew/php
brew install php72 (需php >= 7)
mv /usr/bin/php /usr/bin/php55
sudo ln -s /usr/local/bin/php /usr/bin/php
which php
# mac原本php
/usr/bin/php
# Homebrew的php
/usr/local/bin/php
# 重新安裝 PHP 7.2
brew reinstall php@7.2
# 測試重建鏈
brew link --overwrite --force --dry-run php@7.2
# 重建鏈結
brew link --overwrite --force php@7.2
安裝composer (php >= 7)
brew install composer
安裝xdebug
pecl install xdebug
安裝 php-cs-fixer
composer global require friendsofphp/php-cs-fixer
修改~/.profile
加入
export PATH="$PATH:$HOME/.composer/vendor/bin"
source ~/.profile
(或用brew: brew install homebrew/php/php-cs-fixer)
brew update
brew tap homebrew/dupes
brew tap homebrew/php
brew install php72 (需php >= 7)
mv /usr/bin/php /usr/bin/php55
sudo ln -s /usr/local/bin/php /usr/bin/php
which php
# mac原本php
/usr/bin/php
# Homebrew的php
/usr/local/bin/php
# 重新安裝 PHP 7.2
brew reinstall php@7.2
# 測試重建鏈
brew link --overwrite --force --dry-run php@7.2
# 重建鏈結
brew link --overwrite --force php@7.2
安裝composer (php >= 7)
brew install composer
安裝xdebug
pecl install xdebug
安裝 php-cs-fixer
composer global require friendsofphp/php-cs-fixer
修改~/.profile
加入
export PATH="$PATH:$HOME/.composer/vendor/bin"
source ~/.profile
(或用brew: brew install homebrew/php/php-cs-fixer)
Bitnami Nginx Stack 取消 php opache
Bitnami Nginx Stack 預設是有PHP Opcache的,
因此修改php時無法即時看到修改結果,
當開發機使用時,讓人覺得很鬧。
修改
/Applications/nginxstack-1.10.1-2/php/etc/php.ini
將
opcache.enable=0
若安裝的是LAMP,需再修改
/Applications/nginxstack-1.10.1-2/apache2/conf/httpd.conf
將
#Include conf/pagespeed.conf
#Include conf/pagespeed_libraries.conf
給註解起來
ref:
https://docs.bitnami.com/general/infrastructure/lamp/#how-to-disable-the-cache-in-the-server
因此修改php時無法即時看到修改結果,
當開發機使用時,讓人覺得很鬧。
修改
/Applications/nginxstack-1.10.1-2/php/etc/php.ini
將
opcache.enable=0
若安裝的是LAMP,需再修改
/Applications/nginxstack-1.10.1-2/apache2/conf/httpd.conf
將
#Include conf/pagespeed.conf
#Include conf/pagespeed_libraries.conf
給註解起來
ref:
https://docs.bitnami.com/general/infrastructure/lamp/#how-to-disable-the-cache-in-the-server
2018-01-17
WAMP使用PHP7
依WAMP的需求安裝Visual C++ Redistributable 2015
https://www.microsoft.com/en-us/download/details.aspx?id=48145
下載PHP 7
http://windows.php.net/download/
選擇x86或x64(依WAMP版本決定)Thread Safe版本
建立 wamp\bin\php\php7.2 資料夾
從 wamp\bin\php\php5.x 複製 php.ini 及 wampserver.conf 到 wamp\bin\php\php7.2
修改 php.ini
將 extension_dir 修改成 php7.2路徑
將 track_errors = On 註解掉
將 extension=php_mysql.dll 註解掉
複製 php_xdebug-2.6.0beta1-7.2-vc15-x86_64.dll(TS)到 wamp\bin\php\php7.2\zend_ext
在[xdebug]新增 xdebug.remote_enable = on
在[xdebug]新增 xdebug.remote_autostart = on
複製一份 php.ini,改名為 phpForApache.ini (wamp\bin\apache\apache2.4.9\bin\php.ini會link到此檔,而且apache會載入apapche/bin/php.ini!)
※注意:執行wamp時,看一下phpinfo()中的php.ini路徑是否正確,以及xdebug模組是否順利載入。
若是跑php CLI要載入xdebug,跑一下php --ini,看一下載入的php.ini路徑是否正確,
或執行php -S localhost:80,看一下phpinfo()看載入的php.ini路徑是否正確
修改 wampserver.conf
phpConf['apache']['2.4']['LoadModuleName'] = 'php7_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php7apache2_4.dll';
啟動WAMP並選擇PHP版本
Start Wamp > PHP > Version > 7
(Apache 需 >=2.4 )
https://www.microsoft.com/en-us/download/details.aspx?id=48145
下載PHP 7
http://windows.php.net/download/
選擇x86或x64(依WAMP版本決定)Thread Safe版本
建立 wamp\bin\php\php7.2 資料夾
從 wamp\bin\php\php5.x 複製 php.ini 及 wampserver.conf 到 wamp\bin\php\php7.2
修改 php.ini
將 extension_dir 修改成 php7.2路徑
將 track_errors = On 註解掉
將 extension=php_mysql.dll 註解掉
複製 php_xdebug-2.6.0beta1-7.2-vc15-x86_64.dll(TS)到 wamp\bin\php\php7.2\zend_ext
在[xdebug]新增 xdebug.remote_enable = on
在[xdebug]新增 xdebug.remote_autostart = on
複製一份 php.ini,改名為 phpForApache.ini (wamp\bin\apache\apache2.4.9\bin\php.ini會link到此檔,而且apache會載入apapche/bin/php.ini!)
※注意:執行wamp時,看一下phpinfo()中的php.ini路徑是否正確,以及xdebug模組是否順利載入。
若是跑php CLI要載入xdebug,跑一下php --ini,看一下載入的php.ini路徑是否正確,
或執行php -S localhost:80,看一下phpinfo()看載入的php.ini路徑是否正確
修改 wampserver.conf
phpConf['apache']['2.4']['LoadModuleName'] = 'php7_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php7apache2_4.dll';
啟動WAMP並選擇PHP版本
Start Wamp > PHP > Version > 7
(Apache 需 >=2.4 )
訂閱:
文章 (Atom)