Konfiguration av PHP5 under Apache 2.0 [LÖST]

PHP kan diskuteras här.

Moderatorer: Nille, Minime

the1980man
Lärling
Inlägg: 67
Blev medlem: 31 jan 2006 21:03
ORT: många... ;)

Konfiguration av PHP5 under Apache 2.0 [LÖST]

Inlägg av the1980man »

Jag har installerat Apache2-server och lagt till PHP5 men får det tyvärr ej att fungera.

Vid test av att öppna en php-fil så får jag upp en dialogruta för att ladda ner php-filen istället för att serverd
interpreterar den och skickar HTML-kod.

Jag har kollat i httpd.conf utan att hitta någon orsak.

Har någon varit med om något liknande?
nomicon
Administratör
Inlägg: 567
Blev medlem: 28 sep 2003 00:14
ORT: Linköping

Inlägg av nomicon »

Du har AddType php grejen i httpd.conf o så?

-Martin
--
Moderator slackwarelinux.se
--
Availo - Serverhotellet
http://www.availo.se
--
ligu
Hacker
Inlägg: 43
Blev medlem: 25 jan 2006 22:58
ORT: Min älskade sambo, mat och vin och linux förstås

Inlägg av ligu »

Kör inte Apache längre men kolla så du har följande i httpd.conf

AddType application/x-httpd-php .php

DirectoryIndex index.php

hoppas de hjälper
Only wimps use tape backup: _real_ men just upload their important stuff on ftp,
and let the rest of the world mirror it.
the1980man
Lärling
Inlägg: 67
Blev medlem: 31 jan 2006 21:03
ORT: många... ;)

Inlägg av the1980man »

Jag har:

AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php5
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .php3s
AddType application/x-httpd-php-source .php4s
AddType application/x-httpd-php-source .php5s
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php3
DirectoryIndex index.php4
DirectoryIndex index.php5
DirectoryIndex index.php

Fast det fungerar ej ändå :(
Användarens profilbild
Nille
Guru
Inlägg: 1475
Blev medlem: 17 jun 2004 02:41

Inlägg av Nille »

Har du med 'Include /etc/apache/mod_php.conf' i httpd.conf?
Sedan i /etc/apache/mod_php.conf borde du ha något liknande detta 'LoadModule php5_module libexec/apache/libphp5.so'
Då borde det förhoppningsvis fungera.
'AddType application/x-httpd-php .php .phtml' detta brukar jag ha i /etc/apache/mod_php.conf men du kan ha innehållet i den i httpd.conf om du vill.
the1980man
Lärling
Inlägg: 67
Blev medlem: 31 jan 2006 21:03
ORT: många... ;)

Inlägg av the1980man »

Jag saknar mod_php.conf i /etc/apache2.

Jag har följande i /ect/apache2/conf.d/php5.conf

Kod: Markera allt

<IfModule mod_php5.c>
        AddType application/x-httpd-php .php3
        AddType application/x-httpd-php .php4
        AddType application/x-httpd-php .php5
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .php3s
        AddType application/x-httpd-php-source .php4s
        AddType application/x-httpd-php-source .php5s
        AddType application/x-httpd-php-source .phps
        DirectoryIndex index.php3
        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>
Men som sagt... eftersom mod_php.conf saknas i /etc/apache2 så är det ju det som är felet...

Hur ser en 'standard' mod_php.conf ut?
Användarens profilbild
Nille
Guru
Inlägg: 1475
Blev medlem: 17 jun 2004 02:41

Inlägg av Nille »

Detta har jag i min.
nille@burken:~$ cat /etc/apache2/mod_php.conf
#
# mod_php - PHP Hypertext Preprocessor module
#

LoadModule php5_module lib/apache2/libphp5.so
#LoadModule php5_module libexec/apache/libphp5.so
# Tell Apache to feed all *.php files through the PHP module
AddType application/x-httpd-php .php .phtml

# This will display PHP files in colored syntax form. Use with caution.
#AddType application/x-httpd-php-source .phps

Men glöm inte raden 'Include /etc/apache2/mod_php.conf' i httpd.conf
Hoppas det fungerar.
the1980man
Lärling
Inlägg: 67
Blev medlem: 31 jan 2006 21:03
ORT: många... ;)

Inlägg av the1980man »

Tack!

Jag konfade om filen utifrån mitt system och nu har jag fått igång PHP som det ska.

Tack så mycket för hjälpen!
BigDuke6
Allsmäktig
Inlägg: 223
Blev medlem: 09 mar 2005 22:34

Inlägg av BigDuke6 »

Lägg gärna till [löst] i trådtiteln ;)
exz
Allsmäktig
Inlägg: 378
Blev medlem: 28 sep 2003 21:03
ORT: Falun

Inlägg av exz »

fixat..
Administratör på slackware.se
& moderator i forumet
Slackware sedan version 7.1
the1980man
Lärling
Inlägg: 67
Blev medlem: 31 jan 2006 21:03
ORT: många... ;)

Inlägg av the1980man »

BigDuke6 skrev:Lägg gärna till [löst] i trådtiteln ;)
Japp, jag funderade just faktiskt på hur det markeras löst här på forumet men nu vet jag :P