---
title: "PHP HTTPS Proxy Setup: Guzzle and the cURL Extension"
description: "Route PHP requests through a static IP with an HTTPS proxy URL in Guzzle or the cURL extension. Check libcurl HTTPS proxy support and set timeouts."
canonical: https://fixedmark.com/docs/php
updated: 2026-11-03
source: Fixedmark (https://fixedmark.com), BitMask LLP
---

HTTP clients

# PHP HTTPS proxy setup

PHP clients built on libcurl, including Guzzle and the cURL extension, accept the Fixedmark https\:// proxy URL directly. Check that your libcurl build supports HTTPS proxies.

Docs preview: Fixedmark is not live yet. Endpoints are issued at launch, and these pages describe planned launch behavior. Anything marked planned may change. [Join early access](https://fixedmark.com/early-access) to get yours first.

## Guzzle

Pass the proxy URL in the `proxy` request option. The array form sets a proxy per scheme and a `no` list for hosts that should go direct.

**Guzzle**

```php
<?php
// composer require guzzlehttp/guzzle
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client([
    'proxy' => [
        'http'  => getenv('FIXEDMARK_PROXY_URL'),
        'https' => getenv('FIXEDMARK_PROXY_URL'),
        'no'    => ['localhost', '127.0.0.1'],
    ],
    'connect_timeout' => 10,
    'timeout' => 30,
]);

$res = $client->get('https://api.partner.example/v1/orders');
echo $res->getStatusCode(), PHP_EOL;
```

Laravel's `Http` facade wraps Guzzle, so `Http::withOptions(['proxy' => ...])` takes the same value.

## cURL extension

Set `CURLOPT_PROXY` to the full URL. libcurl reads the scheme and credentials from it and tunnels HTTPS with `CONNECT`.

**cURL extension**

```php
<?php
$ch = curl_init('https://api.partner.example/v1/orders');
curl_setopt_array($ch, [
    CURLOPT_PROXY          => getenv('FIXEDMARK_PROXY_URL'),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_TIMEOUT        => 30,
]);

$body = curl_exec($ch);
if ($body === false) {
    fwrite(STDERR, curl_error($ch) . PHP_EOL);
    exit(1);
}
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), PHP_EOL;
```

## Check libcurl support

HTTPS proxies need libcurl 7.52.0 or later, built with a TLS backend that supports them. Most current Linux images qualify. Check before you deploy:

**Check support**

```bash
# libcurl 7.52.0+ with HTTPS-proxy support is required.
curl -V | grep -o HTTPS-proxy

php -r 'var_dump((bool) (curl_version()["features"] & CURL_VERSION_HTTPS_PROXY));'
```

## Notes

- Guzzle's stream handler, used only when the cURL extension is missing, does not support HTTPS proxies. Install `ext-curl`.
- PHP-FPM workers keep cURL handles only for one request. Each request opens a new tunnel and counts as a new proxy request.
- Set `connect_timeout` and `timeout`. A destination that silently drops non-allowlisted IPs otherwise hangs a worker.
- For MySQL or Postgres from PHP, see [databases](https://fixedmark.com/docs/databases). PDO has no proxy option.

Tested with PHP 8.5, the cURL extension, and Guzzle 7 against a local TLS-wrapped CONNECT proxy.

## Platform guides

- [Railway](https://fixedmark.com/integrations/railway)
- [Render](https://fixedmark.com/integrations/render)
- [Heroku](https://fixedmark.com/integrations/heroku)
- [AWS Lambda](https://fixedmark.com/integrations/aws-lambda)

## Frequently asked questions

### Does Guzzle support an HTTPS proxy?

Yes, when it uses its default cURL handler and libcurl is 7.52.0 or later with HTTPS-proxy support. Guzzle passes the proxy URL to libcurl, which opens TLS to the proxy.

### How do I check if PHP's libcurl supports HTTPS proxies?

Check that curl_version()\['features'] includes the CURL_VERSION_HTTPS_PROXY bit. The constant exists from PHP 7.3.0 and cURL 7.52.0.

### Can Laravel's HTTP client use the proxy?

Laravel's HTTP client is built on Guzzle. Pass the same proxy option with withOptions(\['proxy' => ...]).
