gpt4 book ai didi

php - 多次安装和升级后无法识别 codesniffer 命令

转载 作者:可可西里 更新时间:2023-11-01 00:23:07 26 4
gpt4 key购买 nike

我尝试使用 pear 安装 codesniffer,但我的 mac 无法识别 phpcs 命令。

pear 配置

Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover 1
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy <not set>
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config <not set>
PEAR executables directory bin_dir /usr/local/pear/bin
PEAR documentation directory doc_dir /usr/local/pear/docs
PHP extension directory ext_dir /opt/local/lib/php/extensions/no-debug-non-zts-20090626
PEAR directory php_dir /usr/local/pear/share/pear
PEAR Installer cache directory cache_dir /private/tmp/pear/cache
PEAR configuration file cfg_dir /usr/local/pear/cfg
directory
PEAR data directory data_dir /usr/local/pear/data
PEAR Installer download download_dir /tmp/pear/install
directory
PHP CLI/CGI binary php_bin /opt/local/bin/php
php.ini location php_ini /opt/local/etc/php5/php.ini-development
--program-prefix passed to php_prefix <not set>
PHP's ./configure
--program-suffix passed to php_suffix <not set>
PHP's ./configure
PEAR Installer temp directory temp_dir /tmp/pear/install
PEAR test directory test_dir /usr/local/pear/tests
PEAR www files directory www_dir /usr/local/pear/www
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 22
Debug Log Level verbose 1
PEAR password (for password <not set>
maintainers)
Signature Handling Program sig_bin /usr/local/bin/gpg
Signature Key Directory sig_keydir /opt/local/etc/pearkeys
Signature Key Id sig_keyid <not set>
Package Signature Type sig_type gpg
PEAR username (for username <not set>
maintainers)
User Configuration File Filename /Users/anthonygordon/.pearrc
System Configuration File Filename /opt/local/etc/pear.conf

我检查了 php_bin,php 可执行文件就在那里。

当我运行 phpcs 时,我得到 command not found

我试过升级 pear,卸载重新安装代码嗅探器,一切。当我运行安装列表时,我得到

pear 列表

Package          Version State
Archive_Tar 1.3.10 stable
Console_Getopt 1.3.1 stable
PEAR 1.9.4 stable
PHP_CodeSniffer 1.4.0 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.1 stable

最佳答案

phpcs 脚本应该在 bin_dir 中,所以在 /usr/local/pear/bin/phpcs 中,因此只需确保该文件首先存在。如果不是,则安装出现问题。

看能不能直接运行:php/usr/local/pear/bin/phpcs -?

如果输出 PHPCS 帮助,则 PHPCS 安装正确,问题可能出在您的 $PATH 上。运行 echo $PATH 并确保 /usr/local/pear/bin 显示在其中。如果没有,您可以修改您的路径设置,或者您可以配置 PEAR 将可执行脚本放在其他地方。

例如,您的 $PATH 可能已经包含 /usr/local/bin(就像我的 Mac 一样),因此您可以将 bin_dir 更改为:

pear uninstall php_codesniffer
pear config-set bin_dir /usr/local/bin
pear install php_codesniffer

现在再次尝试 phpcs 命令。

关于php - 多次安装和升级后无法识别 codesniffer 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13180667/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com