Analyse PHP Script With SonarQube & SonarQube Runner

Posted by & filed under MYSQL, PHP, Sonarqube.

Once you successfully installed the SonarQube Server in your local system, then the next step is to analyse our code with this SonarQube server and SonarQube Runner.

Now start your SonarQube Server by click on the StartSonar.bat file in the bin or start via command line. Now access the SonarQube server via browser using following URL.


Now click on the login link on the navigation menu to login using default admin credentials.

Username/Password : admin/admin

Once you successfully logged in, then click on Administration link in the top menu, then select System->Update Center to install required plugins. Now select Available, it will list out all the available plugins. Please install PHP, Web, CSS, JavaScript Plugins by clicking on the Install button. Once you installed required plugins you need to restart your SonarQube server by click on Ctrl + C button. Now it will shutdown the server and start the server by clicking on StartSonar.bat file. Now you have done all the configurations related to SonarQube server, next move it to SonarQube Runner.

<h2> Download SonarQube Runner </h2>

Now Download the SonarQube Runner from the following link and unzip in the C:/ directory (C:sonar-runner) like this.

<h2> Download SonarQube Examples </h2>

Now download the SonarQube example from the following link, unzip and keep it in your system.


<h2> Do SonarQube Runner Configuration : </h2>

Now do the configuration change in the following file like this


#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here

#----- Default SonarQube server

#----- PostgreSQL

#----- MySQL

#----- Oracle

#----- Microsoft SQLServer

#----- Global database settings

#----- Default source code encoding

#----- Security (when 'sonar.forceAuthentication' is set to 'true')


Create Projects Directory in SonarQube Runner Base Directory:

Please create Projects folder in SonarQube Runner Base Directory. Now create file in the Projects folder. This file will have information (like name of project, language and etc..) about the project we are going to analyse.


Now go to the SonarQube example you have download, and now copy file from following directory sonar-examples-masterprojectslanguagesphpphp-sonar-runner to Projects folder we have created in the SonarQube Runner Base Directory. Also copy the src folder from sonar-examples-masterprojectslanguagesphpphp-sonar-runner to C:sonar-runnerbin directory.

Run SonarQube Runner

Now run the SonarQube Runner service via command line. Open your command line with Administrative privilege and change the working directory to SonarQube Runner bin directory using following command.

cd C:sonar-runnerbin

Now type sonar-runner.bat in the command line to analyse our source code.

Analyse PHP Script With SonarQube & SonarQube Runner


On the success of our analyse it will print EXECUTION SUCCESS message in command line. Now go SonarQube server dashboard, you see your analysed project name listed in Projects section. Click on the Project name, it will take you to the report page, where it lists number blocker, critical, minor and major bugs like this.

SonarQube PHP Analysis Report


Download Premium Only Scripts & 80+ Demo scripts Instantly at just 1.95 USD per month + 10% discount to all Exclusive Scripts

If you want any of my script need to be customized according to your business requirement,

Please feel free to contact me [at] muni2explore[at]

Note: But it will be charged based on your customization requirement

Get Updates, Scripts & Other Useful Resources to your Email

Join 10,000+ Happy Subscribers on feedburner. Click to Subscribe (We don't send spam)
Every Email Subsciber could have access to download 100+ demo scripts & all future scripts.

%d bloggers like this:

Get Instant Script Download Access!