Lampp zeigt Quelltext statt Webseite

Irgendwelche Probleme mit XAMPP für Linux? Dann ist hier genau der richtige Ort um nachzufragen.

Lampp zeigt Quelltext statt Webseite

Postby banthrass » 27. May 2010 07:50

Hallo zusammen,

ich habe ein kleines Problem mit Lampp. Ich wollte meine Webseite von aussen (Internet) erreichbar machen, was auch fast funktioniert hat. DynDns läuft sowieso und ein Portforwarding von Port 80 schickt die User direkt auf den Rechner. In der httpd.conf habe ich einen Vhost angelegt. in der meine Email, dyndns adresse etc steht. Wenn ich nun aussen auf die Domain zugreife werde ich sofort in den Ordner Xampp umgeleitet. Auch das ändern der Index.php im htdocs verzeichnis hilft da leider nicht. Ein anderes Problem, das ich eigentlich gravierender finde, ist folgendes:
Wenn ich von aussen auf meinedomain.org/meinSeite zugreife komme ich auch auf die Seite, die auf meinem Rechner läuft. Leider lädt er aber nicht die Seite, sondern zeigt mir Broswer den php Quellcode an. Kann mir da jemand helfen?

Danke euch
banthrass
 
Posts: 26
Joined: 09. June 2004 09:13

Re: Lampp zeigt Quelltext statt Webseite

Postby Altrea » 27. May 2010 08:14

Zu Problem 1:
Irgendwo muss der redirect ja definiert sein.
Benenn mal die Datei index.php um. Ist die Umleitung danach immernoch aktiv, gibt es drei Möglichkeiten:
- DocumentRoot wurde aufs XAMPP-Verzeichnis gelegt (ob nun global oder als VHost)
- eine .htaccess Datei in dem Ordner ist dafür verantwortlich
- Der redirect kommt aus einer HTML-Datei (DirectoryIndex verändert, dass .html Dateien vorang vor .php-Dateien haben?)

Zu problem 2:
Hat die Datei die du da aufrufst die Endung .html und enthält php-Quelltext, so muss der Apache angewiesen werden html-Dateien auch durch den Parser zu schicken.
Ist es eine .php Datei, weist das sehr stark auf ein short_open_tag Problem hin (dazu einfach die Forumsuche verwenden. Unzählige Male beantwortet)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Lampp zeigt Quelltext statt Webseite

Postby banthrass » 27. May 2010 13:29

- DocumentRoot wurde aufs XAMPP-Verzeichnis gelegt (ob nun global oder als VHost)

eigentlich nicht in meiner httpd.conf ist folgendes eingetragen:

Code: Select all
DocumentRoot "/opt/lampp/htdocs"


dort gibt es eine index.php in der folgendes steht:
Code: Select all
<?php
   if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
      $uri = 'https://';
   } else {
      $uri = 'http://';
   }
   $uri .= $_SERVER['HTTP_HOST'];
   header('Location: '.$uri.'/xampp/');
   exit;
?>


In den letzten 2 Zeilen scheint es eine Umleitung zu geben. Allerdings passiert nicht wirklich was, wenn ich da was ändere. Schreibe ich z.B. anstatt /xampp/ /meineSeite/ passiert nichts. ausser das er mir meldet das keine Seite erreichbar ist.

eine .htaccess Datei in dem Ordner ist dafür verantwortlich

Überprüft, ist nicht der Fall

- Der redirect kommt aus einer HTML-Datei (DirectoryIndex verändert, dass .html Dateien vorang vor .php-Dateien haben?)

In der stand in der hhtpd.conf folgendes:
Code: Select all
<IfModule dir_module>
    #DirectoryIndex index.html
    # XAMPP
    DirectoryIndex index.html index.html.var index.php index.php3 index.php4
</IfModule>


Hab es geändert in:
Code: Select all
<IfModule dir_module>
    #DirectoryIndex index.html
    # XAMPP
    DirectoryIndex index.php index.html.var index.html index.php3 index.php4
</IfModule>


Kein Erfolg.
Hier mal mein Eintrag zum Vhost:



Code: Select all
ServerAdmin meine.email@provider.de

<VirtualHost domain.dnsservice.de>
    ServerAdmin meine.email@provider.de
    DocumentRoot "/opt/lampp/htdocs/meineSeite"
    ServerName domain.dnsservice.de
</VirtualHost>


stimmt da vielleicht irgendwas nicht??

habe in der PHP die short_open_tag sache geprüft. Habe lustiger weis 2 mal diesen Eintrag. er sieht aktuell so aus:
Code: Select all
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off
; XAMPP for Linux is currently old fashioned
short_open_tag = Off


okay so oder? meine PHP fängt mit <?php
an und endt mit ?>

wonach kann ich noch schauen.

danke
banthrass
 
Posts: 26
Joined: 09. June 2004 09:13

Re: Lampp zeigt Quelltext statt Webseite

