Common Gateway Interface (CGI) is a standard way for web servers to interface with executable programs. If your application makes use of it, then you can enable CGI script execution by completing the following steps.

Enable CGI Scripts Execution on Your Cloudways Server

Step 1: Launch SSH terminal from Your Cloudways Console

SSH Terminal is available in the Master Credentials section under the Server Management area.

Step 2: Edit Your .htaccess File

Now edit your .htaccess file as shown in the figure below.

  1. Use vim .htaccess command

  2. Now press i to start editing. Copy and paste the following code in your .htaccess file.

Options +ExecCGI
AddHandler cgi-script .cgi .pl

To save the changes, press Esc then :wq and then press Enter. It is now complete, and you can test your script.

Before executing the script, ensure that it has execution privileges. If you have not provided it yet, then use the code mentioned below.

chmod 775 scriptname

That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.

Did this answer your question?