安裝說明 php
虛擬機:VirtualBox html
操做用戶:root node
系統環境:centos6.6 x64 shell
安裝方式:Phar安裝 centos
軟件:phpmd.phar post
軟件下載目錄:/root/opt this
下載地址:http://static.phpmd.org/php/2.2.3/phpmd.phar spa
安裝[root@vb002 opt]# wget http://static.phpmd.org/php/2.2.3/phpmd.phar [root@vb002 opt]# chmod +x phpmd.phar [root@vb002 opt]# mv phpmd.phar /usr/local/bin/phpmd
檢查是否安裝成功 rest
[root@vb002 opt]# phpmd -V Mandatory arguments: 1) A php source code filename or directory. Can be a comma-separated string 2) A report format 3) A ruleset filename or a comma-separated string of rulesetfilenames Available formats: xml, text, html. Available rulesets: cleancode, codesize, controversial, design, naming, unusedcode. Optional arguments that may be put after the mandatory arguments: --minimumpriority: rule priority threshold; rules with lower priority than this will not be used --reportfile: send report output to a file; default to STDOUT --suffixes: comma-separated string of valid source code filename extensions --exclude: comma-separated string of patterns that are used to ignore directories --strict: also report those nodes with a @SuppressWarnings annotation若是看到這個證實安裝成果啦。
在安裝的時候經歷了一個小插曲。phpmd須要bz2支持的。因此,若是沒有安裝或者沒有開啓bz2擴展就會報錯。 code
因爲本人的虛擬機安裝了LNMP,默認並無安裝bz2的支持。能夠經過phpinfo打印結果看出來,如圖。
看到了吧。確實是不支持bz2的,那怎麼辦?
找到lnmp安裝包,就是從新編譯php使其支持bz2
[root@vb002 opt]# cd opt/lnmp1.2-full/src/php-5.4.41/ext/bz2 [root@vb002 opt]# /usr/local/php/bin/phpize [root@vb002 opt]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@vb002 opt]# make && make install
vi /usr/local/php/etc/php.inc
添加extension=bz2.so
[root@vb002 opt]# lnmp restart
phpinfo,若是看到這個證實安裝成果啦。
再運營一下phpmd -V是否是正常了呢
參考文獻:
http://phpmd.org/
http://www.duo66.com/post-1906.html