Postby Altrea » 27. May 2010 14:02

banthrass wrote:In den letzten 2 Zeilen scheint es eine Umleitung zu geben. Allerdings passiert nicht wirklich was, wenn ich da was ändere. Schreibe ich z.B. anstatt /xampp/ /meineSeite/ passiert nichts. ausser das er mir meldet das keine Seite erreichbar ist.

Das ist alles andere als "nichts"!
Welche Fehlermeldung wird nach der Änderung denn genau ausgegeben? Error 403? Error 404? Error 500?

banthrass wrote:Hier mal mein Eintrag zum Vhost:
Code: Select all
ServerAdmin meine.email@provider.de

<VirtualHost domain.dnsservice.de>
    ServerAdmin meine.email@provider.de
    DocumentRoot "/opt/lampp/htdocs/meineSeite"
    ServerName domain.dnsservice.de
</VirtualHost>


stimmt da vielleicht irgendwas nicht??

Kommt darauf an, ob das alles ist.
Du willst Namebased VHosts einsetzen. Wo ist deine "NameVirtualHost"-Zeile?
Poste am besten mal alles, was zu deinen VHosts Definitionen gehört.
Dann sieht man auch, wo/welcher dein Default-VHost ist, etc.
Aber Nobbie kann dir dazu sicher vielmehr erklären. Ich definier VHosts auch eher behelfsmäßig.

Überprüfe auch, ob deine VHost Angaben überhaupt zum Tragen kommen, sprich: Wenn sie in einer externen Datei definiert werden, überprüfe ob diese Datei in der httpd.conf auch includiert wird.

banthrass wrote:habe in der PHP die short_open_tag sache geprüft. Habe lustiger weis 2 mal diesen Eintrag. er sieht aktuell so aus:
Code: Select all
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off
; XAMPP for Linux is currently old fashioned
short_open_tag = Off

Sieht auf jeden Fall komisch aus. Eine davon kannst du auskommentieren.

banthrass wrote:okay so oder? meine PHP fängt mit <?php
an und endt mit ?>

short_open_tags treten auch mittendrin auf. So wird oft vergessen die PHP-includes nach short_open_tags zu überprüfen, oder die Kurzform von <?php echo (<?=)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Lampp zeigt Quelltext statt Webseite

Postby banthrass » 27. May 2010 14:38

Hi, und danke für die Infos.

Mittlerweile hab ich so viel rumgespielt das ich nicht mehr alles im Überblick hab. Etwas suboptimal.

Mittlerweile greife ich von aussen auf den Rechner zu. Sobald ich nur die domain lade komtm die weiterleitung auf den Xampp ordner, dort wird mir aber nicht die Page angezeigt sonsern die Index.php de /xampp ordners als text. nehme ich die domain samt meiner webseite das selbe. Sprich http://ich.dnsservice.de/meineseite sehe ich meine Seite auch schon, allerdings den Quelltext der index php. Wenn ich nun rausfinde wie ich die darstellung wieder richtig hin bekomme hab ich es geschafft.

Hier einfach mal meine komplette httpd.conf:

Code: Select all
Hi, und danke für die Infos.

Mittlerweile hab ich so viel rumgespielt das ich nicht mehr alles im Überblick hab. Etwas suboptimal.

Mittlerweile greife ich von aussen auf den Rechner zu. Sobald ich nur die domain lade komtm die weiterleitung auf den Xampp ordner, dort wird mir aber nicht die Page angezeigt sonsern die Index.php de /xampp ordners als text. nehme ich die domain samt meiner webseite das selbe. Sprich http://ich.dnsservice.de/meineseite sehe ich meine Seite auch schon, allerdings den Quelltext der index php. Wenn ich nun rausfinde wie ich die darstellung wieder richtig hin bekomme hab ich es geschafft.

Hier einfach mal meine komplette httpd.conf:

[code]

ServerRoot "/opt/lampp"

Listen 80


LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
# mod_dbd doesn't work in Apache 2.2.3: getting always heaps of "glibc detected *** corrupted double-linked list" on shutdown - oswald, 10sep06
#LoadModule dbd_module modules/mod_dbd.so
LoadModule bucketeer_module modules/mod_bucketeer.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule echo_module modules/mod_echo.so
LoadModule case_filter_module modules/mod_case_filter.so
LoadModule case_filter_in_module modules/mod_case_filter_in.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule apreq_module modules/mod_apreq2.so
LoadModule ssl_module modules/mod_ssl.so

<IfDefine JUSTTOMAKEAPXSHAPPY>
LoadModule php4_module        modules/libphp4.so
LoadModule php5_module        modules/libphp5.so
</IfDefine>

<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>

User nobody
Group nogroup
</IfModule>
</IfModule>


ServerAdmin pierre.fey@gmx.de

