1. 去phpstudy官網下載最新的phpstudy。
下載請點擊:[phpstudy官網](http://www.phpstudy.net/download.html)
注:可以下載自己需要的版本
2. 升級phpstudy里面的php版本。
到php官網下載和phpstudy對應的php版本。
下載請點擊:[php下載](http://php.net/downloads.php)
>[danger] 注: 下載的php文件要是zip格式的才可以
2.1 解壓下載的php源碼包(php-7.1.15-nts-Win32-VC14-x64.zip)
2.2 解壓出來的目錄重命名為(php-7.1.15-nts) 和 phpstudy的保持一致,放到phpstudy的php目錄下面
2.3 完全退出phpstudy之后,重新啟動,切換版本就能看到剛剛更新的。
3. 升級phpstudy的mysql版本
去mysql下載對應的mysql服務器包。
下載請點擊:[mysql下載](https://dev.mysql.com/downloads/mysql/)
>[danger] 注:一定要下載windows版本的mysql包
3.1 下載之后解壓mysql包,檢查解壓出來的包的格式是否和phpstydy里面mysql目錄內的文件,格式是不是一致的。
3.2 一致的話,直接重啟phpstudy的服務。檢查能不能啟動成功,啟動成功之后,用mysql可視化工具或者命令行工具連接一下mysql。檢查是否能正常連接成功。
>[danger] 注:升級之后啟動報錯的話,參考下面的錯誤處理。
>[info] 升級mysql 啟動報錯。table performance_schema.session_variables doesnt exist
>解決辦法: 用命令 進入到mysql 的 bin 目錄 執行升級命令
~~~php
mysql_upgrade -u root -p --force
systemctl restart mysqld #這條命令可能會報錯 ,報錯請忽略
~~~
4. 安裝php擴展
>[info] 由于是windows版本的,安裝擴展需要下載后綴名為 .dll 的文件
下載請點擊:[php擴展](https://windows.php.net/downloads/pecl/releases/)
4.1 下載好之后,把下載的文件復制到,php目錄下的ext目錄中
4.2 在對應的php文件當中,修改php.ini文件。配置并且開啟下載的擴展。
4.3 保存并且重啟服務,檢查是否生效。
>[danger] 下載擴展文件的時候,一定要對應自己系統的才可以
5. 安裝xdebug調試工具
在xdebug官網下載對應的 .dll 文件
下載請點擊:[xdebug下載](https://xdebug.org/download.php)
不知道怎么下載請點擊:[下載幫助](https://xdebug.org/wizard.php)
5.1 把下載的 .dll 文件放到 php目錄下的ext目錄中
5.2 在對應的php文件的,php.ini里面,打開xdebug文件
簡單配置如下:
~~~php
[XDebug]
zend_extension = D:\phpStudy\PHPTutorial\php\php-7.1.13-nts\ext\php_xdebug-2.6.0-7.1-vc14-nts.dll
xdebug.remote_enable =1//是否開啟
xdebug.remote_host = "localhost"//調試地址
xdebug.remote_port = 9009//調試端口號碼
xdebug.profiler_output_dir="D:\phpStudy\PHPTutorial\tmp\xdebug"
xdebug.trace_output_dir="D:\phpStudy\PHPTutorial\tmp\xdebug"
~~~
6. phpstudy 隱藏入口的 index.php
具體步驟參考:[tp5隱藏入口文件](http://www.hmoore.net/manual/thinkphp5/177576)
7. phpstudy 配置多項目,在nginx服務器中
在nginx的配置如下:
~~~php
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root "D:/phpStudy/PHPTutorial/WWW"; ##地址
location / {
index index.html index.htm index.php l.php;
autoindex off;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
~~~
>[info] 配置多個項目,把上面的參數復制一份就行。
>更改端口號: listen
>更改項目路徑: root 格式一定是以 / 間隔的路徑
>[danger] 注:若覺得容易復制出錯的話,可以引入配置文件。
>把項目的文件單獨一個文件保存。然后在 nginx.conf 中 include 文件名就行了。 文件名 以 .conf 結尾