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 (http://www.googlebot.com/bot.html)’);
curl_setopt($ch, CURLOPT_URL,“http://www.yahoo.com”);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_REFERER, ‘http://www.google.com/bot.html’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$html = curl_exec($ch);
curl_close($ch);

it automatically echo $html and show the content.

Howdy,

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.