PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

PHP をコマンドラインから使用する> <セーフモード
Last updated: Fri, 10 Oct 2008

view this page in

セーフモードにより制限を受けるか無効となる関数

safe-modeにより制限される 関数のリストを示します。ただし、まだ、不完全で、不正確である可能性 があります。

セーフモードで制限される関数
関数 制限
dbmopen() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
dbase_open() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
filepro() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
filepro_rowcount() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
filepro_retrieve() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
ifx_*() sql_safe_mode restrictions, (!= safe mode)
ingres_*() sql_safe_mode restrictions, (!= safe mode)
mysql_*() sql_safe_mode restrictions, (!= safe mode)
pg_lo_import() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
posix_mkfifo() 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
putenv() iniディレクティブのsafe_mode_protected_env_vars および safe_mode_allowed_env_varsに依存します。 putenv()のドキュメントも参照ください。
move_uploaded_file() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
chdir() 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
dl() この関数は、PHP が safe-mode で動作している場合は無効となります。
backtick operator この関数は、PHP が safe-mode で動作している場合は無効となります。
shell_exec() (functional equivalent of backticks) この関数は、PHP が safe-mode で動作している場合は無効となります。
exec() safe_mode_exec_dir の中でのみ実行可能です。現実的な理由により、現在、実行パスに ..を含めることは許可されていません。 escapeshellcmd()はこの関数の引数にたいして 実行できます。
system() safe_mode_exec_dir の中でのみ実行可能です。現実的な理由により、現在、実行パスに ..を含めることは許可されていません。 escapeshellcmd()はこの関数の引数にたいして 実行できます。
passthru() safe_mode_exec_dir の中でのみ実行可能です。現実的な理由により、現在、実行パスに ..を含めることは許可されていません。 escapeshellcmd()はこの関数の引数にたいして 実行できます。
popen() safe_mode_exec_dir の中でのみ実行可能です。現実的な理由により、現在、実行パスに ..を含めることは許可されていません。 escapeshellcmd()はこの関数の引数にたいして 実行できます。
fopen() 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
mkdir() 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
rmdir() 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
rename() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
unlink() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
copy() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。 ( source および target において)
chgrp() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
chown() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。
chmod() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 加えて、SUID, SGID, スティキービットを設定する ことはできません
touch() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。
symlink() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。 (注意: ターゲットのみが 確認されます)
link() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。 (注意: ターゲットのみが 確認されます)
apache_request_headers() セーフモードでは、'authorization'で始まるヘッダ(大文字小文字は 区別されません)は返されません。
header() セーフモードでは、WWW-Authenticate (HTTP認証)ヘッダをセットする場合に realmパートに スクリプトのUIDがセットされます。
PHP_AUTH variables セーフモードでは、PHP_AUTH_USER, PHP_AUTH_PW, AUTH_TYPE$_SERVERに含まれません。 にも関わらず、USERにREMOTE_USERを使うことは未だ可能です。 (PHP4.3.0以降でのみ影響)
highlight_file(), show_source() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。 (注: PHP 4.2.1以降でのみ影響する)
parse_ini_file() 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。 (注: PHP 4.2.1以降でのみ影響する)
set_time_limit() PHPがセーフモードで実行されている場合は影響を受けません。
max_execution_time PHPがセーフモードで実行されている場合は影響を受けません。
mail() セーフモードでは、5番目のパラメータが無効となります。(注意: PHP 4.2.3以降のみ適用)
すべてのファイルシステム関数およびストリーム関数 処理を行うファイル/ディレクトリが実行するスクリプトと 同じUIDを有しているかどうかを確認します。 処理を行うディレクトリが実行するスクリプトと同じ UID を有しているかどうかを確認します。 (php.ini オプション safe_mode_include_dir を参照ください)。



add a note add a note User Contributed Notes
セーフモードにより制限を受けるか無効となる関数
tschmieder at bitworks dot de
22-Sep-2007 03:04
refers to the previuos posting of

bananarama
15-May-2006 10:11

"all file-handling and -management functions are restricted, just in case someones wondering why they're not listed here.
a script can run these functions on files without errors, if the files were created (are owned) by the same UID, the script was created (is owned) by."

.... or if the directory, in which the file is located, has the same UID as the script, which tries to use a file in that directory...
bananarama
15-May-2006 10:11
all file-handling and -management functions are restricted, just in case someones wondering why they're not listed here.
a script can run these functions on files without errors, if the files were created (are owned) by the same UID, the script was created (is owned) by.

example:
you upload a script, it is owned by UID 720. you upload a picture, it is owned by UID 720. the script creates a thumbnail of the picture. the thumb is owned by UID 30 (the server/apache). this makes it impossible (?) to run a gallery script, which checks for newly uploaded pictures in order to create and display thumbs of them if you want to check, if a thumbnail already exists. the script would be owned by UID 720, the thumb by UID 30.
you could upload a script which creates a file (e.g. from a text file) with .php ending. this script would be owned by UID 30 and could access the thumbs, but it couldnt read the upload pictures.

<?
  $data
= fread(fopen("test.txt", "r"), filesize("test.txt"));
  
 
$file = "test.php";  
  if (!
$file_handle = fopen($file,"a")) { echo "Cannot open file"; } 
  if (!
fwrite($file_handle, $data)) { echo "Cannot write to file"; }   
 
fclose($file_handle);
 
 
chmod("test.php", 0777);
?>
zauker
21-Mar-2006 11:57
The SAFE_MODE handling of glob() needs a checkup for security reasons.

In short - always with SAFE_MODE on:

1) glob() can still fetch all filenames in a directory not owned by the
same UID as the user, if just the first file in the directory (or more
specific, the glob-pattern) happens to be owned by the same user as the
PHP-script.

2a) No warning is raised if glob is used on another owner's directory
and there is no match.

2b) In those cases where SAFE_MODE correctly prohibits glob() from
fetching a list of files, the warning still discloses the first
filename.

Solution: glob() in SAFE_MODE should be restricted in the same way as
opendir() is

see the link http://bugs.php.net/bug.php?id=28932
Jan
23-Oct-2005 11:46
It seems that glob and file_exists functions are also restricted in safe-mode.
lionel at mamane dot lu
31-Mar-2005 03:05
readfile() is probably also limited by safe mode

 
show source | credits | sitemap | contact | advertising | mirror sites