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.

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

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站