Toon posts:

[apache + cgi] configuratie

Pagina: 1
Acties:

Verwijderd

Topicstarter
ik ben bezig cgi te configureren voor apache. ik heb het een en ander gedaan, maar het wil maar niet werken. ik heb de extensie .cgi uncommented in httpd.conf, de addhandler goed gezet ende options van verschilende directories op execcgi gezet. hierbij heb ik de volgende threads op got en inet pagina's gebruikt:

[rml][ mdk82]Apache + cgi[/rml]
Apache/linux geen .cgi maar wel .pl????
http://www.visca.com/clueless/perl_apache_win9x.html


maar toch blijf ik een 500 krijgen als ik een cgi pagina oproep (bijv http://stevy99.sytes.net/cgi-bin/perl_test.cgi ). heeft iemand enig idee wat ik over het hoofd zie?

  • PowerSp00n
  • Registratie: Februari 2002
  • Laatst online: 15-05 12:25

PowerSp00n

There is no spoon

Kijk eens in je error log. Hier zal wel meer informatie te vinden zijn over wat er fout gaat.

Verwijderd

Topicstarter
er zijn 2 verschillende errors in httpd-error.log:

1. Script not found or enable to stat /usr/local/www/cgi-bin/perl_test.cgi

2. Premature end of scipt headers: perl_test.cgi

als de pagina geladen wordt krijg je niet allebei de errors in de logfile te zien. dus dit is het gevolg van de configuratie verandereringen die ik heb toegepast. ze komen ook allebei tegen het einde voor, dus ze zijn allebei nog aandwezig

  • odysseus
  • Registratie: Augustus 2000
  • Laatst online: 11:40

odysseus

Debian GNU/Linux Sid

Zou je (het relevante deel van) je httpd.conf eens kunnen posten? Vermoedelijk ben je toch ergens iets vergeten. Ik neem aan dat dat script wel executable is en zo? En zou je ook de letterlijke foutmelding in je logs kunnen geven (de laatste pagina of zo)? Dat geeft wat meer houvast dan een samenvatting van de meldingen :).

Leven is het meervoud van lef | In order to make an apple pie from scratch, you must first create the universe.


Verwijderd

Topicstarter
ok httpd.conf:

*knip*
ScriptAlias /cgi-bin/ "usr/local/www/cgi-bin/"

<Directory "/usr/local/www/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

*knip*

AddHandler cgi-script .cgi

de error log alle erros van vandaag:

