{"id":10936,"date":"2025-01-17T09:06:07","date_gmt":"2025-01-17T09:06:07","guid":{"rendered":"https:\/\/www.trustedhosting.in\/blog\/?p=10936"},"modified":"2025-01-17T09:06:07","modified_gmt":"2025-01-17T09:06:07","slug":"how-to-move-the-crons-directory-in-whmcs","status":"publish","type":"post","link":"https:\/\/www.webystrata.com\/blog\/how-to-move-the-crons-directory-in-whmcs\/","title":{"rendered":"How to Move the Crons Directory in WHMCS"},"content":{"rendered":"<figure id=\"attachment_10939\" aria-describedby=\"caption-attachment-10939\" style=\"width: 2560px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.trustedhosting.in\/cpanel-hosting.html\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10939 size-full\" title=\"How to Move the Crons Directory in WHMCS\" src=\"https:\/\/www.trustedhosting.in\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-scaled.jpg\" alt=\"How to Move the Crons Directory in WHMCS\" width=\"2560\" height=\"2107\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-scaled.jpg 2560w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-300x247.jpg 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-1024x843.jpg 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-768x632.jpg 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-1536x1264.jpg 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/5674591_53529-1-2048x1686.jpg 2048w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/a><figcaption id=\"caption-attachment-10939\" class=\"wp-caption-text\">\u00a0<\/figcaption><\/figure>\n<h1>How to Move the Crons Directory in WHMCS<\/h1>\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_bda1e2ed-e7f7-4405-af25-297ed2debdaf\" class=\"text-block-content\">\n<p>We recommend moving the\u00a0<code>crons<\/code>\u00a0directory to a private directory above your web root. This will prevent web-based access and help to protect your WHMCS installation.<\/p>\n<p>To do this, you must move the directory\u00a0<strong>and<\/strong> update WHMCS&#8217;s configuration to use it successfully.<\/p>\n<\/div>\n<\/div>\n<div class=\"step step-depth-1\" data-step-uuid=\"983fba6b-1248-43c6-a76d-acc01f029ee2\">\n<h2 id=\"moving-the-crons-directory\" tabindex=\"0\">Moving the crons Directory<\/h2>\n<div class=\"instructions screensteps-textblock screensteps-wrapper--tip screensteps-wrapper\" tabindex=\"0\" role=\"status\" aria-label=\"tip\">\n<div id=\"text-content_c3c3b7f9-ff52-4773-ab25-be17328ff05d\" class=\"text-block-content\">\n<blockquote><p>This process involves editing multiple configuration files. You can do this using the file management tools in your hosting control panel (for example,\u00a0<strong>Files &gt;&gt; File Manager<\/strong>\u00a0in cPanel) or using the command line.<\/p><\/blockquote>\n<\/div>\n<\/div>\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_e7dcfed5-9b3f-4fec-b755-0c6e3ca74744\" class=\"text-block-content\">\n<p>To move the directory and update WHMCS&#8217;s configuration:<\/p>\n<p>1. Move the entire\u00a0<code>\/crons\/<\/code>\u00a0directory and its contents to the new location.<\/p>\n<p>2. If you have already configured\u00a0<a href=\"https:\/\/docs.whmcs.com\/Cron_Tasks\" target=\"_blank\" rel=\"noopener\">cron tasks<\/a>\u00a0or\u00a0<a href=\"https:\/\/docs.whmcs.com\/Email_Piping#Forwarder_Method\" target=\"_blank\" rel=\"noopener\">email forwarders<\/a>., update them to use the new directory path.<\/p>\n<p>3. If you have not already done so, rename the\u00a0<code>config.php.new<\/code>\u00a0file to\u00a0<code>config.php<\/code>.<\/p>\n<p>4. Open the\u00a0<code>config.php<\/code>\u00a0file and locate the\u00a0<code>$whmcspath<\/code>\u00a0line.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10937\" src=\"https:\/\/www.trustedhosting.in\/blog\/wp-content\/uploads\/2025\/01\/eeba25ca-8a69-4515-8068-f38baa99ce35.png\" alt=\"\" width=\"627\" height=\"296\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/eeba25ca-8a69-4515-8068-f38baa99ce35.png 627w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/eeba25ca-8a69-4515-8068-f38baa99ce35-300x142.png 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_0d3cccf0-61fe-4a23-a8e7-e9445061d5e9\" class=\"text-block-content\">\n<p>5. Delete the two\u00a0<code>\/<\/code>\u00a0characters at the beginning of the line and replace\u00a0<code>\/path\/to\/whmcs\/<\/code>\u00a0with the full path to your installation. For example:<\/p>\n<\/div>\n<\/div>\n<div class=\"code-block copy-clipboard--parent\">\n<pre id=\"code-content_f117fd16-cd7f-4380-ab56-59a4083b5626\" tabindex=\"0\"><code>$whmcspath = '\/home\/username\/public_html\/whmcs\/';<\/code><\/pre>\n<div class=\"copy-clipboard copy-clipboard--tt-right\">6. Save and close the file.<\/div>\n<\/div>\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_96dda4d2-59e3-4c34-9f6b-90401423d2f9\" class=\"text-block-content\">\n<p>7. Open the\u00a0<code>configuration.php<\/code><em>\u00a0<\/em>file in your WHMCS installation root directory.<\/p>\n<p>8. Add the following line to the bottom of the file, where\u00a0<code>\/home\/username\/whmcs_crons\/<\/code>\u00a0is the location of your new directory:<\/p>\n<\/div>\n<\/div>\n<div class=\"code-block copy-clipboard--parent\">\n<pre id=\"code-content_41cfbbfb-4775-4f4a-b595-0261c86209f8\" tabindex=\"0\"><code>$crons_dir = '\/home\/username\/whmcs_crons\/';<\/code><\/pre>\n<div class=\"copy-clipboard copy-clipboard--tt-right\">9. Update the cron job to use the new directory path. For example, you can use the steps below to update the cron job in cPanel:<\/div>\n<\/div>\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_85efe98b-7987-46c3-8b25-6770dc9ad3ff\" class=\"text-block-content\">\n<p>a. In the cPanel interface, go to\u00a0<strong>Advanced &gt;&gt; Cron Jobs<\/strong>.<\/p>\n<p>b. Choose\u00a0<strong>Edit<\/strong>\u00a0for the existing cron job for the\u00a0<code>cron.php<\/code>\u00a0file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10938\" src=\"https:\/\/www.trustedhosting.in\/blog\/wp-content\/uploads\/2025\/01\/485cc3ed-4cbd-4729-b4ae-3116266fe7fe.png\" alt=\"\" width=\"777\" height=\"73\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/485cc3ed-4cbd-4729-b4ae-3116266fe7fe.png 777w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/485cc3ed-4cbd-4729-b4ae-3116266fe7fe-300x28.png 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2025\/01\/485cc3ed-4cbd-4729-b4ae-3116266fe7fe-768x72.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/p>\n<div class=\"step step-depth-1\" data-step-uuid=\"983fba6b-1248-43c6-a76d-acc01f029ee2\">\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_54a84fe4-e5c1-4fe9-a27e-c79ab27fc633\" class=\"text-block-content\">\n<p>c. Update the command to use the correct new path.<\/p>\n<p>d. Click\u00a0<strong>Edit Line<\/strong>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"step step-depth-1\" data-step-uuid=\"1c593255-e2c2-4740-b52c-c2dcac9c93ea\">\n<h2 id=\"custom-crons-locations-and-upgrades\" tabindex=\"0\">Custom crons Locations and Upgrades<\/h2>\n<div class=\"instructions screensteps-textblock\" tabindex=\"0\">\n<div id=\"text-content_ca90cd6d-4f1e-483f-b565-61da0ca8ee17\" class=\"text-block-content\">\n<p>Applying updates or patches after customizing your\u00a0<code>crons<\/code>\u00a0directory location requires an additional step. You\u00a0<strong>must<\/strong>\u00a0upload any updated\u00a0<code>crons<\/code>\u00a0files from the default location to your custom directory.<\/p>\n<p>If you do not move the files, you will see errors and issues with WHMCS&#8217;s automation.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Move the Crons Directory in WHMCS We recommend moving the\u00a0crons\u00a0directory to a private directory above your web root.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":10939,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-whmcs"],"_links":{"self":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts\/10936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/comments?post=10936"}],"version-history":[{"count":1,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts\/10936\/revisions"}],"predecessor-version":[{"id":10940,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts\/10936\/revisions\/10940"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/media\/10939"}],"wp:attachment":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/media?parent=10936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/categories?post=10936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/tags?post=10936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}