Avatar billede nemezis2you Nybegynder
10. juni 2000 - 19:05 Der er 11 kommentarer

PHP som cgi...

Jeg har et brugersystem, som kræver at php bliver kørt som cgi. Jeg bruger Apache, PHP3/4 og Windows 98:-(

Når jeg kører scriptet får jeg denne fejl:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, wex@wex.dk 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."

Min httpd.conf, ser sådan ud:
##############START
ServerType standalone
ServerRoot "C:/Apache"
PidFile logs/httpd.pid
ScoreBoardFile logs/apache.status
ResourceConfig conf/srm.conf
AccessConfig conf/access.conf
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 10
MaxSpareServers 50
StartServers 100
MaxClients 1000
MaxRequestsPerChild 0
Listen 80
Listen 198.168.100.1:80
BindAddress 198.168.100.1
Port 80
Listen 80
Listen 443
User nobody
Group nogroup
ServerAdmin root@something.com
ServerName 198.168.100.1
DocumentRoot "C:/Apache/htdocs"
<Directory />
Options FollowSymLinks ExecCGI
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:/Apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# UserDir public_html
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
# <Directory /home/*/public_html>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS PROPFIND>
# Order allow,deny
# Allow from all
# </Limit>
# <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
# Order deny,allow
# Deny from all
# </Limit>
# </Directory>
DirectoryIndex index.html index.htm index.phtml index.php index.php3 index.shtml
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
# UseCanonicalName On
TypesConfig conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel error
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
CustomLog logs/access.log common
ServerSignature EMail
Alias /icons/ "C:/Apache/icons/"
<Directory "C:/Apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"
<Directory "C:/Apache/cgi-bin/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
AddDescription "GZIP compressed document" .gz
AddDescription "tar archive" .tar
AddDescription "GZIP compressed tar archive" .tgz
AddDescription "ZIP compressed archive" .zip
# OK in Linux
# ReadmeName readme.html readme.txt
# OK in Linux
# HeaderName header.html header.inc
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage en .en
AddLanguage da .da
LanguagePriority en da
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
AddType application/x-tar .tgz
AddHandler cgi-script .cgi .pl # .phtml
AddType text/html .shtml
AddHandler server-parsed .shtml
AddHandler send-as-is asis
AddHandler imap-file map
AddHandler type-map var
AddHandler cgi-script .phtml
AddHandler cgi-script .php3
AddHandler cgi-script .cgi
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from ."ændret"
</Location>
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from ."ændret"
</Location>
############ PROXY START
#<IfModule mod_proxy.c>
#ProxyRequests On
#<Directory proxy:*>
#Order deny,allow
#Deny from all
#Allow from ."ændret"
#</Directory>
#ProxyVia On
#CacheRoot "@@ServerRoot@@/proxy"
#CacheSize 5
#CacheGcInterval 4
#CacheMaxExpire 24
#CacheLastModifiedFactor 0.1
#CacheDefaultExpire 1
#NoCache a_domain.com another_domain.edu joes.garage_sale.com
#</IfModule>
############ PROXY SLUT
# '-S' to verify your virtual host
# If you want to use name-based virtual hosts you need to define at
# least one IP address (and port number) for them.
############ VIRTUALHOST START
# NameVirtualHost 198.168.100.2:80
# NameVirtualHost 198.168.100.2
# <VirtualHost 198.168.100.2>
# ServerAdmin root@something.com
# DocumentRoot /Apache/htdocs/mail
# ServerName 198.168.100.2
# ErrorLog logs/mail.log
# CustomLog logs/access.log common
# </VirtualHost>
# <VirtualHost _default_:80>
# </VirtualHost>
############ VIRTUALHOST SLUT
############ SSL START
<IfDefine SSL>
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</IfDefine>
<IfModule mod_ssl.c>
SSLPassPhraseDialog  builtin
SSLSessionCache        dbm:logs/ssl.scache
SSLSessionCacheTimeout  300
SSLMutex  file:logs/ssl.mutex
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
SSLLog      logs/ssl_engine.log
SSLLogLevel info
</IfModule>
<IfDefine SSL>
<VirtualHost _default_:443>
DocumentRoot "C:/Apache/htdocs"
ServerName 198.168.100.1
ServerAdmin root@something.com
ErrorLog logs/error.log
TransferLog logs/access.log
SSLEngine on
SSLCertificateFile /Apache/conf/ssl.crt/server.crt
SSLCertificateKeyFile /Apache/conf/ssl.key/server.key
<Files ~ "\.(cgi|shtml)$">
SSLOptions +StdEnvVars
</Files>
<Directory "C:/Apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
CustomLog logs/ssl_request.log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>                                 
</IfDefine>
############ SSL SLUT
############SLUT

cgi-scripts skal have endelsen .phtml..
Avatar billede nemezis2you Nybegynder
10. juni 2000 - 19:06 #1
Hvis der er nogen, der kan finde nogen fejl i httpd.conf, kan det også give point.
Avatar billede razor Nybegynder
10. juni 2000 - 20:11 #2
hvad står der i error.log ?
Avatar billede michaelras Nybegynder
10. juni 2000 - 20:39 #3
I stedet for:
AddHandler cgi-script .phtml
AddHandler cgi-script .php3

Kan du da ikke bare bruge noget a la (selvfølgelig med dine egne paths):
ScriptAlias /php3/ "c:/php3/"
ScriptAlias /php4/ "c:/php4/"
AddType application/x-httpd-php4 .php4
AddType application/x-httpd-php3 .phtml
AddType application/x-httpd-php3 .php3
Action application/x-httpd-php3 "/php3/php.exe"
Action application/x-httpd-php4 "/php4/php4.exe"

Det virker upåklageligt for mig...
.. eller det er måske lige netop det du IKKE kan ??
(AddType'ne har du jo, men .phps virker ikke under windows (ikke på samme måde i hvert fald))

Michael
Avatar billede nemezis2you Nybegynder
10. juni 2000 - 21:04 #4
Virker stadig ikke,
Jeg får "Internal Server Error", når jeg kører scriptet på min egen maskine(Virker på andre).
Scriptet er her:
###############START
<?PHP
$NoAuthAdmins = 1;
$dbhostname = "localhost";
$dbusername = "";
$dbpassword = "";
$dbName = "data_base";
####################### KLIP
function commonHeader() {
include("include/function/head.inc");
}
function commonHeader2() {
include("include/function/head2.inc");
}
function commonFooter() {
include("include/function/foot.inc");
}
function Users($AU_user = "", $AU_pass = "") {
if ($AU_user != "" && $AU_pass != "") {
$AU_res = mysql_query( "SELECT password FROM admins where username = '$AU_user' and deleted != 'Yes'")
or die(mysql_error());
$AU_row=mysql_fetch_Array($AU_res);
if ($AU_row[password] == md5($AU_pass) ) {
return(1);
}
}
return(0);
}
####################### KLIP
if ( MYSQL_CONNECT($dbhostname, $dbusername, $dbpassword) &&
@mysql_select_db( "$dbName") ) {
$mysql_connected = 1;
} else {
$mysql_connected = 0;
}
if ($mysql_connected) {
if ((! isset($PHP_AUTH_USER)) && $NoAuthAdmins == 0) {
Header('WWW-Authenticate: Basic realm="Administrator"');
Header('HTTP/1.1 401 Authorization Required');
} elseif ( Users($PHP_AUTH_USER,$PHP_AUTH_PW) || $NoAuthAdmins == 1) {
if ($mode == "menu") {
commonHeader2();
include("include/admin/menu.inc");
} elseif ($mode ==  "access") {
commonHeader();
include("include/admin/access.inc");
} elseif ($mode ==  "no_access") {
commonHeader();
include("include/admin/no_access.inc");
} else {
Header(  "Location: index.phtml");
}
} else {
commonHeader();
print("<center><H4>Forkert brugernavn eller kodeord!</H4></center>");
}
} else {
commonHeader();
print("<center><H4>Kunne ikke finde gyldig Mysql-database!</H4></center>");
}
commonFooter();
exit;
?>
##############SLUT
Avatar billede nemezis2you Nybegynder
10. juni 2000 - 21:05 #5
Point er hævet til 400...:-)
Avatar billede razor Nybegynder
10. juni 2000 - 21:22 #6
hvad står der i din error.log ?
Avatar billede nemezis2you Nybegynder
11. juni 2000 - 16:14 #7
I min error.log står der:
[Tue Feb 15 16:11:27 2000] [error] [client 198.168.100.1] malformed header from script. Bad header=HTTP/1.1 401 Authorization Req: c:/apache/php/php.exe.

Jeg har snakket med nogle andre om det, og de siger, at det ikke har noget at gøre med, at jeg bruger windows 98...
Men at det er noget med at php-sider skal "server-parses" eller et eller andet?
Avatar billede michaelras Nybegynder
11. juni 2000 - 16:35 #8
JO php-sider SKAL server parses, det er et server-side scripting sprog!!'

Har du overhovedet php installeret ???? Hvis ikke kan du downloade det fra http://www.php.net

Michael
Avatar billede steffen Nybegynder
11. juni 2000 - 18:24 #9
Du har ikke givet verden adgang til dit cgi-bibliotek. Det skal rettes i din serveropsætning.

Der skal være adgang til alle, og filer skal køres som eksekverbare filer, ikke data-filer.
Avatar billede nemezis2you Nybegynder
12. juni 2000 - 13:04 #10
PHP er installeret...
Avatar billede steffen Nybegynder
14. juni 2000 - 12:25 #11
jep, men er rettigheder og php.ini filen editeret korrekt, det er spørgsmålet ..
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester