Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

Perl or cgi script cannot be executed: 500 Internal Server Error

 
apachecentosdebiandomainsfastcgi

Symptoms

  • Perl or CGI script located inside of /var/www/vhosts/example.com/httpdocs/cgi-bin/ directory cannot be executed with the error:

    500 external Server Error

  • Apache error log /var/log/httpd/error_log or domain's error log /var/www/vhosts/system/example.com/logs/error_log contain one of the following errors:

    AH02811: script not found or unable to stat: /var/www/vhosts/example.com/cgi-bin

    [client 203.0.113.2:55719] End of script output before headers: script.pl

    [client 203.0.113.2:55719] End of script output before headers: script.cgi

  • The error below can be found in suexec.log:

    • on CentOS/RHEL-based distributions at: /var/log/httpd/suexec.log

    • on Debian/Ubuntu-based distributions at: /var/log/apache2/suexec.log

    uid: (10000/johndoe) gid: (1003/1003) cmd: script.pl
    target uid/gid (10000/1003 or 1002) mismatch with directory (10000/1003) or program (0/0)

Cause

Incorrect permissions are set for /var/www/vhosts/example.com/httpdocs/cgi-bin/script.pl file or entire /var/www/vhosts/example.com/httpdocs/cgi-bin/ directory.

Resolution

  1. Connect to the server using SSH

  2. Find the system user of the subscription example.com:

    # plesk db -Ne "select su.login from domains d, hosting h, sys_users su where d.id=h.dom_id and h.sys_user_id=su.id and d.name='example.com';"
    johndoe

  3. Set correct permissions and ownership for the directory and script with the system user obtained on the previous step:

    # chown -R johndoe:psacln /var/www/vhosts/example.com/httpdocs/cgi-bin

    # chmod ug+x /var/www/vhosts/example.com/httpdocs/cgi-bin/script.pl

    Note:script.pl should be changed to the real cgi or perl script name.

  4. Only if issue is not fixed, apply the following to restore default permissions for the domain:

    # plesk repair fs example.com

As a workaround: Make CGI scripts run out of cgi-bin folder

  1. Log into Plesk.

  2. Make sure that FastCGI or CGI PHP handler is selected in Domains > example.com > PHP settings.

  3. Add the following content both to additional HTTP and HTTPS Apache directives:

    SetHandler cgi-script .cgi .pl

  4. If the script still does not execute, in addition to the line from step 3, add the following content into additional HTTP and HTTPS Apache directives:

    <Directory "/var/www/vhosts/example.com">
    Options FollowSymLinks Includes ExecCGI
    </Directory>

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

Your Complete .htaccess Guide: Including .htaccess Basics and More

Read More »

NGINX vs Apache – Which Is the Best Web Server in 2024?

Read More »

PHP-FPM: The Future of PHP Handling

Read More »
Knowledge Base

Website or webmail shows 500 internal server error on Plesk: mod_fcgid: read data timeout

Read More »

How to allow access to a website directory from specific IP address in Plesk?

Read More »

Websites on Plesk server are slow or show error 500 or PHP mail cannot be sent: ap_pass_brigade failed

Read More »

Website on Plesk server is not accessible: 504 Gateway Time-out: The timeout specified has expired: [client 203.0.113.2:54693] AH01075: Error dispatching request to

Read More »

Hosting Wiki

  • Server Redundancy
  • CGI
  • Bare Metal Server
  • PhpMyAdmin
  • phpPgAdmin
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Linux
  • PHP
  • HTTP/3
  • HTTP/2
  • Domain
  • Hosting Control Panel
  • Plesk
  • Lighttpd
  • Apache Tomcat
  • Apache
  • Web Server
  • DNS Server
  • SSH
  • Colocation Hosting
  • Reseller Hosting
  • Cloud Hosting
  • VPS Hosting
  • Dedicated Hosting
  • Shared Hosting
  • Free Hosting
  • Managed Hosting
  • HTTP
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family