curl does not start in php

0

I'm learning php and was testing the curl, however it's crashing in curl_init ();

The code I am using to test is below, I put some print to test where the error was and what happens is that the output only exits zero.

<?php
// create a new cURL resource
print 0;
$ch = curl_init();
print 1;

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

print 2;
?>

So what I want to know is how to make it work, I'm on linux mint and use php 7.0. To install the curl I used apt-get install curl php-curl libcurl3-libcurl3-dev, then restarted apache2 and php7.0-fpm here, but in phpinfo () does not say it's installed yet. I do not understand what you're missing.

    
asked by anonymous 16.10.2016 / 21:39

1 answer

0

Make sure the extension=curl line is uncommented (without ';' at start) in your php.ini file.

It should be in the /etc/php/7.0/apache2/php.ini folder

    
17.10.2016 / 18:16