# PHP BitBucket Pipeline

**URL:** <https://community.sonarsource.com/t/php-bitbucket-pipeline/74005>\
**Category:** SonarQube Cloud\
**Tags:** docker, scanner\
**Created:** [October 4, 2022, 3:40pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005 "2022-10-04T15:40:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![s3un](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/s3un/32/35942_2.png) [@s3un](https://community.sonarsource.com/u/s3un)\
**Post date:** [October 4, 2022, 3:40pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/1 "2022-10-04T15:40:12Z")

</div>

I’m new to SonarCloud and i have been facing some challenges creating a PHP BitBucket pipeline.

```auto
image: "php:7.3.33" # Choose an image matching your project needs
clone:
  depth: full # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
  steps:
  - step: &build-test-sonarcloud
      name: Build, test and analyze on SonarCloud
      caches:
        - composer
        - sonar
      script:
        - pipe: sonarsource/sonarcloud-scan:1.4.0
  - step: &check-quality-gate-sonarcloud
      name: Check the Quality Gate on SonarCloud
      script:
        - pipe: sonarsource/sonarcloud-quality-gate:0.1.6

pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
  branches:
    master:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

```

the pipeline above is not working and it returns “Container ‘docker’ exceeded memory limit.”.  
Thank you for the help in advanced.

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 6, 2022, 5:06pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/2 "2022-10-06T17:06:22Z")

</div>

Hi,

How big is the project you’re trying to analyze?

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![s3un](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/s3un/32/35942_2.png) [@s3un](https://community.sonarsource.com/u/s3un)\
**Post date:** [October 6, 2022, 5:10pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/3 "2022-10-06T17:10:47Z")

</div>

i honestly don’t know how large it is.

---

<div class="post-metadata">

**Author:** ![s3un](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/s3un/32/35942_2.png) [@s3un](https://community.sonarsource.com/u/s3un)\
**Post date:** [October 6, 2022, 5:12pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/4 "2022-10-06T17:12:56Z")

</div>

the first issues has been resolved and this is the new error I’m getting:

```auto
Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator

```

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 6, 2022, 5:17pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/5 "2022-10-06T17:17:53Z")

</div>

Hi,

What does that mean to you?

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![s3un](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/s3un/32/35942_2.png) [@s3un](https://community.sonarsource.com/u/s3un)\
**Post date:** [October 6, 2022, 5:28pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/6 "2022-10-06T17:28:56Z")

</div>

Hi.

thank you for the feedback, I’m quite new to sonarcloud but from the error message, i guess the sonarcloud account is not properly added to the organization to run the analysis.

I made complain to the administrator, and we are working on it.

Thanks

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 6, 2022, 5:34pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/7 "2022-10-06T17:34:05Z")

</div>

Hi,

What this error is telling you is that at least one piece of information was missing from your analysis:

- the SonarCloud organization key
- the project key
- the user token that gives permission to analyze the project

You should double-check the data being passed in to analysis. Did you build your pipeline manually or based on the SonarCloud wizard / tutorial? Because the latter would certainly have those data points in place…

&nbsp;  
HTH,  
Ann

---

<div class="post-metadata">

**Author:** ![s3un](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/s3un/32/35942_2.png) [@s3un](https://community.sonarsource.com/u/s3un)\
**Post date:** [October 6, 2022, 5:38pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/8 "2022-10-06T17:38:23Z")

</div>

Hi,

Yeah so i got the pipeline from BitBucket as a default pipeline for PHP project, here is the new pipeline in use.

```auto
image: composer:2.0

definitions:
  services:
    docker:
      memory: 7128
clone:
  depth: full # SonarCloud scanner needs the full history to assign issues properly

pipelines:
  default:
    - parallel:
        - step:
            name: Test
            script:
              - composer install
              - ./vendor/bin/phpunit test
            caches:
              - composer
        - step:
            name: Lint
            script:
              - composer install
              - ./vendor/bin/phplint . --exclude=vendor
            caches:
              - composer
        - step:
            size: 2x
            name: sonarcloud
            script:
              - pipe: sonarsource/sonarcloud-scan:1.4.0
              - pipe: sonarsource/sonarcloud-quality-gate:0.1.6 
            caches:
              - composer

```

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 6, 2022, 5:44pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/9 "2022-10-06T17:44:50Z")

</div>

Hi,

You should use the one from the onboarding wizard or [the docs](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/bitbucket-pipelines-for-sonarcloud/).

&nbsp;  
HTH,  
Ann

---

<div class="post-metadata">

**Author:** ![s3un](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/s3un/32/35942_2.png) [@s3un](https://community.sonarsource.com/u/s3un)\
**Post date:** [October 6, 2022, 5:52pm UTC](https://community.sonarsource.com/t/php-bitbucket-pipeline/74005/10 "2022-10-06T17:52:47Z")

</div>

I’ll try the on-boarding wizard and revert back.

Thank you,
