My perl code has a error on the first line #!/usr/bin/perl when deploying on linux server. But it work properly in my local b/c I used this line #!C:\xampp\perl\bin\perl.exe.
Ah I have solved this problem by enable mod cgi in my web server. In my case I use apache2 so I added some configs like:
Explicitly using Options to permit CGI execution
You could explicitly use the Options directive, inside your main server configuration file, to specify that CGI execution was permitted in a particular directory:
The above directive tells Apache to permit the execution of CGI files. You will also need to tell the server what files are CGI files. The following AddHandler directive tells the server to treat all files with the cgi or pl extension as CGI programs:
AddHandler cgi-script .cgi .pl
After that load cgi module:
a2enmod cgi
Restart my apache server. It worked!
If you use another web server like nginx you can find some way to enable cgi in your config file.
Ah I have solved this problem by enable mod cgi in my web server. In my case I use apache2 so I added some configs like:
Explicitly using Options to permit CGI execution You could explicitly use the Options directive, inside your main server configuration file, to specify that CGI execution was permitted in a particular directory:
<Directory "/var/www/mypro"> Options ExecCGI </Directory>
The above directive tells Apache to permit the execution of CGI files. You will also need to tell the server what files are CGI files. The following AddHandler directive tells the server to treat all files with the cgi or pl extension as CGI programs:
AddHandler cgi-script .cgi .pl
After that load cgi module:
a2enmod cgi
Restart my apache server. It worked! If you use another web server like nginx you can find some way to enable cgi in your config file.