Antes que nada, sé que hay muchísimos temas
Threads sobre este tema abiertos, creo haber leído todos pero no pude solucionar mi problema.
El tema es que soy muy nuevo en esto y quiero aprender a programar con Perl sobre HTML.
Si creen conveniente eliminar este
thread debido a que hay muchísimos similares o moverlo lo entenderé...
Tengo instalado Apache2 y quiero ejecutar un
script, utilicé entre otros el que dan como ejemplo básico.
Using perl Syntax Highlighting
#!/usr/bin/perl
# CGI MINIMO
# Joaquin Ferrero. 2006.
# Este cgi sirve para comprobar si el servidor funciona con Perl+CGI
#
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
print
header,
start_html('CGI MINIMO'),
h1('CGI MINIMO'),
hr,
p("Si ves este texto es que SI esta funcionando bien"),
hr;
# Aqui sacamos la lista de los parametros
# en caso de que le haya sido pasado alguno
my @parametros = param();
foreach my $par ( @parametros ) {
print p($par);
print blockquote(param( $par ));
}
print end_html;
En el archivo apache2.conf agregué estas líneas al final.
Código:
# Agregamos las siguientes líneas al final del archivo
AddHandler cgi-script .cgi
<Files ~ “\.pl$”>
Options +ExecCGI
</Files>
<Files ~ “\.cgi$”>
Options +ExecCGI
</Files>
#AGREGUE DIRECTORIO PARA CGI ELIMINAR SI NO HACE NADA
<Directory "/var/www/cgi-bin">
AllowOverride None
Options Indexes Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
Copié el archivo ejemplo.pl en dos lugares y le dí todos los permisos, lo puse en /usr/lib/cgi-bin y en /var/www/cgi-bin.
Lo intenté ejecutar en el navegador (Opera y FireFox 3) desde
http://127.0.0.1/cgi-bin/ejemplo.plY me tira el siguiente error...
Código:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0 Server at 127.0.0.1 Port 80
En el archivo error.log las últimas entradas que aparecen son:
Código:
[Wed Dec 31 18:17:10 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/lib/cgi-bin/
[Wed Dec 31 18:17:18 2008] [error] [client 127.0.0.1] (13)Permission denied: exec of '/usr/lib/cgi-bin/ejemplo.pl' failed
[Wed Dec 31 18:17:18 2008] [error] [client 127.0.0.1] Premature end of script headers: ejemplo.pl
[Wed Dec 31 18:19:47 2008] [error] [client 127.0.0.1] (13)Permission denied: exec of '/usr/lib/cgi-bin/basico.pl' failed
[Wed Dec 31 18:19:47 2008] [error] [client 127.0.0.1] Premature end of script headers: basico.pl
[Wed Dec 31 18:19:52 2008] [error] [client 127.0.0.1] script not found or unable to stat: /usr/lib/cgi-bin/basicao.pl
[Wed Dec 31 18:19:56 2008] [error] [client 127.0.0.1] (13)Permission denied: exec of '/usr/lib/cgi-bin/basico.pl' failed
[Wed Dec 31 18:19:56 2008] [error] [client 127.0.0.1] Premature end of script headers: basico.pl
[Wed Dec 31 18:26:48 2008] [error] [client 127.0.0.1] (13)Permission denied: exec of '/usr/lib/cgi-bin/ejemplo.pl' failed
[Wed Dec 31 18:26:48 2008] [error] [client 127.0.0.1] Premature end of script headers: ejemplo.pl
[Wed Dec 31 18:28:39 2008] [error] [client 127.0.0.1] script not found or unable to stat: /usr/lib/cgi-bin/ejemploHTML.html
[Wed Dec 31 18:29:42 2008] [error] [client 127.0.0.1] File does not exist: /var/www/ejemploHTML.html
Por favor, ¿alguien me podría ayudar? Espero ansiosamente cualquier respuesta...
Gracias por su tiempo.