Page 1 of 1
Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 14:01
by diavolo86
Hallo,
letztes Wochenende hat unser Linuxadmin unseren Webserver Aktualisiert von Debian Sarge auf Etch.
Dazu hat er auf PHP5 aktualisiert.
Alles inkl. aktuellen Sicherheitsupdates usw.!
Apache Version: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
Seit diesem Update erhalte ich bei mehren FTP funktionen z.B. ftp_nlist oder ftp_rawliste diese Fehlermeldung!
"ftp_nlist() [function.ftp-nlist]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s):"
Könnt ihr mir dabei helfen???
Danke
MfG.
Diavolo
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 14:58
by flo
Aus php.ini ...
Code: Select all
; open_basedir, if set, limits all file operations to the defined directory
;open_basedir =
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 15:27
by diavolo86
Ich hab schon mehrere Einstellungen in der PHP.INI geprüft, also safe_mode on oder off und auch das /tmp in die von Ihnen angegeben zeile eingefügt und ausgeklammert.
Derzeit hab ich die Einstellungen wieder wie von Ihnen angegeben aktiv.
Hier ein ausschnitt aus der PHP.INI
Code: Select all
;
; Safe Mode
;
; NOTE: this is considered a "broken" security measure.
; Applications relying on this feature will not recieve full
; support by the security team. For more information please
; see /usr/share/doc/php5-common/README.Debian.security
;
safe_mode = On
; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
safe_mode_gid = Off
; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
safe_mode_include_dir =
; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
safe_mode_exec_dir =
; Setting certain environment variables may be a potential security breach.
; This directive contains a comma-delimited list of prefixes. In Safe Mode,
; the user may only alter environment variables whose names begin with the
; prefixes supplied here. By default, users will only be able to set
; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
;
; Note: If this directive is empty, PHP will let the user modify ANY
; environment variable!
safe_mode_allowed_env_vars = PHP_
; This directive contains a comma-delimited list of environment variables that
; the end user won't be able to change using putenv(). These variables will be
; protected even if safe_mode_allowed_env_vars is set to allow to change them.
safe_mode_protected_env_vars = LD_LIBRARY_PATH
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; NOTE: this is considered a "broken" security measure.
; Applications relying on this feature will not recieve full
; support by the security team. For more information please
; see /usr/share/doc/php5-common/README.Debian.security
;
; open_basedir =
MfG.
Diavolo
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 17:07
by adjustman
@all
kann das ein Bug in php5 von Etch sein?
Ich nehme an, dass die php.ini vorher (php4) => nachher (php5)
nicht verändert wurde!?
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 17:10
by Joe User
php_admin_value
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 17:18
by diavolo86
Es wurde eine neue PHP.INI genommen da mehrere Updates durchgeführt wurde.
save_mode Konfiguration hab ich aber schon wieder so wie vorher eingestellt.
@ Joe User
Was meinst du damit?? Kann den eintrag nich in meiner PHP.INI finden
Unser Linuxadmin ist leider erst heut abend wieder am PC ich denke er wird meine ausführungen noch ergänzen ;)
Sorry wenn vieleicht ein paar dinge fehlen.
MfG.
Diavolo
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 21:27
by flo
Code: Select all
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
Ich weiß nicht, warum Du da mit dem Safe Mode rumdoktorst!?
Prinzipiell gehört das - Ausnahmen bestätigen die Regel - in den virtuellen Host eingetragen, um halbwegs sinnvoll zu sein.
Bei mir steht da z.B.
Code: Select all
php_admin_value open_basedir "/usr/local/bin:/usr/bin:/home/user:/usr/local/lib/php"
php_admin_value upload_tmp_dir "/home/user/phptemp"
php_admin_value upload_max_filesize "30M"
php_admin_value max_execution_time "120"
Gerade das Thema "open basedir" dürfte recht gut dokumentiert sein. Und natürlich muß der Apache mindestens reloaded werden, um die Config neu einzulesen.
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:14
by new_mac
Hallo,
ich update den Server immer. UND es ist tatsächlich so:
Das open_base hat sich nicht geändert (Confixx Standard)
Code: Select all
php_admin_value open_basedir /var/www/web63/html/:/var/www/web63/phptmp/:/var/www/web63/files/:/var/www/web63/atd/
Auch die php.ini wurde nicht verändert. NUR auf php5 upgraded.
Deshalb bin ich auch der Meinung, dass es sich um einen Bug bei Etch
handelt.
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:16
by flo
Was sagen die Werte in phpinfo() ?
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:23
by new_mac
flo wrote:Was sagen die Werte in phpinfo() ?
welche meinst? Console sagt:
Code: Select all
php -r "phpinfo(INFO_GENERAL);"
phpinfo()
PHP Version => 5.2.0-8+etch7
System => Linux srv1 2.6.8-3-686 #1 Tue Dec 5 21:26:38 UTC 2006 i686
Build Date => Jul 2 2007 21:44:16
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/imap.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini,
/etc/php5/cli/conf.d/xmlrpc.ini,
/etc/php5/cli/conf.d/xsl.ini
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:28
by flo
Natürlich die entsprechenden - möglichst auch im Webserver-Kontext, CLI ist da eher ungeeignet :-)
Configuration File (php.ini) Path => /etc/php5/cli/php.ini
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:33
by flo
BTW: Wie kommt Dein Rechner dazu, "/tmp" benutzen zu wollen? Ist kein phptemp vergeben? Im den Basedirs ist das doch angegeben?
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:47
by new_mac
flo wrote:BTW: Wie kommt Dein Rechner dazu, "/tmp" benutzen zu wollen? Ist kein phptemp vergeben? Im den Basedirs ist das doch angegeben?
das ist ne gute Frage. Hier das Script, dass das auslöst:
Code: Select all
<?
@include ("db_connect.php");
// Herstellen der Basis-Verbindung
$conn_id = ftp_connect("$FTP_host");
// Einloggen mit Benutzername und Kennwort
$login_result = ftp_login($conn_id, "$FTP_user", "$FTP_pass");
// Upload der Datei
$list = ftp_rawlist($conn_id, "$verzeichniss");
// Schließen des FTP-Streams
ftp_quit($conn_id);
$i = 0;
foreach ($list as $current) {
$split = preg_split("[ ]", $current, 9, PREG_SPLIT_NO_EMPTY);
if ($split[0] != "total") {
$parsed[$i]['isdir'] = $split[0]{0} === "d";
$parsed[$i]['perms'] = $split[0];
$parsed[$i]['number'] = $split[1];
$parsed[$i]['owner'] = $split[2];
$parsed[$i]['group'] = $split[3];
$parsed[$i]['size'] = $split[4];
$parsed[$i]['month'] = $split[5];
$parsed[$i]['day'] = $split[6];
$parsed[$i]['time/year'] = $split[7];
$parsed[$i]['name'] = $split[8];
$ftp_liste[$i] = $parsed[$i]['name'];
$ftp_liste_typ[$i] = $parsed[$i]['isdir'];
$i++;
}
}
?>
Bin nicht der php-coder
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:50
by new_mac
und hier die kompl. Fehlerausg.:
Code: Select all
Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/web63/html/:/var/www/web63/phptmp/:/var/www/web63/files/:/var/www/web63/atd/) in /var/www/web63/html/admin/module/ftp_liste.php on line 9
Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory. in /var/www/web63/html/admin/module/ftp_liste.php on line 9
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 22:57
by smoove
http://bugs.php.net/bug.php?id=39386
Lösung wäre also mit putenv() das Temp Verzeichnis für die Scriptlaufzeit mit dem von dir gewünschten zu überschreiben.
mfg. smoove :)
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 23:06
by new_mac
smoove wrote:Lösung wäre also ..
mmh, der Bugtracker ist von 2006 und sagt nicht explizit,
dass das ein php5 Bug ist. Wie gesagt, bei php4 ging laut
diavolo86 ja alles. Hab da auch keine Klagen gehört. ;)
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 23:13
by smoove
...
ganz oben steht:
Version: 5.2.0
OS: Linux Debian
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 23:17
by new_mac
na gut @smoove völlig überlesen ;) Danke.
Da muss diavolo86 wohl seine Scripte nachbessern.
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 23:33
by diavolo86
mhhh irgendwie bringt mir das nur Fehler... is das so korekt??
Wenn ja warum bringt das bei mir Fehler??? :(
putenv("/var/www/web63/phptmp/");
THX schonmal für die guten und schnellen Antworten ;)
MfG.
Diavolo
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 23:43
by flo
/var/www/web63/phptmp/
Weil der Inhalt für die ENV fehlt!? :-)
Im Ernst: Das ist der Wert - aber welche Variable möchtest Du setzen? TEMPDIR?
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-05 23:45
by Joe User
Warum schaust Du nicht endlich in Deine Webserverconfig und änderst dort den entsprechenden php_admin_value?
Re: Server und PHP Update "open_basedir restriction in effect. File(/tmp)"
Posted: 2007-10-06 00:18
by new_mac
Joe User wrote:Warum schaust Du nicht endlich in Deine Webserverconfig und änderst dort den entsprechenden php_admin_value?
mit Confixx im Gepäck? Die vhosts sind doch definiert