Centos6.6安装phpmd

安装说明 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

相关文章
相关标签/搜索