Perl script use CGI to generate html with echarts.js. Error information like below:
[Fri Aug 25 10:07:17.488252 2023] [cgi:error] [pid xx] [client xxxx] AH01215: (8)Exec format error: exec of '/cgi-bin/echarts.js' failed, referer: http://xxxx/cgi-bin/jindl_test.pl
[Fri Aug 25 10:07:17.488731 2023] [cgi:error] [pid xx] [client xxxx] End of script output before headers: echarts.js, referer: http://xxxx/cgi-bin/jindl_test.pl
Script code like below:
#!/usr/local/bin/perl5 -w
print "Content-type: text/html\n\n";
use CGI qw(:standard);
use CGI qw(:cgi);
print "<html>\n";
print "<head>\n";
print "<title>test</title>\n";
print "<script src=\"echarts.js\"></script>\n";
print "</head>\n";
print "<body>\n";
print "<div id=\"main\" style=\"width: 600px;height:400px;\"></div>\n";
print "<script type=\"text/javascript\">";
print "var myChart = echarts.init(document.getElementById('main'));\n";
print "var option = {\n";
print "title: {text: 'Demo'},\n";
print "tooltip: {},\n";
print "xAxis: {data: ['Shirts', 'Cardigans', 'Chiffons', 'Pants', 'Heels', 'Socks']},\n";
print "yAxis: {type: 'value'},\n";
print "series: [\n";
print "{name: 'sales', data: [120, 200, 150, 120], type: 'line'},\n";
print "{name: 'values', data: [100, 300, 250, 100], type: 'line' }\n";
print "],\n";
print "legend: {data: ['sales','values']}\n";
print "};\n";
print "myChart.setOption(option);\n";
print "</script>\n";
print "</body></html>\n";
There are two scripts exist. One is "echarts.js" and another one is above perl script. And as script shows that echarts.js is involved into perl script. (print "<script src="echarts.js"> </script>\n";)
Is there anything not suitable in this script?
The web server is configured to treat everything in cgi-bin
as a program to execute. echarts.js
is not a program to execute, so you need to place it elsewhere.