# Sonar for PHP installation for CentOS 6 # See http://docs.codehaus.org/display/SONAR/Installing+PHP+Environment mkdir /var/sonar wget http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/2.0/sonar-runner-2.0.zip unzip sonar-runner-2.0.zip export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0 /sbin/service mysqld start sudo /usr/bin/mysql_secure_installation # for non-production instances, choose not to create a root password wget --no-check-certificate https://raw.github.com/SonarSource/sonar/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql mysql -u root -p < create_database.sql # edit /var/sonar/sonar-runner-2.0/conf/sonar-runner.properties # and uncomment the lines pertaining to mysql pear channel-discover pear.phpunit.de pear channel-discover pear.symfony-project.com pear install phpunit/PHPUnit-3.5.5 yum -y install php-devel pecl install xdebug # edit /etc/php.ini and add this line: # zend_extension="FULL_PATH_TO/xdebug.so" pear channel-discover pear.pdepend.org pear install pdepend/PHP_Depend-1.0.3 pear channel-discover pear.phpmd.org pear install --alldeps phpmd/PHP_PMD-1.3.2 pear install PHP_CodeSniffer-1.3.2 # Installing Sonar as a service. # See http://docs.codehaus.org/display/SONAR/Running+Sonar+as+a+Service+on+Linux # # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar ln -s /var/sonar/sonar-runner-2.0/bin/sonar-runner /usr/bin/sonar chmod 755 /etc/init.d/sonar chkconfig --add sonar # check out a PHP project and copy the sonar-project.properties file # from this repo into the root of the php project directory. # # See https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/php/php-sonar-runner