php调试环境配置

1 启动phpstudy

Apache + mysql 的服务

确认安装了xdebug扩展,php7的默认版本是xdebug2

在小皮面板里面,编辑php7的php.ini

[Xdebug]
zend_extension=D:/ENV/phpstudy_pro/Extensions/php/php7.3.4nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=On
xdebug.trace_output_dir=D:/ENV/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.trace
xdebug.profiler_enable=On
xdebug.profiler_output_dir=D:/ENV/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.profiler
xdebug.remote_enable = 1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.idekey = phpstorm-xdebug
xdebug.remote_log="D:/ENV/phpstudy_pro/WWW/xdebug.log"

需要注意 你的remote_port 、remote_host、 idekey

接下来去idea设置对应的字段

在phpstorm 的设置→ php

设置php版本为小皮面板中的

设置debug端口和remote_port 一致,默认9001

加入一个服务器和remote_host 一致

name www
host 127.0.0.1
port 80
debugger Xdebug

在DBgp Proxy 中设置

IDE key 同 php.ini中xdebug. idekey

Host 同 php.ini中xdebug.remote_host

Port 同 php.ini中xdebug.remote_port

最后点击ok

接下来在运行配置中,加入一个PHP Web Page 也就是PHP网页

如上,即可愉快的调试咯(记得运行小虫子Debug!!!!)

2 网页404解决方法:

Apache伪静态(即系统自带的.htaccess文件):

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)
$ index.php?s=$
1 [QSA,PT,L]
</IfModule>

Nginx 伪静态

location / {
  if (!-e 
$$request_filename){
    rewrite  ^(.*)$$  /index.php?s=$1  last;   break;
  }
}

IIS

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
 <rewrite>
  <rules>
    <rule name="OrgPage" stopProcessing="true">
    <match url="^(.*)
$" />
    <conditions logicalGrouping="MatchAll">
    <add input="{HTTP_HOST}" pattern="^(.*)$
" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php?s={R:1}" />
    </rule>
    <rule name="BlockDirectDownload" enabled="true" stopProcessing="true">
  <match url="(?:asp|aspx|jsp|asa|dll|cgi|fcgi|htm)
$" ignoreCase="true" />
  <conditions>
  <add input="{HTTP_REFERER}" pattern="^http://(.*\.)?(abc\.net)/.*$
" negate="true" />
  </conditions>
  <action type="CustomResponse" statusCode="404" />
    </rule>
  </rules>
 </rewrite>
    </system.webServer>
</configuration>

php调试环境配置
https://k3ppf0r.pages.dev/2020/01/01/杂项配置/配置Phpstorm+phpstudy+xdebug/
作者
k3ppf0r
发布于
2020年1月1日
许可协议