title: How to set cron job for php script in ubuntu
body: <p>I want set up a cronjob for php script for every 2minutes in my ubuntu machine for this i have found the below link for reference but i am getting following error and i am not getting it how to resolve this error.</p>
  
  <p>Link for reference to set cronjob</p>
  
  <p><a href="https://askubuntu.com/questions/177971/how-can-i-set-up-a-php-script-to-run-via-cron">https://askubuntu.com/questions/177971/how-can-i-set-up-a-php-script-to-run-via-cron</a>  </p>
  
  <p><strong>First error</strong>:
      when i run a php script using command line i have got this error
      Fatal error: Call to undefined function mysql_connect() in /opt/lampp/htdocs/ezypayzy/cronjob.php on line 2.But when i run this script on browser it is working fine.i dont know how to solve this.</p>
  
  <p>Command for php script:php /opt/lampp/htdocs/ezypayzy/cronjob.php</p>
  
  <p><strong>Second error</strong>:
  when i run a cronjob command on terminal it shows me this error</p>
  
  <pre><code>bash: */2: No such file or directory
  </code></pre>
  
  <p>Cronjob command:<code>*/2 * * * * /usr/local/bin/php</code> /opt/lampp/htdocs/ezypayzy/cronjob.php</p>