/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
Opsætning af Apache PHP server til StormLi~
Fra : Sylte


Dato : 16-02-01 15:39

Jeg har Storm Linux 2000 installeret med en Apache HTTP-server. Jeg har
brugt "dselect" til at installere en PHP4-patch til min apache server.

*** Opt web php4 4.0.3pl1-0p 4.0.3pl1-0p A server-side,
HTML-embedded scripting language
*** Opt web php4-cgi 4.0.3pl1-0p 4.0.3pl1-0p A server-side,
HTML-embedded scripting language
*** Opt web php4-cgi-gd 4.0.3pl1-0p 4.0.3pl1-0p GD module for php4-cgi
*** Opt web php4-cgi-ima 4.0.3pl1-0p 4.0.3pl1-0p IMAP module for php4-cgi
*** Opt web php4-cgi-lda 4.0.3pl1-0p 4.0.3pl1-0p LDAP module for php4-cgi
*** Opt web php4-cgi-mha 4.0.3pl1-0p 4.0.3pl1-0p MHASH module for php4-cgi
*** Opt web php4-cgi-mys 4.0.3pl1-0p 4.0.3pl1-0p MySQL module for php4-cgi
*** Opt web php4-cgi-pgs 4.0.3pl1-0p 4.0.3pl1-0p PostgreSQL module for
php4-cgi
*** Opt web php4-cgi-snm 4.0.3pl1-0p 4.0.3pl1-0p SNMP module for php4-cgi
*** Opt web php4-cgi-xml 4.0.3pl1-0p 4.0.3pl1-0p XML module for php4-cgi
*** Opt web php4-dev 4.0.3pl1-0p 4.0.3pl1-0p Files for PHP4 module
development
*** Opt web php4-gd 4.0.3pl1-0p 4.0.3pl1-0p GD module for php4
*** Opt web php4-imap 4.0.3pl1-0p 4.0.3pl1-0p IMAP module for php4
*** Opt web php4-ldap 4.0.3pl1-0p 4.0.3pl1-0p LDAP module for php4
*** Opt web php4-mhash 4.0.3pl1-0p 4.0.3pl1-0p MHASH module for php4
*** Opt web php4-mysql 4.0.3pl1-0p 4.0.3pl1-0p MySQL module for php4
*** Opt web php4-pgsql 4.0.3pl1-0p 4.0.3pl1-0p PostgreSQL module for php4
*** Opt web php4-snmp 4.0.3pl1-0p 4.0.3pl1-0p SNMP module for php4
*** Opt web php4-xml 4.0.3pl1-0p 4.0.3pl1-0p XML module for php4

Jeg har sagt "Yes" til alle autoconfigurationscripts under installationen og
apache server er blevet genstartet.

Jeg har lagt følgende HTML i html-directory'et:

<HTML>
<HEAD>
<TITLE>PHP Test</TITLE>
</HEAD>
<BODY>
Dato: <? print(Date("1 F d, Y")); ?>
</BODY>
</HTML>

Resultat:

Data:

--------------------
Hvorfor virker mit php-script ikke?



 
 
Bo Meyer (16-02-2001)
Kommentar
Fra : Bo Meyer


Dato : 16-02-01 15:53

Sylte wrote:
> Jeg har lagt følgende HTML i html-directory'et:
>
> <HTML>
> <HEAD>
> <TITLE>PHP Test</TITLE>
> </HEAD>
> <BODY>
> Dato: <? print(Date("1 F d, Y")); ?>
> </BODY>
> </HTML>
>
> Resultat:
>
> Data:
>
> --------------------
> Hvorfor virker mit php-script ikke?

Hvad har du kaldt filen til efternavn? (den skal have det efternavn
som er konfigureret i httpd.conf' AddType application/x-httpd-php,
f.eks. .php)

--
Bo Meyer

Sylte (16-02-2001)
Kommentar
Fra : Sylte


Dato : 16-02-01 16:30

Jeg kaldte godt nok min fil for "index.html", men hvis jeg laver nogle filer
med extension .php/.php3 spørger browseren bare om den skal gemme filen på
HD'en. Med extension .php4 sker der det samme som .html - ingenting, andet
end at den skriver "Dato:"....

Jeg fandt linierne "AddType application/x-httpd-php3 .phtml
AddType application/x-httpd-php-source .phps
i min "srm.conf", ikke i "httpd.conf". De var begge udmarkeret - det hjalp
ikke at fjerne #'en og genstarte.
Browseren spørger stadig om den skal gemme....

Fandt linien:
"#LoadModule php4_module /usr/lib/apache/1.3/libphp4.so" i min "httpd.conf".
Det hjalp heller ikke at fjerne #.

Er min PHP koden OK? Ville det hjælpe at se mine "httpd.conf" og "srm.conf"
filer eller andre vigtige filer?








