I was facing issue to run the following lines of code on php:
$url = "http://example.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
After researching hours on google I come to the conclusion that curl was not installed on ubuntu, so the code above was not running. What it means is that you don't have curl installed and you need to install curl to use it. This can be done by going to a terminal CTRL + ALT + T then entering
$ sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
This will install curl, php and the necessary libraries to provide you with the functionality that you need. After the installation has completed, restart the server with
$ sudo service apache2 restart
Now create file info.php with following lines of code:
<?php
phpinfo();
?>
You will see following has been installed on ubuntu localhost:
0 Comment(s)