<VirtualHost domain.dnsservice.de>
    ServerAdmin maine.mail@provider.de
    DocumentRoot /opt/lampp/htdocs/meineSeite
    ServerName domain.dnsservice.de:80
    ErrorLog logs/domain.dnsservice.de-error_log
    TransferLog logs/domain.dnsservice.de-access_log
</VirtualHost>

ServerName localhost

DocumentRoot "/opt/lampp/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    #XAMPP
    #Order deny,allow
    #Deny from all
</Directory>


<Directory "/opt/lampp/htdocs">

    Options Indexes FollowSymLinks ExecCGI Includes
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from all

</Directory>


<IfModule dir_module>
    DirectoryIndex index.php index.html.var index.html index.php3 index.php4
</IfModule>


<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
</FilesMatch>


ErrorLog logs/error_log


LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>

      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>


    CustomLog logs/access_log common


</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/"

</IfModule>

<IfModule cgid_module>

</IfModule>


<Directory "/opt/lampp/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>


DefaultType text/plain

<IfModule mime_module>

    TypesConfig etc/mime.types


    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz


    AddHandler cgi-script .cgi .pl


    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>


EnableMMAP off
EnableSendfile off

Include etc/extra/httpd-multilang-errordoc.conf

Include etc/extra/httpd-autoindex.conf

<IfModule ssl_module>
# XAMPP
<IfDefine SSL>
Include etc/extra/httpd-ssl.conf
</IfDefine>
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
                                                                   
[/code]


Dort gibt es eine passage : DefaultType text/plain

Könnte das ein Problem sein??

Des weiteren habe ich gelesen, dass man folgendes eintragen muss:

Code: Select all
LoadModule php3_module /usr/lib/apache/libphp3.so
AddModule  mod_php3.c
AddType application/x-httpd-php3 .php
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
AddType application/x-httpd-php3 .phtml 


Ist da was dran, kann ich dass so übernehmen? Sieht so windows like aus irgendwie :).

Danke
banthrass
 
Posts: 26
Joined: 09. June 2004 09:13

Re: Lampp zeigt Quelltext statt Webseite

Postby banthrass » 27. May 2010 15:35

Habe gerade mal in die Datei mime.types geschaut. Dort finde ich z.B. die definition für *.html (text/html html htm). In der Datei finde ich aber keine definition für php. wie würde diese definition denn aussehen?
banthrass
 
Posts: 26
Joined: 09. June 2004 09:13

Re: Lampp zeigt Quelltext statt Webseite

Postby Altrea » 27. May 2010 15:41

Die Definition für .php ist beim XAMPP-Paket ausgelagert, deshalb findest du sie da nicht.
Zu finden in der Datei httpd-xampp.conf (ich kenne gerade den genauen Pfad unter Linux nicht)

banthrass wrote:Mittlerweile hab ich so viel rumgespielt das ich nicht mehr alles im Überblick hab. Etwas suboptimal.

Vielleicht bietet sich dann mal an, eine frische Installation zu versuchen, bevor du noch Stundenlang auf Fehlersuche bist.

banthrass wrote:Dort gibt es eine passage : DefaultType text/plain

Könnte das ein Problem sein??

Nope. Das definiert nur eine Standardregel, wie mit unbekannten Dateitypen umzugehen ist

banthrass wrote:Des weiteren habe ich gelesen, dass man folgendes eintragen muss:

Code: Select all
LoadModule php3_module /usr/lib/apache/libphp3.so
AddModule  mod_php3.c
AddType application/x-httpd-php3 .php
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
AddType application/x-httpd-php3 .phtml 


Ist da was dran, kann ich dass so übernehmen?

Wo hast du das denn her? Ich weiß nicht recht, php3 klingt schon sehr angestaubt ;)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Lampp zeigt Quelltext statt Webseite

Postby banthrass » 27. May 2010 15:52

Naja halt bei google gefunden :). ja die httpd-xampp.conf kenne ich. in meiner normalen hhtpd.conf ist der include aber deaktiviert. somit spielt diese keine rolle. ist das etwa des räsetls lösung? ich schau mal nach

UPDATE
Hab mal die httpd-xampp.conf includiert. in dieser Datei steht tatsächlich der eintrag für php drin, ohne erfolg. ich bin schon drauf und dran das system neu zu installieren. aber ohne xampp sondern einzelne pakete, hab das gefühl das es für mich übersichlich wäre. Jemand noch eine Idee?
Last edited by banthrass on 27. May 2010 16:04, edited 1 time in total.
banthrass
 
Posts: 26
Joined: 09. June 2004 09:13

Re: Lampp zeigt Quelltext statt Webseite

Postby Altrea » 27. May 2010 15:55

Wenn dies wirklich so ist, dann ist das des Rätsels lösung.

Du hast dir deine Installation ja ganzschön verbogen :D
Ich kann dir nur wiederholt eine Neuinstallation empfehlen. Wer weiß was da noch so alles im Argen ist.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP für Linux

Who is online

Users browsing this forum: No registered users and 13 guests