使用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.
我想请一些帮助正确设置Pear的PHP Code Sniffer。 p>
我在Mac PB 10.7.4和PHP 5.3.6上使用MAMP pro 2.0.5。 我安装了Pear并且可以运行pear命令,当我安装PHP_CodeSniffer时 通道我没有得到任何错误,但我无法触发任何命令。 p>
以下是我的命令行的屏幕截图: https://skitch.com/stephanief0042/etuck/alohamediaworks-bash-100x40 p> 我能够引用这篇文章: 将PEARs php_dir放入php.ini中的include_path p>
但我的包含路径似乎是正确的: include_path =“。:/ Applications / MAMP / bin / php / php5.3.6 / lib / php:/Applications/MAMP/bin/php/php5.3.6/bin/pear“ p>
当我跟踪PHPCS安装的路径时,我发现它是这条路径上的可执行文件: 用户/ alohamediaworks / pear / bin / phpcs p>
我不确定我是不是一个sym 无论是否使用此链接,都欢迎任何帮助或建议。 p> div>
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.