A
A
Andrey2020-08-05 16:23:41
PHP
Andrey, 2020-08-05 16:23:41

Why is WebCP FastCGI FAIL: No environment variables found error displayed when calling cURL in PHP?

When I make a cURL request (curl_exec), I get an error as a result:

WebCP FastCGI FAIL: No environment variables found.


Request parameters:

$body = 'text content'; 		    
  $curl_url = 'https://example.org/api/';
  $myCurl = curl_init();
  $curl_headers = array('content-type' => 'text/plain');
  curl_setopt_array($myCurl, array(
    CURLOPT_URL => $curl_url,
    CURLOPT_HTTPHEADER => $curl_headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $body
  ));
  $response = curl_exec($myCurl);
  print_r($response);
  curl_close($myCurl);


I am using PHP 7.4, Apache.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question