{"id":15720,"date":"2024-07-17T09:53:42","date_gmt":"2024-07-17T13:53:42","guid":{"rendered":"https:\/\/kb.n0c.com\/?post_type=ht_kb&#038;p=15720"},"modified":"2026-07-22T15:00:26","modified_gmt":"2026-07-22T19:00:26","slug":"cron-tasks-in-n0c-differences-between-wget-curl-and-php","status":"publish","type":"ht_kb","link":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/","title":{"rendered":"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP"},"content":{"rendered":"\n<p>This article is intended to help you differentiate between Wget client, Curl and PHP commands.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\"><strong>Note :<\/strong>&nbsp;Le&nbsp;<a href=\"https:\/\/kb.n0c.com\/en\/glossary\/\">glossaire<\/a>&nbsp;contient&nbsp; des explications sur de multiples sujets et peut \u00eatre consult\u00e9 pour clarifier certains termes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"main-differences\">Main Differences<\/h2>\n\n\n\n<p>To see the differences, let&#8217;s start by looking at the following four commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget -O - -q 'https:\/\/www.mysite.com\/modules\/cron.php?secure_key=ILOVEPH' --user-agent=\"Administrator\/CRON\" &gt; \/dev\/null 2&gt;&amp;1<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">curl --user-agent \"Administrator\" https:\/\/www.mysite.com\/modules\/cron.php<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">php -q \/home\/USERNAME\/public_html\/modules\/cron.php argument=valeur &gt;\/dev\/null 2&gt;&amp;1<\/pre>\n\n\n\n<p>The most important difference is that both Wget and Curl use the HTTP protocol. Therefore, Apache configurations or restrictions are added. The Apache timeout is a good example.<\/p>\n\n\n\n<p>However, when you run a Cron task in PHP, you don&#8217;t have this kind of limitation, because it is just like going through an SSH connection.<\/p>\n\n\n\n<p>So the most robust way to run a fairly large Cron task is to do it in PHP. Unlike Curl or Wget, the timeout of the web server will have no effect if your script has to run for a while.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"different-versions-of-php-and-cron-tasks\">Different Versions of PHP and Cron Tasks<\/h2>\n\n\n\n<p>If you leave the &#8220;php&#8221; command as is, the task will use the native\/recommended version defined in the control panel. If your script needs to use another version of PHP, you must specify this by giving the full path to PHP.&nbsp;<\/p>\n\n\n\n<p>For N0C, use this command, where XX must be replaced by the desired PHP version between php44, php51, php52, php53, php54, php55, php56, php70, php71, php72, php73, php74, and php80 :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/opt\/alt\/phpXX\/usr\/bin\/php<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"tips\">Tips<\/h2>\n\n\n\n<p>1-When you launch a Cron with the Curl or Wget command, you must absolutely specify a &#8220;user-agent&#8221; as in the example above. Otherwise, it is possible that your request is blocked at the server level because of the ModSecurity web application firewall.<\/p>\n\n\n\n<p>2- We also advise you not to run the script every minute. It is better to run it during the night.<\/p>\n\n\n\n<p>3- If you receive too many emails from Cron tasks, you can disable this notification by adding this at the end of your task:&nbsp;<strong> <code>&gt;\/dev\/null 2&gt;&amp;1<\/code><\/strong>.<\/p>\n\n\n\n<p>4- If you have &#8220;GET&#8221; arguments to give to your script, you should not separate the file argument with a &#8220;?&#8221;. You simply need to put a space.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is intended to help you differentiate between Wget client, Curl and PHP commands. Main Differences To see the differences, let&#8217;s start by looking at the following four commands: wget -O &#8211; -q &#8216;https:\/\/www.mysite.com\/modules\/cron.php?secure_key=ILOVEPH&#8217; &#8211;user-agent=&#8221;Administrator\/CRON&#8221; &gt; \/dev\/null 2&gt;&amp;1 curl &#8211;user-agent &#8220;Administrator&#8221; https:\/\/www.mysite.com\/modules\/cron.php php -q \/home\/USERNAME\/public_html\/modules\/cron.php argument=valeur &gt;\/dev\/null 2&gt;&amp;1 The&#8230;<\/p>\n","protected":false},"author":4,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[169],"ht-kb-tag":[215,188,429],"class_list":["post-15720","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-crons-en","ht_kb_tag-cron-tasks","ht_kb_tag-php-2","ht_kb_tag-wget-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP - N0C KB<\/title>\n<meta name=\"description\" content=\"This article is intended to help you differentiate between Wget client, Curl and PHP commands.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP - N0C KB\" \/>\n<meta property=\"og:description\" content=\"This article is intended to help you differentiate between Wget client, Curl and PHP commands.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/\" \/>\n<meta property=\"og:site_name\" content=\"N0C KB\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-22T19:00:26+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\\\/\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\\\/\",\"name\":\"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP - N0C KB\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/#website\"},\"datePublished\":\"2024-07-17T13:53:42+00:00\",\"dateModified\":\"2026-07-22T19:00:26+00:00\",\"description\":\"This article is intended to help you differentiate between Wget client, Curl and PHP commands.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/kb.n0c.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/#website\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/\",\"name\":\"N0C KB\",\"description\":\"Official documentation of the N0C hosting platform\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kb.n0c.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP - N0C KB","description":"This article is intended to help you differentiate between Wget client, Curl and PHP commands.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/","og_locale":"en_US","og_type":"article","og_title":"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP - N0C KB","og_description":"This article is intended to help you differentiate between Wget client, Curl and PHP commands.","og_url":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/","og_site_name":"N0C KB","article_modified_time":"2026-07-22T19:00:26+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/","url":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/","name":"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP - N0C KB","isPartOf":{"@id":"https:\/\/kb.n0c.com\/#website"},"datePublished":"2024-07-17T13:53:42+00:00","dateModified":"2026-07-22T19:00:26+00:00","description":"This article is intended to help you differentiate between Wget client, Curl and PHP commands.","breadcrumb":{"@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/cron-tasks-in-n0c-differences-between-wget-curl-and-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/kb.n0c.com\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/kb.n0c.com\/en\/knowledge-base\/"},{"@type":"ListItem","position":3,"name":"CRON Tasks in N0C \u2014 Differences between Wget, Curl and PHP"}]},{"@type":"WebSite","@id":"https:\/\/kb.n0c.com\/#website","url":"https:\/\/kb.n0c.com\/","name":"N0C KB","description":"Official documentation of the N0C hosting platform","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kb.n0c.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/15720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/comments?post=15720"}],"version-history":[{"count":3,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/15720\/revisions"}],"predecessor-version":[{"id":23497,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/15720\/revisions\/23497"}],"wp:attachment":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/media?parent=15720"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb-category?post=15720"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=15720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}