首页  >  文章  >  后端开发  >  Apache&PHP+Xdebug 安装配置

Apache&PHP+Xdebug 安装配置

WBOY
WBOY原创
2016-08-08 09:22:11961浏览

最近又要开始用 PHP 做开发,每次都要查一遍怎么安装配置环境,各个地方写的还不一样很烦。自己写。

Apache

  1. 进入官网,打开 Download页面,下载最新版的压缩包;
  2. 解压到自己想安装的目录下,我这里是放到了 F:\Program Files\Apache 中;
  3. 进入 F:\Program Files\Apache\conf 目录,编辑器打开 httpd.conf 文件。修改如下部分:
    <br> line 37: ServerRoot "c:/Apache24" -> ServerRoot "F:/Program Files/Apache" <br> line 58: Listen 80 -> Listen 8080 <br> line 218: ServerName www.example.com:80 -> ServerName www.example.com:8080 <br> line 242: DocumentRoot "c:/Apache24/htdocs" -> DocumentRoot "F:/Projects/php" <br> line 243: <directory> -> <directory> <br> line 276: DirectoryIndex index.html -> DirectoryIndex index.php index.htm index.html <br> line 359: ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/" -> ScriptAlias /cgi-bin/ "F:/Program Files/Apache/cgi-bin" <br> line 375: <directory> -> <directory files> <br></directory></directory></directory></directory>
  4. 加上对PHP的支持,在文件末尾加上下面的内容:
    <br> # php5 support <br> LoadModule php5_module "F:/Program Files/php/php5apache2_4.dll" <br> PHPIniDir "F:\Program Files\php" <br> AddType application/x-httpd-php .php .html .htm <br> # configure thepath to php.ini <br>
    如此,Apache 就配置完成。

PHP

  1. 进入官网,在 Download 找到下载链接,下载压缩包;
  2. 解压到自己想安装的目录下,我这里是放到了 F:\Program Files\php 中;
  3. 进入 F:\Program Files\php 目录,将 php.ini-development 重命名为 php.ini,并用编辑器打开这个文件。修改如下部分:
    <br> line 736: extension_dir = "ext" -> extension_dir = "F:/Program Files/php/ext" <br> line 807: upload_tmp_dir = -> upload_tmp_dir = "/upload-files" <br> line 881: ;extension=php_curl.dll -> extension=php_curl.dll <br> line 883: ;extension=php_gd2.dll -> extension=php_gd2.dll <br> line 890: ;extension=php_mbstring.dll -> extension=php_mbstring.dll <br> line 892: ;extension=php_mysql.dll -> extension=php_mysql.dll <br> line 895: ;extension=php_openssl.dll -> extension=php_openssl.dll <br> line 897: ;extension=php_pdo_mysql.dll -> extension=php_pdo_mysql.dll <br> line 899: ;extension=php_pdo_odbc.dll -> extension=php_pdo_odbc.dll <br> line 915: ;extension=php_xmlrpc.dll -> extension=php_xmlrpc.dll <br> line 930: ;date.timezone = -> date.timezone = Asia/Chongqing <br> line 1417: ;session.save_path = "/tmp" -> session.save_path = "/session" <br>
    并在 line 892 后添加: extension=php_mysqli.dll
  4. 进入 xdebug官网,打开 Download页面,下载对应系统和PHP版本的dll文件;
  5. 将下载好的dll放入 F:\Program Files\php\ext 中;
  6. 继续编辑 php.ini,在文件末尾添加如下内容:
    <br> [XDebug] <br> zend_extension = "F:\Program Files\php\ext\php_xdebug-2.3.3-5.6-vc11-x86_64.dll" <br> xdebug.profiler_append = 0 <br> xdebug.profiler_enable = 1 <br> xdebug.profiler_enable_trigger = 0 <br> xdebug.profiler_output_dir = "F:\Program Files\php\xdebug" <br> xdebug.profiler_output_name = "cachegrind.out.%t-%s" <br> xdebug.remote_enable = 1 <br> xdebug.remote_handler = "dbgp" <br> xdebug.remote_host = "127.0.0.1" <br> xdebug.trace_output_dir = "F:\Program Files\php\xdebug" <br>
  7. 在firefox安装easiest Xdebug插件;
  8. 启动phpstorm的电话筒监听;
  9. 启动xdebug插件
  10. 设置程序调试断点即可

至此,配置完成。MySQL太简单,就不写了。

以上就介绍了Apache&PHP+Xdebug 安装配置,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn