suPHP - PHP Quellcode wird angezeigt

Apache, Lighttpd, nginx, Cherokee
jensi
Posts: 7
Joined: 2008-03-07 20:09

suPHP - PHP Quellcode wird angezeigt

Post by jensi » 2008-03-07 20:18

Ich habe einen Server von 0 an komplett aufgesetzt und dort Suse 10.3 installiert. Darauf soll nun ein Confixx kommen (aktuelle 3er) - die Installation hat per Shell soweit geklappt. Wenn ich jetzt die Seite aufrufe wird diese anstandslos angezeigt. Das Problem ist nun das Interpretieren von PHP, da lediglich der PHP Quellcode angezeigt wird und nichts geparsed wird. Es gibt dazu in den Logs keine Fehlermeldung. Ich bin relativ ratlos und hoffe auf Tipps und Hinweise das Problem zu lösen.

suPHP wurde nach dieser Anleitung installiert: http://www.lazyfrosch.de/linux/suphp-confixx-suse


Hier einige Details:

Code: Select all

/opt/php5.2.5-fastcgi/bin/php # php
php       php5      php-cgi   php-cgi5
/opt/php5.2.5-fastcgi/bin/php # php-cgi -v
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Dec 12 2007 03:38:49)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
/opt/php5.2.5-fastcgi/bin/php # php -v
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Dec 12 2007 03:47:43)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies


cat /etc/suphp/suphp.conf

Code: Select all

[global]
;Path to logfile
logfile=/var/log/suphp.log

;Loglevel
loglevel=info

;User Apache is running as
webserver_user=wwwrun

;Path all scripts have to be in
docroot=/srv

;Path to chroot() to before executing script
;chroot=/mychroot

; Security options
allow_file_group_writeable=true
allow_file_others_writeable=true
allow_directory_group_writeable=true
allow_directory_others_writeable=true

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true

;Send minor error messages to browser
errors_to_browser=true

;PATH environment variable
env_path=/bin:/usr/bin

;Umask to set, specify in octal notation
umask=0022

; Minimum UID
min_uid=100

; Minimum GID
min_gid=100


[handlers]
;Handler for php-scripts
x-httpd-php=php:/opt/php5.2.5-fastcgi/bin/php-cgi

;Handler for CGI-scripts
x-suphp-cgi=execute:!self


Wenn ich eine Datei bzw. den Ordner reg aufrufe erscheint folgendes (bei /var/log # tail -f *):

Code: Select all

==> suphp.log <==
[Fri Mar 07 20:21:15 2008] [info] Executing "/srv/www/htdocs/confixx/html/reg/index.php" as UID 641, GID 500
[Fri Mar 07 20:21:15 2008] [info] Executing "/srv/www/htdocs/confixx/html/reg/index.php" as UID 641, GID 500
[Fri Mar 07 20:21:15 2008] [info] Executing "/srv/www/htdocs/confixx/html/reg/index.php" as UID 641, GID 500
[Fri Mar 07 20:21:15 2008] [info] Executing "/srv/www/htdocs/confixx/html/reg/index.php" as UID 641, GID 500
[Fri Mar 07 20:21:16 2008] [info] Executing "/srv/www/htdocs/confixx/html/reg/index.php" as UID 641, GID 500
[Fri Mar 07 20:21:16 2008] [info] Executing "/srv/www/htdocs/confixx/html/reg/index.php" as UID 641, GID 500

User avatar
Joe User
Project Manager
Project Manager
Posts: 11599
Joined: 2003-02-27 01:00
Location: Hamburg

Re: suPHP - PHP Quellcode wird angezeigt

Post by Joe User » 2008-03-07 21:22

mod-suphp geladen und konfiguriert? MIME-Type gesetzt?
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

jensi
Posts: 7
Joined: 2008-03-07 20:09

Re: suPHP - PHP Quellcode wird angezeigt

Post by jensi » 2008-03-07 21:49

Wie meinst du das mit "mod-suphp geladen" geladen? Also wenn ich in der "suphp.conf" bewusst den Pfad bei x-httpd-php falsch setze meldet sich sofort suPHP mit einer Fehlermeldung. Insofern ist das Modul geladen.

vi /etc/sysconfig/apache2

Code: Select all

APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir rewrite suphp"


bzw. /etc/apache2 # vi confixx_mhost.conf

Code: Select all

<Directory "/srv/www/htdocs/confixx/html">

  AllowOverride all

  <IfModule mod_access.c>
    Allow from all
  </IfModule>
  <IfModule mod_authz_host.c>
    Allow from all
  </IfModule>

  <IfModule mod_rewrite.c>

    RewriteEngine On
    Options +FollowSymlinks

    RewriteRule ^reseller/res[0-9]+/(.*)$ reseller/$1 [L]

    RewriteRule ^user/[a-zA-Z][-a-zA-Z0-9_]{0,4}[0-9]+/(.*)$ user/$1 [L]

    RewriteRule ^ftplogin/[a-zA-Z][-a-zA-Z0-9_]{0,4}[0-9]+/(.*)$ ftplogin/$1 [L]
    RewriteRule ^ftplogin/[a-zA-Z][-a-zA-Z0-9_]{0,4}[0-9]+f[0-9]+/(.*)$ ftplogin/$1 [L]

    RewriteRule ^poplogin/[a-zA-Z][-a-zA-Z0-9_]{0,4}[0-9]+p[0-9]+/(.*)$ poplogin/$1 [L]

  </IfModule>

  AddDefaultCharset off

  suPHP_engine on

</Directory>


NameVirtualHost XXXIP:80

<VirtualHost XXXIP:80>

  ServerName XXXIP

  DocumentRoot /srv/www/htdocs/confixx/html/gesperrt

  Options FollowSymLinks
  suPHP_ConfigPath /etc/apache2/confixx_phpini
  suPHP_UserGroup confixx confixx
  <IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.htm index.shtml index.cgi
  </IfModule>


</VirtualHost>

<VirtualHost XXXIP:80>

  ServerName xxx

  #User confixx
  #Group confixx
  DocumentRoot /srv/www/htdocs/confixx/html
  Options FollowSymLinks

  suPHP_ConfigPath /etc/apache2/confixx_phpini

  suPHP_UserGroup confixx confixx
  ScriptAlias /cgi-bin/ /srv/www/htdocs/confixx/html/cgi-bin/

  <IfModule mod_dir.c>
    DirectoryIndex index.html index.htm index.shtml index.cgi index.php
  </IfModule>


  CustomLog /var/log/apache2/xxx_access.log "%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i""
  ErrorLog /var/log/apache2/xxx_error.log


</VirtualHost>

NameVirtualHost XXXIP:443

<VirtualHost XXXIP:443>

  ServerName XXXIP

  DocumentRoot /srv/www/htdocs/confixx/html/gesperrt

  Options FollowSymLinks
  suPHP_ConfigPath /etc/apache2/confixx_phpini
  suPHP_UserGroup confixx confixx
  <IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.htm index.shtml index.cgi
  </IfModule>


  <IfModule mod_ssl.c>

    SSLEngine on
    SSLCertificateKeyFile /etc/apache2/ssl.key/xxx.key
    SSLCertificateFile /etc/apache2/ssl.crt/xxx.crt



    SetEnvIf User-Agent ".*MSIE.*"
      nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

    <Files ~ ".(cgi|shtml|phtml|php3?)$">
      SSLOptions +StdEnvVars
    </Files>

    <Directory "/srv/www/htdocs/confixx/html/cgi-bin">
      SSLOptions +StdEnvVars
    </Directory>

  </IfModule>


</VirtualHost>

<VirtualHost XXXIP:443>

  ServerName XXX

  #User confixx
  #Group confixx
  DocumentRoot /srv/www/htdocs/confixx/html
  Options FollowSymLinks

  suPHP_ConfigPath /etc/apache2/confixx_phpini

  suPHP_UserGroup confixx confixx
  ScriptAlias /cgi-bin/ /srv/www/htdocs/confixx/html/cgi-bin/

  <IfModule mod_dir.c>
    DirectoryIndex index.html index.htm index.shtml index.cgi index.php
  </IfModule>


  <IfModule mod_ssl.c>

    SSLEngine on
    SSLCertificateKeyFile /etc/apache2/ssl.key/XXX.key
    SSLCertificateFile /etc/apache2/ssl.crt/XXX.crt



    SetEnvIf User-Agent ".*MSIE.*"
      nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

    <Files ~ ".(cgi|shtml|phtml|php3?)$">
      SSLOptions +StdEnvVars
    </Files>

    <Directory "/srv/www/htdocs/confixx/html/cgi-bin">
      SSLOptions +StdEnvVars
    </Directory>

  </IfModule>


  CustomLog /var/log/apache2/XXX_access.ssl.log "%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i""
  ErrorLog /var/log/apache2/XXX_error.ssl.log


</VirtualHost>

Include /etc/apache2/confixx_vhost.conf
# ^- Dieser Eintrag sollte unbedingt am Ende der Datei bleiben
## /CONFIXX

wgot
RSAC
Posts: 1707
Joined: 2003-07-06 02:03

Re: suPHP - PHP Quellcode wird angezeigt

Post by wgot » 2008-03-08 14:46

Hallo,

versuch mal in confixx_mhost.conf

<Directory "/srv/www/htdocs">
suPHP_AddHandler x-httpd-php
</Directory>

welche PHP-Tags hat das Script, sind ShortOpenTags enabled?

Gruß, Wolfgang

jensi
Posts: 7
Joined: 2008-03-07 20:09

Re: suPHP - PHP Quellcode wird angezeigt

Post by jensi » 2008-03-09 11:08

Die Suse Version war nicht mit der Confixxversion kompatibel (bzw. nicht ohne weiteres). Mit Debian Etch läuft es nun wunderbar - trotzdem danke für die Hilfe.