Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jampaul3's avatar

Install ext-curl in my sail-8.2/app image in laravel 10

I want to install stripe into my app in order to start receiving payments. But when I try to do so I get the error that stripe requires ext-curl. I'm using Laravel 10 and sail in a docker container. I have tried to search for the solution but the only thing I can find is to change the image from sail-8.2/app to php:8.2-fpm. I'd like to keep the Dockerfile as it is if at all possible and just add the installation of ext-curl to it. I added this to my Dockerfile

Install dependencies for cURL

RUN apt-get update && apt-get install -y libcurl4-openssl-dev && docker-php-ext-install curl

hoping that it would install but I get an error "docker-php-ext-install: not found" Is there another way to get ext-curl installed on the sail-8.2/app image?

chatGPT is where I found to change the FROM in the dockerfile to php:8.2-fpm, currently it is Ubuntu:22.04. Would changing that allow this to work? And would changing this cause other things to work differently?

0 likes
8 replies
LaryAI's avatar
Level 58

To install the ext-curl extension in your Laravel Sail environment without changing the base image, you can modify the Dockerfile to include the necessary steps to install the extension. The sail-8.2/app image is based on Ubuntu, so you can use apt-get to install the required packages.

Here's how you can modify your Dockerfile to install ext-curl:

  1. Open your Dockerfile located in the docker/8.2 directory (or wherever your Dockerfile is located for the Sail setup).

  2. Add the following lines to install the curl extension:

# Update package list and install curl dependencies
RUN apt-get update && \
    apt-get install -y libcurl4-openssl-dev pkg-config && \
    docker-php-ext-install curl
  1. Rebuild your Docker containers to apply the changes:
./vendor/bin/sail build --no-cache
  1. After rebuilding, start your Sail environment:
./vendor/bin/sail up

This should install the ext-curl extension in your Sail environment. The docker-php-ext-install command is used to enable PHP extensions, and it should be available in the Sail image since it is based on the official PHP images.

If you encounter any issues with docker-php-ext-install not being found, ensure that the PHP development tools are installed. You can add the following line before the docker-php-ext-install command:

RUN apt-get install -y php8.2-dev

This should resolve the issue and allow you to install the curl extension successfully.

jampaul3's avatar

@Sergiu17 That is what I thought too. Then my next question would be what am I doing wrong when trying to install stripe/stripe-php? When I do composer require stripe/stripe-php I get the error stripe/stripe-php v16.6.0 requires ext-curl * but it is not present. I have also tried to do sail composer require stripe/stripe-php but get the same error.

I even went as far as to put "stripe/stripe-php": "^10.0" in the composer.json file and ran the composer update stripe/stripe-php command and got the same error message about curl.

I'm at a lose of what to do because I can't find anything about how to fix this except to install curl.

One more thing, when I went into the container and looked at the php.ini file it did look like the curl line was commented out. Is there a way to uncomment that line? vim, vi and nano did not work in the container.

Sergiu17's avatar

@jampaul3 what about the following?

sail shell

composer require stripe/stripe-php

Soo, do you see curl when your run php -m inside sail shell? or not?

Also I see you have PHP and composer installed locally, don't use that anymore if you have Sail. Every PHP command should be executed from the sail shell.

jampaul3's avatar

@Sergiu17 Thanks for this response I see what you are saying now. Yes curl is present when I get into the shell. But now when I run the composer require stripe/stripe-php I get this error

The repository at "/var/www/html" does not have the correct ownership and git refuses to use it: fatal: detected dubious ownership in repository at '/var/www/html'

It does say to add it as a safe.directory. Is that all I need to do then? If so do I do that from within the shell?

After that error I get this one "curl error 6 while downloading https://repo.packagist.org/packages.json: Could not resolve host: repo.packagist.org"

I assume I'm getting this error because of the first one.

Sergiu17's avatar

@jampaul3 Try with the following

sail root-shell

composer require stripe/stripe-php
jampaul3's avatar

@Sergiu17 Ok, I did that and it looked like it was going to work but ended up with this error.

The following exception probably indicates you have misconfigured DNS resolver(s)

In CurlDownloader.php line 390:

curl error 6 while downloading https://repo.packagist.org/packages.json: Could not resolve host: repo.packagist.org

jampaul3's avatar

@Sergiu17 I found the solution. I had to change the /etc/resolv.conf file in the container from nameserver 127.0.0.11 to nameserver 8.8.8.8

The next question is do I need to change it back for my app to work properly or am I ok to leave it at 8.8.8.8? I'm thinking about when we actually begin to code the stripe subscription with this need to be 8.8.8.8 in order to reach stripe's server to make transactions?

Please or to participate in this conversation.