Tonni Aagesen (16-02-2001)
Kommentar
Fra : Tonni Aagesen


Dato : 16-02-01 18:02


"Sylte" <sylte_@hotmail.dk> skrev i en meddelelse
news:FHbj6.72394$zw.1293777@twister.sunsite.dk...
> Jeg kaldte godt nok min fil for "index.html", men hvis jeg laver nogle
filer
> med extension .php/.php3 spørger browseren bare om den skal gemme filen på
> HD'en. Med extension .php4 sker der det samme som .html - ingenting, andet
> end at den skriver "Dato:"....

Dine kode kommer ikke i gennem fortolkoeren.
Jeg havde samme "problem", da mit www-dir ligger som netværksmappe og jeg
prøvede at åbne det som sådan.
Skriv i din browser: http://din_servers_ip/phptest.php - eller hvad nu din
php-fil hedder og hvor den ligger.
På denne måde skulle koden komme i gennem fortolkeren, og det skulle virke -
ellers er det noget med php-modulet, der ikke er, som det skal være

Mvh
Tonni Aagesen



Sylte (16-02-2001)
Kommentar
Fra : Sylte


Dato : 16-02-01 17:31

Det hjalp desværre ikke, Tonny. I får lige mine "httpd.conf" & "srm.conf"
filer...

"/etc/apache/httpd.conf":

# This is the main server configuration file. See URL http://www.apache.org/
# for instructions.

# Do NOT simply read the instructions in here without understanding
# what they do, if you are unsure consult the online docs. You have been
# warned.

# Originally by Rob McCool

# Shared Object Module Loading:
# To be able to use the functionality of a module which was built
# as a shared object you have to place corresponding `LoadModule'
# lines at this location so the directives contained in it are
# actually available _before_ they are used.
# Example:

# ServerType is either inetd, or standalone.

ServerType standalone

# If you are running from inetd, go to "ServerAdmin".

# Port: The port the standalone listens to. For ports < 1023, you will
# need httpd to be run as root initially.

Port 80

# HostnameLookups: Log the names of clients or just their IP numbers
# e.g. www.apache.org (on) or 204.62.129.132 (off)
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on.

HostnameLookups off

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.

# User/Group: The name (or #number) of the user/group to run httpd as.
# On SCO (ODT 3) use User nouser and Group nogroup
# On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.

User www-data
Group www-data

# ServerAdmin: Your address, where problems with the server should be
# e-mailed.
ServerAdmin sylte_@hotmail.com

# ServerRoot: The directory the server's config, error, and log files
# are kept in.
# NOTE! If you intend to place this on a NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation,
# you will save yourself a lot of trouble.

ServerRoot /etc/apache

# BindAddress: You can support virtual hosts with this option. This option
# is used to tell the server which IP address to listen to. It can either
# contain "*", an IP address, or a fully qualified Internet domain name.
# See also the VirtualHost directive.

BindAddress *


# The Debian package of Apache loads every feature as shared modules.
# Please keep this LoadModule: line here, it is needed for installation.
# LoadModule vhost_alias_module /usr/lib/apache/1.3/mod_vhost_alias.so
# LoadModule env_module /usr/lib/apache/1.3/mod_env.so
LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
# LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
LoadModule status_module /usr/lib/apache/1.3/mod_status.so
# LoadModule info_module /usr/lib/apache/1.3/mod_info.so
# LoadModule includes_module /usr/lib/apache/1.3/mod_include.so
LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
# LoadModule asis_module /usr/lib/apache/1.3/mod_asis.so
# LoadModule imap_module /usr/lib/apache/1.3/mod_imap.so
# LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
# LoadModule speling_module /usr/lib/apache/1.3/mod_speling.so
LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
LoadModule access_module /usr/lib/apache/1.3/mod_access.so
LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so
# LoadModule anon_auth_module /usr/lib/apache/1.3/mod_auth_anon.so
# LoadModule dbm_auth_module /usr/lib/apache/1.3/mod_auth_dbm.so
# LoadModule db_auth_module /usr/lib/apache/1.3/mod_auth_db.so
# LoadModule proxy_module /u

Michael Rasmussen (16-02-2001)
Kommentar
Fra : Michael Rasmussen


Dato : 16-02-01 17:46

Hej,

Ifølge din httpd.conf vil den kun genkende filer med endelsen .phtml
som php-filer. Har din fil denne endelse?