[Sat Oct 05 03:49:27 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 03:57:43 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 03:57:44 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 03:58:26 2002] [error] [client 10.0.0.157] Premature end of script headers: test-cgi
[Sat Oct 05 03:58:52 2002] [error] [client 10.0.0.157] File does not exist: /usr/local/www/data/stevy99
[Sat Oct 05 03:59:03 2002] [error] [client 10.0.0.157] File does not exist: /home/stevy99/www/cgi-bin
[Sat Oct 05 03:59:17 2002] [error] [client 10.0.0.157] Options ExecCGI is off in this directory: /home/stevy99/www/perl_test.cgi
[Sat Oct 05 03:59:51 2002] [error] [client 10.0.0.157] File does not exist: /home/stevy99/www/cgi-bin
[Sat Oct 05 03:59:53 2002] [error] [client 10.0.0.157] File does not exist: /usr/local/www/data/stevy99
[Sat Oct 05 03:59:56 2002] [error] [client 10.0.0.157] Premature end of script headers: test-cgi
[Sat Oct 05 03:59:57 2002] [error] [client 10.0.0.157] Premature end of script headers: test-cgi
[Sat Oct 05 04:00:15 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:00:18 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:05:38 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 04:05:40 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 04:06:41 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:07:52 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:29:41 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 04:29:42 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 04:29:56 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:33:32 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:33:37 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:35:24 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 04:35:26 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 04:36:03 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:40:11 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:41:55 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:48:18 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 04:48:20 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 04:48:35 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.cgi
[Sat Oct 05 04:48:57 2002] [error] [client 10.0.0.157] script not found or unable to stat: /usr/local/www/cgi-bin/perl_test.pl
[Sat Oct 05 04:49:12 2002] [error] [client 10.0.0.157] script not found or unable to stat: /usr/local/www/cgi-bin/test-cgi.pl
[Sat Oct 05 04:49:20 2002] [error] [client 10.0.0.157] Premature end of script headers: test-cgi
[Sat Oct 05 04:50:13 2002] [error] [client 10.0.0.157] script not found or unable to stat: /usr/local/www/cgi-bin/test-cgi.pl
[Sat Oct 05 04:50:23 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.pl
[Sat Oct 05 05:09:48 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 05:09:49 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 05:10:01 2002] [error] [client 10.0.0.157] script not found or unable to stat: /usr/local/www/cgi-bin/perl_test.cgi
[Sat Oct 05 05:10:10 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.pl
[Sat Oct 05 05:13:10 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 05:13:12 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Sat Oct 05 05:13:19 2002] [error] [client 10.0.0.157] Premature end of script headers: perl_test.pl
[Sat Oct 05 05:17:46 2002] [error] [client 10.0.0.157] script not found or unable to stat: /usr/local/www/cgi-bin/perl_test.cgi
[Sat Oct 05 05:34:00 2002] [notice] SIGHUP received. Attempting to restart
[Sat Oct 05 05:34:01 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations

  • Boomerang
  • Registratie: November 2000
  • Niet online
Waarschijnlijk gewoon permissies goed zetten, ik quote een stukje dat ik met google heb gevonden...
What does the 'premature end of script headers' error mean?
99% of the time, this is caused by improper permission settings. Make sure you have the proper permissions set on your script (CHMOD 755).

You should also make sure that you are using a text-only editor such as Notepad or UltraEdit to edit your scripts (on a PC) or SimpleText or BBEdit (on a Mac).

Also be sure to also upload your scripts in ASCII and not binary. Failure to do so will result in your files not executing properly.
owja, bron :)

Succes.

Verwijderd

Topicstarter
bij de desbetreffende perl file werkt het chmodden niet. bij de test file die standaard in de cgi-bin directory zit wel (http://stevy99.sytes.net/cgi-bin/test-cgi). zou het kunnen dat het probleem in perl zit? de pagina is de test pagina van ikonboard, dat zou allerlei info moeten geven, maar die doet het dus niet.

  • odysseus
  • Registratie: Augustus 2000
  • Laatst online: 11:40

odysseus

Debian GNU/Linux Sid

Als je het volgende bestand in je cgi-bin/ zet, werkt het dan wel of niet? Wat is de fout in je logbestand? Vergeet het bestand niet te chmodden (en geef niet alleen jezelf executable-rechten, maar juist de Apache-gebruiker!)
code:
1
2
3
4
#!/usr/bin/perl
use CGI::Carp qw(:fatalsToBrowser);
use CGI;
print header(), start_html(), "test", end_html();


[edit]
Oh, ik dacht dat er helemaal niets werkte...als dat ene test-bestand al werkt, dan is bovenstaande weinig nuttig. Probeer het script dat je wilt uitvoeren eens te compileren vanaf de commandline (met perl -w).

Leven is het meervoud van lef | In order to make an apple pie from scratch, you must first create the universe.


Verwijderd

Topicstarter
ik heb het in een test file gezet en geprobeerd te compileren. ik kreeg de volgende output:

":fatalsToBrowser" is not exported by the CGI::Carp module at test line 2
[Sun Nov 10 17:29:22 2002] test: Can't continue after import errors at test line 2
[Sun Nov 10 17:29:22 2002] test: BEGIN failed--compilation aborted at test line 2.

Verwijderd

Topicstarter
en als ik de : voor de fatalsToBrowser weg haal komt de volgende:

Content-type: text/html

<H1>Software error:</H1>
<CODE>Undefined subroutine &main::header called at test line 4.
</CODE>
<P>
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

[Sun Nov 10 17:37:48 2002] test: Undefined subroutine &main::header called at test line 4.

  • odysseus
  • Registratie: Augustus 2000
  • Laatst online: 11:40

odysseus

Debian GNU/Linux Sid

Stom van me...die dubbele punt voor 'fatalsToBrowser' mag weg. Maar eigenlijk bedoelde ik in mijn edit dat je het script dat nu niet wil draaien maar dat je wel graag wilt draaien eens door de commandline-compiler haalt :).

Leven is het meervoud van lef | In order to make an apple pie from scratch, you must first create the universe.


Verwijderd

Topicstarter
oh bedoelde je het zo :)

dan wordt het script goed uitgevoerd. de pagina komt er kant en klaar en met de juiste gegevens uitrollen. dus er is iets mis in de communicatie tussen perl en cgi?

  • odysseus
  • Registratie: Augustus 2000
  • Laatst online: 11:40

odysseus

Debian GNU/Linux Sid

Ja, blijkbaar roept Apache de perl-interpreter niet aan, om wat voor reden dan ook. De meest-voorkomende reden is een rechtenprobleem en daar lijkt het hier ook op, aangezien een ander script wel werkt. Kun je eens de uitvoer van 'ls -hla /mijn/script/dat/niet/werkt' posten?

Leven is het meervoud van lef | In order to make an apple pie from scratch, you must first create the universe.


Verwijderd

Topicstarter
-rwxr-xr-x 1 root root 2.4k Nov 10 16:54 /usr/local/www/cgi-bin/perl_test.cgi

  • odysseus
  • Registratie: Augustus 2000
  • Laatst online: 11:40

odysseus

Debian GNU/Linux Sid

Dus even op een rijtje:
• Je Perl werkt, want kan scripts compileren
• Het script is goed, want kan worden gecompileerd
• Je Apache is goed, want kan andere scripts wel uitvoeren

Klopt dat allemaal? Zo ja, dan zie ik - als de wel-werkende scripts in dezelfde directory staan en op dezelfde manier worden aangeroepen - eigenlijk geen reden waarom het fout kan gaan...je krijgt nog steeds de 'cannot stat blabla.cgi'-melding in je logs?

Leven is het meervoud van lef | In order to make an apple pie from scratch, you must first create the universe.


Verwijderd

Topicstarter
yes dat klopt allemaal.

ja de error blijft hetzelfde. ik denk dat er iets in die file staat wat niet goed uitgelezen kan worden ofzo. tis nie anders. cgi werkt iig, perl ook. ik laat het ff rusten. wie weet dat ik vandeweek ineens zie wat er fout gaat. iig heel erg bedankt voor de hulp/moeite!!!

mocht iemand nog sugesties hebben hou ik me natuurlijk aanbevolen :)

Verwijderd

Mij is het wel eens overkomen dat ik een cgi-scriptje in windows notepad had bewerkt, en dat het daarna met geen mogelijkheid meer wilde werken. Toen ik ben ik er met Pico even door heen gewandeld en wat wijzigingen aangebracht (entertje hier, entertje daar, wordwrap goedzetten) en het werkte weer. Windows vern*&@kt de enters in een script. Zelfde geldt als je je het ftp'd. Opletten welke mode.

  • Gilles
  • Registratie: Februari 2000
  • Laatst online: 28-07-2025
Staan de rechten van je cgi-bin directory wel goed?

Verwijderd

Topicstarter
ja de rechten staan goed. ook voor de desbetreffende files.

ik hoop straks die perl tesfile opnieuw te krijgen zodat ik hem ook ff als ascii kan uploaden. kijken hoe hij het dan doet.
Pagina: 1