{"id":3226,"date":"2025-07-04T10:43:07","date_gmt":"2025-07-04T05:13:07","guid":{"rendered":"https:\/\/www.nettigritty.com\/kb\/?p=3226"},"modified":"2025-07-04T10:45:00","modified_gmt":"2025-07-04T05:15:00","slug":"how-to-run-perl-scripts-on-cpanel-shared-hosting","status":"publish","type":"post","link":"https:\/\/www.nettigritty.com\/kb\/cpanel\/how-to-run-perl-scripts-on-cpanel-shared-hosting\/","title":{"rendered":"How to run perl scripts on cPanel Shared Hosting"},"content":{"rendered":"<p>To run Perl scripts on cPanel shared hosting, follow these steps:<\/p>\n<hr \/>\n<h3><strong>1. Ensure Perl is Supported<\/strong><\/h3>\n<p>Most cPanel-based shared hosting environments <strong>do support Perl<\/strong>, but it&#8217;s good to confirm with your host or check cPanel&#8217;s <strong>Software<\/strong> section for <strong>&#8220;Perl Modules&#8221;<\/strong>.<\/p>\n<hr \/>\n<h3><strong>2. Upload Your Perl Script<\/strong><\/h3>\n<ol>\n<li>Log in to <strong>cPanel<\/strong>.<\/li>\n<li>Go to <strong>File Manager<\/strong>.<\/li>\n<li>Upload your Perl script (e.g., <code>script.pl<\/code> or <code>script.cgi<\/code>) to the <strong><code>public_html\/cgi-bin\/<\/code><\/strong> directory.\n<ul>\n<li>If <code>cgi-bin<\/code> does not exist, create it inside <code>public_html<\/code>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>3. Set Correct Permissions<\/strong><\/h3>\n<p>After uploading:<\/p>\n<ol>\n<li>Right-click the Perl script in File Manager &gt; <strong>Permissions<\/strong>.<\/li>\n<li>Set permissions to <strong>755<\/strong> (rwxr-xr-x) so it can execute.<\/li>\n<\/ol>\n<hr \/>\n<h3><strong>4. Add Shebang Line<\/strong><\/h3>\n<p>Ensure your Perl script starts with the correct shebang line. Most shared servers use:<\/p>\n<pre><code class=\"language-perl\">#!\/usr\/bin\/perl\r\n<\/code><\/pre>\n<p>Put this on <strong>the first line<\/strong> of your script.<\/p>\n<hr \/>\n<h3><strong>5. Test in Browser<\/strong><\/h3>\n<p>Access your script in the browser:<\/p>\n<pre><code>https:\/\/yourdomain.com\/cgi-bin\/script.pl\r\n<\/code><\/pre>\n<p>If it&#8217;s working, you should see the script&#8217;s output.<\/p>\n<hr \/>\n<h3><strong>6. Use CGI Headers<\/strong><\/h3>\n<p>Perl scripts that produce output for the browser need to send proper headers. For example:<\/p>\n<pre><code class=\"language-perl\">#!\/usr\/bin\/perl\r\nprint \"Content-type: text\/html\\n\\n\";\r\nprint \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Hello from Perl!&lt;\/h1&gt;&lt;\/body&gt;&lt;\/html&gt;\";\r\n<\/code><\/pre>\n<hr \/>\n<h3><strong>7. Check Errors<\/strong><\/h3>\n<p>If it doesn&#8217;t work:<\/p>\n<ul>\n<li>Check <code>error_log<\/code> inside the <code>cgi-bin<\/code> folder or global Apache error logs via <strong>cPanel &gt; Metrics &gt; Errors<\/strong>.<\/li>\n<li>Common issues:\n<ul>\n<li>Wrong shebang line<\/li>\n<li>File not executable (permissions)<\/li>\n<li>Missing required Perl modules<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>8. Install Perl Modules (if needed)<\/strong><\/h3>\n<p>Use <strong>cPanel &gt; Perl Modules<\/strong> to search for and install required modules if your script needs any.<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To run Perl scripts on cPanel shared hosting, follow these steps: 1. Ensure Perl is Supported Most cPanel-based shared hosting environments do support Perl, but it&#8217;s good to confirm with your host or check cPanel&#8217;s Software section for &#8220;Perl Modules&#8221;. 2. Upload Your Perl Script Log in to cPanel. Go to File Manager. Upload your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3226","post","type-post","status-publish","format-standard","hentry","category-cpanel"],"_links":{"self":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts\/3226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/comments?post=3226"}],"version-history":[{"count":2,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts\/3226\/revisions"}],"predecessor-version":[{"id":3228,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts\/3226\/revisions\/3228"}],"wp:attachment":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/media?parent=3226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/categories?post=3226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/tags?post=3226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}