Difference of .cgi and .pl

What is the difference between cgi and perl?

Most of the programmers were having confusion with .cgi and .pl.
Since the file with .cgi extension is using the perl code and it is running fine.
But the file with .pl extension which contains the perl code does not run.

Here is the answer for you

File extensions are generally meaningless. Windows preserves a map between programs and the file extensions which should be accustomed to open them. Apache, a web server which performs something similar like windows. CGI is an interface approved upon by rfc 3875 which is mainly used for passing information from web requests to executables. CGI has capable of bypassing data to several types of executable which can recognize it. Your .cgi files are possibly parsed for #! line which is responsible for mapping your exact .cgi file to be executed by Perl. Briefly, file extensions are virtually meaningless.

The extension simply notifies the server about how to handle it. cgi extensions tell it to run the script with whatsoever program is programmed at the top #! line. If the server is not notified to do the same with .pl files in that case it will not know what to do with it.

If you are lying on an apache server, adding up this line to the .htaccess file will make it parse .pl files through CGI
AddHandler cgi-script .pl

Tags:

Request a Free SEO Quote