douquanhui5735 2012-09-05 01:06
浏览 35
已采纳

使用Pear的PHP代码,在Mac上使用MAMP Pro

I’d like to ask for some help getting Pear’s PHP Code Sniffer set up properly.

I’m using MAMP pro 2.0.5 on a Mac PB 10.7.4 with PHP 5.3.6. I do have Pear installed and can run pear commands, when I installed the PHP_CodeSniffer channel I didn’t get any errors but I can’t trigger any commands.

Here is a screen shot of my command line: https://skitch.com/stephanief0042/etuck/alohamediaworks-bash-100x40

I was able to reference this post: Putting PEARs php_dir into include_path in php.ini

But my include path seems correct: include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php:/Applications/MAMP/bin/php/php5.3.6/bin/pear"

When I traced the path to the PHPCS install I found it’s executable file on this path: Users/alohamediaworks/pear/bin/phpcs

I’m not sure if i’m one symlink from being able to use this or not, any help or suggestions would be welcome.

  • 写回答

1条回答 默认 最新

  • duanliang1999 2012-09-05 06:03
    关注

    PEAR will install bin files like PHPCS into a configurable location. You can see this location by running pear config-show | grep bin_dir.

    The value here is probably currently /Users/alohamediaworks/pear/bin

    You might want to just set it to /Applications/MAMP/bin or somewhere local on your Mac, like /usr/local/bin.

    Before you do this, it is worth uninstalling PHP_CodeSniffer, and also checking that PEAR knows where PHP is by running pear config-show | grep php_bin.

    I'll assume both values need changing:

    pear uninstall PHP_CodeSniffer
    pear config-set bin_dir /Applications/MAMP/bin/php/php5.3.6/bin
    pear config-set bin_dir /Applications/MAMP/bin
    pear install PHP_CodeSniffer
    

    (check that the paths are valid first and that you don't have friendlier symlink versions)

    You need the php_bin to be correct because PEAR will change the #! line of all bin files (like phpcs) on install to point to your PHP executable. The bin_dir is important to ensure bin files are placed into a directory that is in your path. Uninstalling PHP_CodeSniffer is required so old files are not left around (PEAR wont move them).

    Hope that helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line