Apache2, PHP4: exec() funktioniert nicht

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Apache2, PHP4: exec() funktioniert nicht

    Hallo Leute.

    Das Thema gab es schon öfters. Hab schon viel probiert. Nun schilder ich Euch mal das Problem, vielleicht habt Ihr eine Idee.

    Test-Programm: http://alfalinux.sourceforge.net/pcom.php3

    Ich habe die pcom.php3 auf mein Server gelegt und mit dem firefox gestartet.

    Nun das vorgeschlagene "ls -la" ausführen lassen.

    Ergebnis: "Das schlechteste, was man haben kann" -> rein gar nichts.

    In der error.log is nichts drin.
    In der access.log folgender letzter Eintrag:

    Code:
    62.101.xxx.xxx - - [29/Jun/2008:20:40:18 +0200] "GET /pcom.php3?command=ls+-la&output=... HTTP/1.0" 200 775 "http://xxx.dyndns.org/pcom.php3" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
    Hier meine Einträge in den verschiedenen Files:

    * mods-enabled/php4.conf
    Code:
    <IfModule mod_php4.c>
      AddType application/x-httpd-php .php .phtml .php3
      AddType application/x-httpd-php-source .phps
    </IfModule>
    * php4/apache2/php.ini
    Code:
    ...
    safe_mode = Off
    ...
    disable_functions =
    */sites-enabled/000-default
    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    #RedirectMatch ^/$ /apache2-default/
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
            ServerSignature On
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    * und zuletzt das document-root Verzeichnis:

    Code:
    noname:/etc/php4/apache2# ls /var/www -all
    total 68
    drwxr-xr-x  4 root     root      4096 Jun 29 21:01 .
    drwxr-xr-x 14 root     root      4096 Feb 20 13:33 ..
    -rw-r--r--  1 root     root     12288 Jun 29 21:02 .pcom.php3.swp
    lrwxrwxrwx  1 root     root         6 Jun 22 04:03 daten -> /daten
    -rw-r--r--  1 root     root       412 Jun 29 17:24 first.html
    drwxr-xr-x  4 root     root     20480 Jun 24 10:52 imageflow
    -rw-r--r--  1 root     root       393 Jun 29 17:24 index.html
    -rw-r--r--  1 root     root      5500 Jun 29 19:38 pcom.jpg
    -rwxrwxrwx  1 root     root      1469 Jun 29 21:01 pcom.php3
    drwxr-xr-x  2 root     root      4096 Jun 29 16:29 pics
    -rwxrwxrwx  1 www-data www-data  1099 Jun 29 21:05 unten.php
    noname:/etc/php4/apache2#
    Nun, seht ihr irgendwelche Fehler?

    gruß aus Norwegen, Lenny

  • #2
    Ergebnis: "Das schlechteste, was man haben kann" -> rein gar nichts.
    Na, unter Linux nicht notwendigerweise!

    Mit exec() und Konsorten gibts immer irgendwelche Probleme, das ist normal.

    Probiere erstmal, ein Skript zu bauen, das den ls-Befehl via exec() oder was für einen Befehl dein PHP-Skript eben verwendet, ausführt und das Ergebnis zurückgibt.

    Schaue dazu in den User Contributed Notes zu exec():
    http://de2.php.net/manual/en/function.exec.php

    Dort gibt es schöne Tricks wie z.B.

    PHP-Code:
    exec("ls -la 2>&1"$ausgabe); 
    Um sich auf jeden Fall die Errors ausgeben zu lassen, und vieles mehr.

    OffTopic:

    Deutschland hat verloren! Schade.

    Kommentar

    Lädt...
    X