Hilsen,
Michael.
"Sylte" <sylte_@hotmail.dk> skrev i en meddelelse
news:MAcj6.72556$zw.1299991@twister.sunsite.dk...
> Det hjalp desværre ikke, Tonny. I får lige mine "httpd.conf" &
"srm.conf"
> filer...
>
> "/etc/apache/httpd.conf":
>
> # This is the main server configuration file. See URL
http://www.apache.org/
> # for instructions.
>
> # Do NOT simply read the instructions in here without understanding
> # what they do, if you are unsure consult the online docs. You have
been
> # warned.
>
> # Originally by Rob McCool
>
> # Shared Object Module Loading:
> # To be able to use the functionality of a module which was built
> # as a shared object you have to place corresponding `LoadModule'
> # lines at this location so the directives contained in it are
> # actually available _before_ they are used.
> # Example:
>
> # ServerType is either inetd, or standalone.
>
> ServerType standalone
>
> # If you are running from inetd, go to "ServerAdmin".
>
> # Port: The port the standalone listens to. For ports < 1023, you
will
> # need httpd to be run as root initially.
>
> Port 80
>
> # HostnameLookups: Log the names of clients or just their IP numbers
> # e.g. www.apache.org (on) or 204.62.129.132 (off)
> # The default is off because it'd be overall better for the net if
people
> # had to knowingly turn this feature on.
>
> HostnameLookups off
>
> # If you wish httpd to run as a different user or group, you must
run
> # httpd as root initially and it will switch.
>
> # User/Group: The name (or #number) of the user/group to run httpd
as.
> # On SCO (ODT 3) use User nouser and Group nogroup
> # On HPUX you may not be able to use shared memory as nobody, and
the
> # suggested workaround is to create a user www and use that user.
>
> User www-data
> Group www-data
>
> # ServerAdmin: Your address, where problems with the server should
be
> # e-mailed.
> ServerAdmin sylte_@hotmail.com
>
> # ServerRoot: The directory the server's config, error, and log
files
> # are kept in.
> # NOTE! If you intend to place this on a NFS (or otherwise network)
> # mounted filesystem then please read the LockFile documentation,
> # you will save yourself a lot of trouble.
>
> ServerRoot /etc/apache
>
> # BindAddress: You can support virtual hosts with this option. This
option
> # is used to tell the server which IP address to listen to. It can
either
> # contain "*", an IP address, or a fully qualified Internet domain
name.
> # See also the VirtualHost directive.
>
> BindAddress *
>
>
> # The Debian package of Apache loads every feature as shared
modules.
> # Please keep this LoadModule: line here, it is needed for
installation.
> # LoadModule vhost_alias_module
/usr/lib/apache/1.3/mod_vhost_alias.so
> # LoadModule env_module /usr/lib/apache/1.3/mod_env.so
> LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
> # LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
> LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
> LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
> LoadModule status_module /usr/lib/apache/1.3/mod_status.so
> # LoadModule info_module /usr/lib/apache/1.3/mod_info.so
> # LoadModule includes_module /usr/lib/apache/1.3/mod_include.so
> LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
> LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
> LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
> # LoadModule asis_module /usr/lib/apache/1.3/mod_asis.so
> # LoadModule imap_module /usr/lib/apache/1.3/mod_imap.so
> # LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
> # LoadModule speling_module /usr/lib/apache/1.3/mod_speling.so
> LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
> LoadModule alias_module /usr/lib/apache/1.3/

Michael Rasmussen (16-02-2001)
Kommentar
Fra : Michael Rasmussen


Dato : 16-02-01 18:01

Hej,

Fandt lige et par øvrige fejl:

For at få det til at virke skal du lave følgende ændringer:

<snip>
> >
> > # For example, the PHP3 module (a separate Debian package)
> > # will typically use:
> > AddType application/x-httpd-php3 .phtml
> > AddType application/x-httpd-php3-source .phps

ændres til

AddType application/x-httpd-php .php //filer med endelsen .php
fortolkes som phpfiler.
AddType application/x-httpd-php-source .phps //hvis du vil vise
koden ufortolket tilføjes de endelsen .phps.

Forklaring:

Din conf er sat op til at fortolke php version 3 med endelsen .phtml,
men efter release af php version 4 er man gået tilbage til gammel
format, som er .php, og du loader netop php version 4

Hilsen,
Michael


Sylte (16-02-2001)
Kommentar
Fra : Sylte


Dato : 16-02-01 18:04

Jep, den har jeg også prøvet... virker heller ikke Browseren forsøger
stadig at gemme f.eks "phptest.phtml"/"phptest.php" som en fil.



Jacob Bunk Nielsen (16-02-2001)
Kommentar
Fra : Jacob Bunk Nielsen


Dato : 16-02-01 18:00

"Sylte" <sylte_@hotmail.dk> writes:

> Jeg fandt linierne "AddType application/x-httpd-php3 .phtml
> AddType application/x-httpd-php-source .phps

Det betyder at webserveren fortolker fil der slutter på ".phtml" som
x-httpd-php3 og filer der ender på ".phps" som x-httpd-php-source".

Med andre ord, kald din fil for index.phtml.

--
Jacob
Calm down. It's only ones and zeros.

Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408877
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste