PHP &XDebug &PHPStorm &a

作者: JohnnyB0Y | 来源:发表于2017-04-02 16:32 被阅读460次

    1. 安装 PHP

    brew install php71 --with-imap --with-homebrew-curl --with-homebrew-libressl
    
    • hombrew-curl 和 hombrew-libressl 选项是一个不错的选择。 我遇到一些卷曲请求与SSL崩溃没有这些选项

    • 对于完整的选项列表运行brew options php71

    2. 安装 Xdebug

    brew install php71-xdebug --build-from-source
    
    • 添加 --build-from-source 选项是必要的,否则它会引发启动时出现以下错误,Xdebug使用不同的引擎构建:

    Cannot load Xdebug - it was built with configuration API320160303,NTS, whereas running engine is API320160303,NTS,debug

    3. 配置 Xdebug

    更新 /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini 文件
    

    以执行以下操作:

    [xdebug] 
    zend_extension="/usr/local/opt/php71-xdebug/xdebug.so" 
    xdebug.remote_enable=1 
    xdebug.remote_host=127.0.0.1 
    xdebug.remote_port=9001 
    xdebug.profiler_enable=1 
    xdebug.profiler_output_dir="/tmp" 
    xdebug.idekey=PHPSTORM
    

    了解Xdebug文档 ,了解每个选项有哪些好处。

    4. PHPStorm 配置

    9000端口在我的情况下被其他服务占用。 您可以将其更改为任何您想要的,只需确保IDE和Xdebug中的端口值匹配。


    phpstorm-config.png

    5. 安装 Composer

    5.1 使用 Packagist 镜像

    修改 composer 的全局配置文件

    composer config -g repo.packagist composer https://packagist.phpcomposer.com
    
    5.2 下载安装 Composer
    下载安装脚本 - composer-setup.php - 到当前目录。
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    
    执行安装过程。
    php composer-setup.php
    
    删除安装脚本。
    php -r "unlink('composer-setup.php');"
    
    打开命令行窗口并执行如下命令将前面下载的 composer.phar 文件移动到 /usr/local/bin/ 目录下面:
    sudo mv composer.phar /usr/local/bin/composer
    
    5.3 基本操作
    查看版本信息
    composer --version
    更新版本
    composer selfupdate
    

    参考

    Packagist / Composer
    PHP & XDebug & PHPStorm

    相关文章

      网友评论

        本文标题:PHP &XDebug &PHPStorm &a

        本文链接:https://www.haomeiwen.com/subject/fnygottx.html