title: Installing curl to PHP cli
body: <p>I'm trying to set up a cronjob which requires curl, and I'm calling it directly from crontab with </p>
  
  <pre><code>* * * * * /usr/bin/php myurl/my_cron.php
  </code></pre>
  
  <p>The problem is, it looks like the curl module isn't installed for my phpcli. </p>
  
  <p>It works just fine when I hit the url from my browser, but when I run </p>
  
  <pre><code>php -q myfile.php
  </code></pre>
  
  <p>from the command line, it returns </p>
  
  <pre><code>PHP Fatal error:  Call to undefined function curl_init() in my_cron.php on line 20
  </code></pre>
  
  <p>When I run <code>php -m</code> the curl module does not show up. However when I go to the browser and dump the php_info(), the module shows up and says its correctly installed.</p>
  
  <p>The other kicker is i've been trying to install curl with <code>apt-get</code> onto the server (Ubuntu 12.04 php 5.4), it seems to take down my PHP as it begins to simply attempt to download the <code>index.php</code> file wherever I try to browse to.</p>
  
  <p>Here are the attempts I've made to install curl that have taken down PHP:</p>
  
  <pre><code>sudo apt-get install php-curl
  sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
  </code></pre>
  
  <p>After each of these I restarted the apache2 server and still no dice, it attempted to download the file instead of opening the page.</p>
  
  <p>How can I install <code>php5-curl</code> to just the cli, so that my server can run it and I don't have to go through a browser?</p>
  
  <p>The other possibility is I could run the cronjobs through wget from the crontab file, but I've heard that's not the best option and potentially unreliable.</p>
  
  <p>Any help is much appreciated. Thanks! </p>