hirokawa Wed Jul 11 09:10:25 2001 EDT
Added files:
/phpdoc/ja/features safe-mode.xml
/phpdoc/ja/functions iconv.xml
Modified files:
/phpdoc/ja/functions pdf.xml
Log:
added iconv.xml ad safe-mode.xml in japanese php manual translation.
Index: phpdoc/ja/functions/pdf.xml
diff -u phpdoc/ja/functions/pdf.xml:1.24 phpdoc/ja/functions/pdf.xml:1.25
--- phpdoc/ja/functions/pdf.xml:1.24 Sat Jul 7 18:26:04 2001
+++ phpdoc/ja/functions/pdf.xml Wed Jul 11 09:10:24 2001
@@ -333,8 +333,8 @@
<programlisting role="php">
<?php
$len = filesize($filename);
-header("Content-type: application/pdf");
header("Content-Length: $len");
+header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=foo.pdf");
readfile($filename);
?>
Index: phpdoc/ja/features/safe-mode.xml
+++ phpdoc/ja/features/safe-mode.xml
<chapter id="features.safe-mode">
<title>セーフモード</title>
<para>
セーフモードは、共有サーバにおけるセキュリティ上の問題に対する解決策
です。この問題をPHPのレベルで解決しようするのはアーキテクチャ上正しく
ありません。しかし、WebサーバやOSのレベルでの代替策はあまり現実的では
ないため、多くのユーザ、特にISPでは、セーフモードが現在使用されていま
す。
</para>
<para>
セーフモードを制御する設定ディレクティブには、次のようなものがあります。
<programlisting role="ini">
safe_mode = Off
open_basedir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
</programlisting>
</para>
<para>
セーフモードがonの場合、PHPは、現在のスクリプトの所有者がファイル関数に
より処理されているファイルの所有者に一致するかどうかを調べます。例えば、
<programlisting role="ls">
-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php
-rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd
</programlisting>
以下のscript.php を実行すると、
<programlisting role="php">
<?php
readfile('/etc/passwd');
?>
</programlisting>
セーフモードが有効な場合、以下のようなエラーが出力されます。
<programlisting role="php">
Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not
allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2
</programlisting>
</para>
<para>
safe_modeの代わりに、open_basedir
ディレクトリを設定すると、全ての
ファイル操作は、指定したディレクトリ以下にあるものに制限されます。
例を以下に示します。(Apache httpd.ini の例)
<programlisting role="ini">
<Directory /docroot>
php_admin_value open_basedir /docroot
</Directory>
</programlisting>
このopen_basedir設定で同じscript.phpを実行した場合、以下のような結果
となります。
<programlisting role="php">
Warning: open_basedir restriction in effect. File is in wrong directory in
/docroot/script.php on line 2
</programlisting>
</para>
<para>
個々の関数を無効にすることも可能です。以下の設定をphp.iniファイルに
追加してみましょう。
<programlisting role="ini">
disable_functions readfile,system
</programlisting>
この場合、次のような出力となります。
<programlisting role="php">
Warning: readfile() has been disabled for security reasons in
/docroot/script.php on line 2
</programlisting>
</para>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
Index: phpdoc/ja/functions/iconv.xml
+++ phpdoc/ja/functions/iconv.xml
<reference id="ref.iconv">
<title>iconv 関数</title>
<titleabbrev>iconv</titleabbrev>
<partintro>
<para>
このモジュールには、iconvライブラリ関数へのインターフェースが含まれ
ています。この関数を使用するには、PHPインタプリタをコンパイルする際
に --with-iconv
を付けてコンパイルをする必要があります。この際、
iconv()関数が標準Cライブラリに存在するか、システムにlibiconvがイン
ストールされている必要があります。
libiconv ライブラリは、<ulink url="&url.libiconv;">
&url.libiconv;</ulink>で入手可能です。
</para>
<para>
iconvライブラリ関数は、種々のエンコーディングでエンコードされたファ
イルの文字集合を相互に変換します。サポートされる文字集合は、システム
のiconv()の実装に依存します。いくつかのシステムではiconv()関数は意図
した通りに動作しない可能性があります。この場合、libiconvライブラリを
インストールする必要があります。
</para>
</partintro>
<refentry id="function.iconv">
<refnamediv>
<refname>iconv</refname>
<refpurpose>
リクエストした文字エンコーディングに文字列を変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>iconv</function></funcdef>
<paramdef>string <parameter>in_charset</parameter></paramdef>
<paramdef>string <parameter>out_charset</parameter></paramdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
It converts the string <parameter>string</parameter> encoded in
<parameter>in_charset</parameter> to the string encoded in
<parameter>out_charset</parameter>. It returns the converted
string or &false;, if it fails.
</para>
<para>
<example>
<title><function>iconv</function> の例</title>
<programlisting role="php">
echo iconv("ISO-8859-1","UTF8","This is test.");
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.iconv-get-encoding">
<refnamediv>
<refname>iconv_get_encoding</refname>
<refpurpose>
文字エンコーディング変換のカレントの設定を取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>iconv_get_encoding</function></funcdef>
<paramdef>string
<parameter><optional>type</optional></parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>ob_iconv_handler</function>のカレントの設定を含む配列
を返します。エラーの場合は、&false;を返します。
</para>
<para>
<function>iconv_set_encoding</function> および
<function>ob_iconv_handler</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.iconv-set-encoding">
<refnamediv>
<refname>iconv_set_encoding</refname>
<refpurpose>
文字エンコーディング変換用の設定を行なう
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>iconv_set_encoding</function></funcdef>
<paramdef>string <parameter>type</parameter></paramdef>
<paramdef>string <parameter>charset</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<parameter>type</parameter> の値を
<parameter>charset</parameter>に&true;を返します。エラー時には、
&false; を返します。
</para>
<para>
<example>
<title><function>iconv_set_encoding</function> の例</title>
<programlisting role="php">
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "ISO-8859-1");
</programlisting>
</example>
</para>
<para>
<function>iconv_get_encoding</function> および
<function>ob_iconv_handler</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ob-iconv-handler">
<refnamediv>
<refname>ob_iconv_handler</refname>
<refpurpose>
出力バッファハンドラとして文字エンコーディングを変換する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>ob_iconv_handler</function></funcdef>
<paramdef>string
<parameter>contents</parameter>
</paramdef>
<paramdef>int
<parameter>status</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
<parameter>internal_encoding</parameter> でエンコードされた文字列を
<parameter>output_encoding</parameter>に変換します。
</para>
<para>
<parameter>internal_encoding</parameter> および
<parameter>output_encoding</parameter> は、
<function>iconv_set_encoding</function> または設定ファイルで定義され
ている必要があります。
</para>
<para>
<example>
<title><function>ob_iconv_handler</function> の例</title>
<programlisting role="php">
ob_start("ob_iconv_handler"); // 出力バッファリングを開始
</programlisting>
</example>
</para>
<para>
<function>iconv_get_encoding</function> および
<function>iconv_set_encoding</function>も参照下さい。
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->