Problem with cURL

Something is missing in php (curl) installation of Virtualmin. cURL does not work properly. When using something like

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, ‘Googlebot/2.1 (’);
curl_setopt($ch, CURLOPT_URL,“”);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_REFERER, ‘’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$html = curl_exec($ch);

it automatically echo $html and show the content.


Not all the PHP modules are installed by default (if it did, the RAM requirements for running a web server would be rather extraordinary).

However, that’s something you can install at any point using yum or apt, depending on your distro.

If you’re using CentOS, you can run: yum install php-curl

If you’re using Ubuntu or Debian, you can run: apt-get install php5-curl

I just found, it is not the curl problem (sorry), but it is related to difference in preg_match.