J'ai un script perl dans/var/cgi-bin qui exécute normalement avec l'url:perl/script cgi erreur introuvable 404 apache2
localhost/cgi-bin/filename.pl
mais lorsque j'appelle le même fichier via un fichier html, le serveur loaclhost renvoie une erreur 404 not found.
code: fichier html:
<?xml version="1.0"encoding="utf-8"?>
<html>
<head>
<title>light bulbsr form</title>
</head>
<body>
<form action="/cgi-bin/bulbs.pl" method="POST">
user name<input type="text" name="myname" size="30"/><br>
select the items:<br>
<input type="checkbox" name="b" value="2.39" /> four100 watt light bulbs </br>
<input type="checkbox" name="b" value="4.29"> eight 100 watt light bulbs </br>
<input type="checkbox" name="b" value="3.95"> four 100 watt long life bulbs </br>
<input type="checkbox" name="b" value="7.49"> eight100 watt long life bulbs </br>
Select the mode of the payment:</br>
<input type ="radio" name="paymode" value="visa" checked="checked"/>Visa<br>
<input type ="radio" name="paymode" value="Master card"/>Master card<br>
<input type ="radio" name="paymode" value="Discover"/>Discover<br>
<input type="submit" value="submit order"/>
<input type="reset" value="Clear the form"/>
</body>
</html>
fichier perl:
#!/usr/bin/perl
use CGI qw(:standard);
use strict;
print header(),start_html ("Bill ");
print p("The total cost:0");br();
print end_html;
la apache2 000 default.conf:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html
ScriptAlias /cgi-bin/ /var/cgi-bin/
<Directory "/var/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Quelle est l'URL du document HTML? Vous avez probablement besoin de 'cgi-bin/filename.pl' ou'/cgi-bin/filename.pl' car votre fichier HTML ne se trouve pas dans le répertoire 'cgi-bin'. – simbabque
J'espère que c'est un exercice d'apprentissage. Vous n'allez pas chercher les numéros de cartes de crédit avec ça, n'est-ce pas? – simbabque
Oui, c'est un exercice d'apprentissage. Plz aide !! –