Sonar Qube & Scanner Installation For Php

Prateek Mishra
2 min readDec 28, 2022

--

Before running the below commands to install and run SonarQube using Docker, make sure that you have Docker installed on your Linux system and that you have enough free memory (at least 1.5 GB).

To check if Docker is installed on your system, you can run the following command:

docker --version

If Docker is installed, this command will print the version number. If Docker is not installed, you will need to install it before you can proceed with the SonarQube installation.

To check the available memory on your system, you can use the free command:

free -m

This will print the total, used, and available memory in megabytes. Make sure that the available memory is at least 1.5 GB before proceeding with the SonarQube installation.

To install and run SonarQube using Docker, follow these steps:

  1. Pull the SonarQube image from Docker Hub using the docker pull command: docker pull sonarqube
  2. Run the SonarQube container using the docker run command. Use the -dit flag to run the container in detached mode and the -p flag to specify the port mapping. Use the -name flag to give the container a name, and specify the image name and tag (in this case, sonarqube:latest): docker run -dit -p 9000:9000 - name sonarqube sonarqube:latest

3. This will start the SonarQube container and expose it on port 9000. You can then access the SonarQube web interface by visiting http://localhost:9000 in a web browser.

To install the SonarQube Scanner for PHP, follow these steps:

  1. Download the SonarQube Scanner for PHP using wget: wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
  2. Unzip the downloaded file using unzip: unzip sonar-scanner-cli-4.7.0.2747-linux.zip
  3. Change the current directory to the bin directory of the unzipped folder: cd sonar-scanner-4.7.0.2747-linux/bin
  4. Export the bin directory to the PATH environment variable: export PATH=$PATH:/root/group-service/sonar-scanner-4.7.0.2747-linux/bin

Note: Make sure to replace /root/group-service/ with the actual path to the sonar-scanner-4.7.0.2747-linux directory on your system.

This should install the SonarQube Scanner for PHP on your system. You can then use the sonar-scanner command to run a SonarQube analysis on your PHP code.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Prateek Mishra
Prateek Mishra

Written by Prateek Mishra

I am a tech enthusiast who thrives on experimenting with cutting-edge technologies

No responses yet

Write a response