1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249
|
<chapter id="configuration">
<title>Configuration</title>
<simpara>
<sect1 id="php3.ini">
<title>The php3.ini file</title>
<simpara>
The <filename>php3.ini</filename> file is read when PHP's parser
starts up. For the server module versions of PHP, this happens
only once when the web server is started. For the
<acronym>CGI</acronym> version, it happens on every invocation.
</simpara>
<simpara>
Just about every directive listed here has a corresponding Apache
<filename>httpd.conf</filename> directive. Simply prepend
<emphasis>php3_</emphasis> to the start of the directive names listed
here.
</simpara>
<sect2 id="ini.sect.general">
<title>General Configuration Directives</title>
<para>
<variablelist>
<varlistentry id="ini.auto-append-file">
<term>
<parameter>auto_append_file</parameter>
<type>string</type>
</term>
<listitem>
<para>
Specifies the name of a file that is automatically parsed
after the main file. The file is included as if it was
called with the <function>include</function> function, so
<link linkend="ini.include-path">include_path</link> is used.
<para>
The special value <systemitem
class="constant">none</systemitem> disables auto-appending.
<note>
<simpara>
If the script is terminated with <function>exit</function>,
auto-append will <emphasis>not</emphasis> occur.
</note>
</listitem>
</varlistentry>
<varlistentry id="ini.auto-prepend-file">
<term>
<parameter>auto_prepend_file</parameter>
<type>string</type>
</term>
<listitem>
<para>
Specifies the name of a file that is automatically parsed
before the main file. The file is included as if it was
called with the <function>include</function> function, so
<link linkend="ini.include-path">include_path</link> is used.
<para>
The special value <systemitem
class="constant">none</systemitem> disables auto-prepending.
</listitem>
</varlistentry>
<varlistentry id="ini.cgi-ext">
<term>
<parameter>cgi_ext</parameter>
<type>string</type>
</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.display-errors">
<term>
<parameter>display_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
This determines whether errors should be printed to the screen
as part of the HTML output or not.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.doc-root">
<term>
<parameter>doc_root</parameter>
<type>string</type>
</term>
<listitem>
<para>
PHP's "root directory" on the server. Only used if non-empty. If
PHP is configured with <link linkend="ini.safe-mode">safe
mode</link>, no files outside this directory are served.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.engine">
<term>
<parameter>engine</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
This directive is really only useful in the Apache module version
of PHP. It is used by sites that would like to turn PHP parsing on
and off on a per-directory or per-virtual server basis. By putting
<userinput>php3_engine off</userinput> in the appropriate places in
the <filename>httpd.conf</filename> file, PHP can be enabled or
disabled.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.error-log">
<term>
<parameter>error_log</parameter>
<type>string</type>
</term>
<listitem>
<para>
Name of file where script errors should be logged. If the special
value <literal>syslog</literal> is used, the errors are sent to the
system logger instead. On UNIX, this means syslog(3) and on
Windows NT it means the event log. The system logger is not
supported on Windows 95.
</listitem>
</varlistentry>
<varlistentry id="ini.error-reporting">
<term>
<parameter>error_reporting</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Set the error reporting level. The parameter is an integer
representing a bit field. Add the values of the error
reporting levels you want.
<table>
<title>Error Reporting Levels</title>
<tgroup cols="2">
<thead>
<row>
<entry>bit value</entry>
<entry>enabled reporting</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>normal errors</entry>
</row>
<row>
<entry>2</entry>
<entry>normal warnings</entry>
</row>
<row>
<entry>4</entry>
<entry>parser errors</entry>
</row>
<row>
<entry>8</entry>
<entry>non-critical style-related warnings</entry>
</row>
</tbody>
</tgroup>
</table>
The default value for this directive is 7 (normal errors, normal
warnings and parser errors are shown).
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.open-basedir">
<term>
<parameter>open_basedir</parameter>
<type>string</type>
</term>
<listitem>
<para>
Limit the files that can be opened by PHP to the specified
directory-tree.
</para>
<para>
When a script tries to open a file with,
for example, fopen or gzopen, the location of the file is
checked. When the file is outside the specified directory-tree,
PHP will refuse to open it. All symbolic links are resolved,
so it's not possible to avoid this restriction with a symlink.
</para>
<para>
The special value <systemitem class="constant">.</systemitem>
indicates that the directory in which the script is stored will
be used as base-directory.
</para>
<para>
The default is to allow all files to be opened.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.gpc-order">
<term>
<parameter>gpc_order</parameter>
<type>string</type>
</term>
<listitem>
<para>
Set the order of GET/POST/COOKIE variable parsing. The
default setting of this directive is "GPC". Setting this to
"GP", for example, will cause PHP to completely ignore cookies
and to overwrite any GET method variables with POST-method
variables of the same name.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.include-path">
<term>
<parameter>include_path</parameter>
<type>string</type>
</term>
<listitem>
<para>
Specifies a list of directories where the
<function>require</function>, <function>include</function> and
<function>fopen_with_path</function> functions look for files. The
format is like the system's <envar>PATH</envar> environment
variable: a list of directories separated with a colon in UNIX or
semicolon in Windows.
<example>
<title>UNIX include_path</title>
<programlisting role=php3.ini>
include_path=.:/home/httpd/php-lib
</programlisting>
</example>
<example>
<title>Windows include_path</title>
<programlisting role=php3.ini>
include_path=.;c:\www\phplib
</programlisting>
</example>
The default value for this directive is <literal>.</literal> (only
the current directory).
</listitem>
</varlistentry>
<varlistentry id="ini.isapi-ext">
<term>
<parameter>isapi_ext</parameter>
<type>string</type>
</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.log-errors">
<term>
<parameter>log_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Tells whether script error messages should be logged to the
server's error log. This option is thus server-specific.
</listitem>
</varlistentry>
<varlistentry id="ini.magic-quotes-gpc">
<term>
<parameter>magic_quotes_gpc</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Sets the magic_quotes state for GPC (Get/Post/Cookie) operations.
When magic_quotes are on, all ' (single-quote), " (double quote),
\ (backslash) and NUL's are escaped with a backslash automatically.
If magic_quotes_sybase is also on, a single-quote is escaped with a
single-quote instead of a backslash.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.magic-quotes-runtime">
<term>
<parameter>magic_quotes_runtime</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If magic_quotes_runtime is enabled, most functions that return data
from any sort of external source including databases and text files
will have quotes escaped with a backslash.
If magic_quotes_sybase is also on, a single-quote is escaped with a
single-quote instead of a backslash.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.magic-quotes-sybase">
<term>
<parameter>magic_quotes_sybase</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If magic_quotes_sybase is also on, a single-quote is escaped with a
single-quote instead of a backslash if magic_quotes_gpc or magic_quotes_runtime
is enabled.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.max-execution-time">
<term>
<parameter>max_execution_time</parameter>
<type>integer</type>
</term>
<listitem>
<para>
This sets the maximum time in seconds a script is allowed to
take before it is terminated by the parser. This helps
prevent poorly written scripts from tieing up the server.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.memory-limit">
<term>
<parameter>memory_limit</parameter>
<type>integer</type>
</term>
<listitem>
<para>
This sets the maximum amount of memory in bytes that a script
is allowed to allocate. This helps prevent poorly written
scripts for eating up all available memory on a server.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.nsapi-ext">
<term>
<parameter>nsapi_ext</parameter>
<type>string</type>
</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.short-open-tag">
<term>
<parameter>short_open_tag</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Tells whether the short form (<userinput><? ?></userinput>of
PHP's open tag should be allowed. If you want to use PHP in
combination with XML, you have to disable this option. If
disabled, you must use the long form of the open tag
(<userinput><?php ?></userinput>).
</listitem>
</varlistentry>
<varlistentry id="ini.sql.safe-mode">
<term>
<parameter>sql.safe_mode</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.track-errors">
<term>
<parameter>track_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If enabled, the last error message will always be present in the
global variable <symbol>$php_errormsg</symbol>.
</listitem>
</varlistentry>
<varlistentry id="ini.track-vars">
<term>
<parameter>track_vars</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If enabled, GET, POST and cookie input can be found in the global
associative arrays <symbol>$HTTP_GET_VARS</symbol>,
<symbol>$HTTP_POST_VARS</symbol> and
<symbol>$HTTP_COOKIE_VARS</symbol>, respectively.
</listitem>
</varlistentry>
<varlistentry id="ini.upload-tmp-dir">
<term>
<parameter>upload_tmp_dir</parameter>
<type>string</type>
</term>
<listitem>
<para>
The temporary directory used for storing files when doing file
upload. Must be writable by whatever user PHP is running as.
</listitem>
</varlistentry>
<varlistentry id="ini.user-dir">
<term>
<parameter>user_dir</parameter>
<type>string</type>
</term>
<listitem>
<para>
The base name of the directory used on a user's home directory for
PHP files, for example <literal>public_html</literal>.
</listitem>
</varlistentry>
<varlistentry id="ini.warn-plus-overloading">
<term>
<parameter>warn_plus_overloading</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If enabled, this option makes PHP output a warning when the plus
(<literal>+</literal>) operator is used on strings. This is to
make it easier to find scripts that need to be rewritten to using
the string concatenator instead (<literal>.</literal>).
</listitem>
</varlistentry>
</variablelist>
</para>
</sect2>
<sect2 id="ini.sect.mail">
<title>Mail Configuration Directives</title>
<variablelist>
<varlistentry id="ini.smtp">
<term>
<parameter>SMTP</parameter>
<type>string</type>
</term>
<listitem>
<para>
DNS name or IP address of the SMTP server PHP under Windows should
use for mail sent with the <function>mail</function> function.
</listitem>
</varlistentry>
<varlistentry id="ini.sendmail-from">
<term>
<parameter>sendmail_from</parameter>
<type>string</type>
</term>
<listitem>
<para>
Which "From:" mail address should be used in mail sent from PHP
under Windows.
</listitem>
</varlistentry>
<varlistentry id="ini.sendmail-path">
<term>
<parameter>sendmail_path</parameter>
<type>string</type>
</term>
<listitem>
<para>
Where the <command>sendmail</command> program can be found, usually
<filename>/usr/sbin/sendmail</filename> or
<filename>/usr/lib/sendmail</filename> <command>configure</command>
does an honest attempt of locating this one for you and set a
default, but if it fails, you can set it here.
<para>
Systems not using sendmail should set this directive to the sendmail
wrapper/replacement their mail system offers, if any. For example,
<ulink url="http://www.qmail.org/">Qmail</ulink> users can normally
set it to <filename>/var/qmail/bin/sendmail</filename>.
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.safe-mode">
<title>Safe Mode Configuration Directives</title>
<variablelist>
<varlistentry id="ini.safe-mode">
<term>
<parameter>safe_mode</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to enable PHP's safe mode.
</listitem>
</varlistentry>
<varlistentry id="ini.safe-mode-exec-dir">
<term>
<parameter>safe_mode_exec_dir</parameter>
<type>string</type>
</term>
<listitem>
<para>
If PHP is used in safe mode, <function>system</function> and the
other functions executing system programs refuse to start programs
that are not in this directory.
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.debugger">
<title>Debugger Configuration Directives</title>
<variablelist>
<varlistentry id="ini.debugger.host">
<term>
<parameter>debugger.host</parameter>
<type>string</type>
</term>
<listitem>
<para>
DNS name or IP address of host used by the debugger.
</listitem>
</varlistentry>
<varlistentry id="ini.debugger.port">
<term>
<parameter>debugger.port</parameter>
<type>string</type>
</term>
<listitem>
<para>
Port number used by the debugger.
</listitem>
</varlistentry>
<varlistentry id="ini.debugger.enabled">
<term>
<parameter>debugger.enabled</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether the debugger is enabled.
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.extension">
<title>Extension Loading Directives</title>
<variablelist>
<varlistentry id="ini.enable-dl">
<term>
<parameter>enable_dl</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
This directive is really only useful in the Apache module
version of PHP. You can turn dynamic loading of PHP
extensions with <function>dl</function> on and off per
virtual server or per directory.
</para>
<para>
The main reason for turning dynamic loading off is security. With
dynamic loading, it's possible to ignore all the safe_mode and
open_basedir restrictions.
</para>
<para>
The default is to allow dynamic loading, except when using
safe-mode. In safe-mode, it's always imposible to use
<function>dl</function>.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.extension-dir">
<term>
<parameter>extension_dir</parameter>
<type>string</type>
</term>
<listitem>
<para>
In what directory PHP should look for dynamically loadable
extensions.
</listitem>
</varlistentry>
<varlistentry id="ini.extension">
<term>
<parameter>extension</parameter>
<type>string</type>
</term>
<listitem>
<para>
Which dynamically loadable extensions to load when PHP starts up.
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.mysql">
<title>MySQL Configuration Directives</title>
<variablelist>
<varlistentry id="ini.mysql.allow-persistent">
<term>
<parameter>mysql.allow_persistent</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to allow persistent MySQL connections.
</listitem>
</varlistentry>
<varlistentry id="ini.mysql.max-persistent">
<term>
<parameter>mysql.max_persistent</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of persistent MySQL connections per process.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.mysql.max-links">
<term>
<parameter>mysql.max_links</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of MySQL connections per process, including
persistent connections.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.msql">
<title>mSQL Configuration Directives</title>
<variablelist>
<varlistentry id="ini.msql.allow-persistent">
<term>
<parameter>msql.allow_persistent</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to allow persistent mSQL connections.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.msql.max-persistent">
<term>
<parameter>msql.max_persistent</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of persistent mSQL connections per process.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.msql.max-links">
<term>
<parameter>msql.max_links</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of mSQL connections per process, including
persistent connections.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.pgsql">
<title>Postgres Configuration Directives</title>
<variablelist>
<varlistentry id="ini.pgsql.allow-persistent">
<term>
<parameter>pgsql.allow_persistent</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to allow persistent Postgres connections.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.pgsql.max-persistent">
<term>
<parameter>pgsql.max_persistent</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of persistent Postgres connections per process.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.pgsql.max-links">
<term>
<parameter>pgsql.max_links</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of Postgres connections per process, including
persistent connections.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.sybase">
<title>Sybase Configuration Directives</title>
<variablelist>
<varlistentry id="ini.sybase.allow-persistent">
<term>
<parameter>sybase.allow_persistent</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to allow persistent Sybase connections.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.sybase.max-persistent">
<term>
<parameter>sybase.max_persistent</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of persistent Sybase connections per process.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.sybase.max-links">
<term>
<parameter>sybase.max_links</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of Sybase connections per process, including
persistent connections.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.sybct">
<title>Sybase-CT Configuration Directives</title>
<variablelist>
<varlistentry id="ini.sybct.allow-persistent">
<term>
<parameter>sybct.allow_persistent</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to allow persistent Sybase-CT connections.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.sybct.max-persistent">
<term>
<parameter>sybct.max_persistent</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of persistent Sybase-CT connections per process.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.sybct.max-links">
<term>
<parameter>sybct.max_links</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of Sybase-CT connections per process, including
persistent connections.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.bcmath">
<title>BC Math Configuration Directives</title>
<variablelist>
<varlistentry id="ini.bcmath.scale">
<term>
<parameter>bcmath.scale</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Number of decimal digits for all bcmath functions.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.browscap">
<title>Browser Capability Configuration Directives</title>
<variablelist>
<varlistentry id="ini.browscap">
<term>
<parameter>browscap</parameter>
<type>string</type>
</term>
<listitem>
<para>
Name of browser capabilities file.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="ini.sect.uodbc">
<title>Unified ODBC Configuration Directives</title>
<variablelist>
<varlistentry id="ini.uodbc.default-db">
<term>
<parameter>uodbc.default_db</parameter>
<type>string</type>
</term>
<listitem>
<para>
ODBC data source to use if none is specified in
<function>odbc_connect</function> or
<function>odbc_pconnect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.uodbc.default-user">
<term>
<parameter>uodbc.default_user</parameter>
<type>string</type>
</term>
<listitem>
<para>
User name to use if none is specified in
<function>odbc_connect</function> or
<function>odbc_pconnect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.uodbc.default-pw">
<term>
<parameter>uodbc.default_pw</parameter>
<type>string</type>
</term>
<listitem>
<para>
Password to use if none is specified in
<function>odbc_connect</function> or
<function>odbc_pconnect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.uodbc.allow-persistent">
<term>
<parameter>uodbc.allow_persistent</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Whether to allow persistent ODBC connections.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.uodbc.max-persistent">
<term>
<parameter>uodbc.max_persistent</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of persistent ODBC connections per process.
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.uodbc.max-links">
<term>
<parameter>uodbc.max_links</parameter>
<type>integer</type>
</term>
<listitem>
<para>
The maximum number of ODBC connections per process, including
persistent connections.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>
<sect1 id="config-apache">
<title>Apache Module</title>
<sect2 id="config-apache-module">
<title>Apache module configuration directives</title>
<simpara></simpara>
<sect2 id="config-apache-action">
<title>CGI redirection module/action module</title>
<simpara></simpara>
<sect1 id="config-cgi">
<title>CGI</title>
<simpara></simpara>
<sect1 id="config-virtualhost">
<title>Virtual hosts</title>
<simpara></simpara>
<sect1 id="config-security">
<title>Security</title>
<simpara>
PHP is a powerful language and the interpreter, whether included
in a web server as a module or executed as a separate
<acronym>CGI</acronym> binary, is able to access files, execute
commands and open network connections on the server. These
properties make anything run on a web server insecure by default.
PHP is designed specifically to be a more secure language for
writing CGI programs than Perl or C, and with correct selection of
compile-time and runtime configuration options it gives you
exactly the combination of freedom and security you need.
<simpara>
As there are many different ways of utilizing PHP, there are many
configuration options controlling its behaviour. A large
selection of options guarantees you can use PHP for a lot of
purposes, but it also means there are combinations of these
options and server configurations that result in an insecure
setup. This chapter explains the different configuration option
combinations and the situations they can be safely used.
<sect2 id="config-security-cgi">
<title>CGI binary</title>
<sect3 id="config-security-cgi-preface">
<title>Possible attacks</title>
<simpara>
Using PHP as a <acronym>CGI</acronym> binary is an option for
setups that for some reason do not wish to integrate PHP as a
module into server software (like Apache), or will use PHP with
different kinds of CGI wrappers to create safe chroot and setuid
environments for scripts. This setup usually involves
installing executable PHP binary to the web server cgi-bin
directory. CERT advisory <ulink
url="http://www.cert.org/pub/advisories/CA-96.11.interpreters_in_cgi_bin_dir.html">CA-96.11</ulink>
recommends agains placing any interpreters into cgi-bin. Even
if the PHP binary can be used as a standalone interpreter, PHP
is designed to prevent the attacks this setup makes possible:
<itemizedlist>
<listitem><simpara>Accessing system files:
<filename role=url>http://my.host/cgi-bin/php?/etc/passwd</filename>
<simpara>
The query information in an url after the question mark (?)
is passed as command line arguments to the interpreter by the
CGI interface. Usually interpreters open and execute the
file specified as the first argument on the command line.
<simpara>
When invoked as a CGI binary, PHP refuses to interpret the
command line arguments.
</simpara></listitem>
<listitem><simpara>Accessing any web document on server:
<filename
role=url>http://my.host/cgi-bin/php/secret/doc.html</filename>
<simpara>
The path information part of the url after the PHP binary
name, <filename role=uri>/secret/doc.html</filename> is
conventionally used to specify the name of the file to be
opened and interpreted by the <acronym>CGI</acronym> program.
Usually some web server configuration directives (Apache:
Action) are used to redirect requests to documents like
<filename
role=url>http://my.host/secret/script.php3</filename> to the
PHP interpreter. With this setup, the web server first checks
the access permissions to the directory <filename
role=uri>/secret</filename>, and after that creates the
redirected request <filename
role=url>http://my.host/cgi-bin/php/secret/script.php3</filename>.
Unfortunately, if the request is originally given in this
form, no access checks are made by web server for file
<filename role=uri>/secret/script.php3</filename>, but only
for the <filename role=uri>/cgi-bin/php</filename> file. This
way any user able to access <filename
role=uri>/cgi-bin/php</filename> is able to access any
protected document on the web server.
<simpara>
In PHP, compile-time configuration option <link
linkend="enable-force-cgi-redirect">--enable-force-cgi-redirect</link>
and runtime configuration directives <link
linkend="ini.doc-root">doc_root</link> and <link
linkend="ini.user-dir">user_dir</link> can be used to prevent
this attack, if the server document tree has any directories
with access restrictions. See below for full explanation of
different combinations.
</simpara></listitem>
</itemizedlist>
</sect3>
<sect3 id="config-security-cgi-public">
<title>Case 1: only public files served</title>
<simpara>
If your server does not have any content that is not restricted
by password or ip based access control, there is no need for
these configuration options. If your web server does not allow
you to do redirects, or the server does not have a way to
communicate with the PHP binary that the request is a safely
redirected request, you can specify the option <link
linkend="enable-force-cgi-redirect">--disable-force-cgi-redirect</link>
to the configure script. You still have to make sure your PHP
scripts do not rely on one or another way of calling the script,
neither by directly <filename
role=php>http://my.host/cgi-bin/php/dir/script.php3</filename>
nor by redirection <filename
role=php>http://my.host/dir/script.php3</filename>.
<simpara>
Redirection can be configured for example in apache by
directives AddHandler and Action (see below).
</sect3>
<sect3 id="config-security-cgi-force">
<title>Case 2: using --enable-force-cgi-redirect</title>
<simpara>
This compile-time option prevents anyone from calling PHP directly
with a url like <filename role=php>http://my.host/cgi-bin/php/secretdir/script.php3</filename>.
Instead, PHP will only parse in this mode if it has gone through
a web server redirect rule.
<simpara>
Usually the redirection in the Apache configuration is done with
the following directives: <programlisting role="apache-conf">
Action php3-script /cgi-bin/php
AddHandler php3-script .php3
</programlisting>
<simpara>
This option has only been tested with the Apache web server, and relies on
Apache to set the non-standard CGI environment variable
<envar>REDIRECT_STATUS</envar> on redirected requests. If your
web server does not support any way of telling if the request is
direct or redirected, you cannot use this option and you must
use one of the other ways of running the CGI version documented here.
</sect3>
<sect3 id="config-security-cgi-docroot">
<title>Case 3: setting doc_root or user_dir</title>
<simpara>
To include active content, like scripts and executables, in the
web server document directories is sometimes consider an
insecure practice. If for some configuration mistake the
scripts are not executed but displayed as usual HTML documents,
this may result in leakage of intellectual property or security
information like passwords. Therefore many sysadmins will
prefer setting up another directory structure for scripts that
is only accessible through the PHP CGI, and therefore always
interpreted and not displayed as such.
<simpara>
Also if the method for making sure the requests are not
redirected, as described in the previous section, is not
available, it is necessary to set up a script doc_root that is
different from web document root.
<simpara>
You can set the PHP script document root by the configuration
directive <link linkend="ini.doc-root">doc_root</link> in the
<link linkend="php3.ini">php3.ini</link> file, or you can set
the environment variable <envar>PHP_DOCUMENT_ROOT</envar>. If
it is set, the CGI version of PHP will always construct the file
name to open with this <parameter>doc_root</parameter> and the
path information in the request, so you can be sure no script is
executed outside this directory (except for
<parameter>user_dir</parameter> below).
<simpara>
Another option usable here is <link
linkend="ini.user-dir">user_dir</link>. When user_dir is unset,
only thing controlling the opened file name is
<parameter>doc_root</parameter>. Opening an url like <filename
role=url>http://my.host/~user/doc.php3</filename> does not
result in opening a file under users home directory, but a file
called <filename role=uri>~user/doc.php3</filename> under
doc_root (yes, a directory name starting with a tilde
[<literal>~</literal>]).
<simpara>
If user_dir is set to for example <filename
role=dir>public_php</filename>, a request like <filename
role=url>http://my.host/~user/doc.php3</filename> will open a
file called <filename>doc.php3</filename> under the directory
named <filename role=dir>public_php</filename> under the home
directory of the user. If the home of the user is <filename
role=dir>/home/user</filename>, the file executed is
<filename>/home/user/public_php/doc.php3</filename>.
<simpara>
<parameter>user_dir</parameter> expansion happens regardless of
the <parameter>doc_root</parameter> setting, so you can control
the document root and user directory access separately.
</sect3>
<sect3 id="config-security-cgi-shell">
<title>Case 4: PHP parser outside of web tree</title>
<para>
A very secure option is to put the PHP parser binary somewhere
outside of the web tree of files. In <filename
role=dir>/usr/local/bin</filename>, for example. The only real
downside to this option is that you will now have to put a line
similar to:
<informalexample>
<programlisting>#!/usr/local/bin/php</programlisting>
</informalexample>
as the first line of any file containing PHP tags. You will
also need to make the file executable. That is, treat it
exactly as you would treat any other CGI script written in Perl
or sh or any other common scripting language which uses the
<literal>#!</literal> shell-escape mechanism for launching
itself.
<para>
To get PHP to handle <envar>PATH_INFO</envar> and
<envar>PATH_TRANSLATED</envar> information correctly with this
setup, the php parser should be compiled with the <link
linkend="enable-discard-path">--enable-discard-path</link>
configure option.
</sect3>
</sect2>
<sect2 id="config-security-apache">
<title>Apache module</title>
<simpara>
When PHP is used as an Apache module it inherits Apache's security setup.
A request for a file will have to go through Apache's regular checks and
only if these are passed successfully does the request make it way to PHP.
</sect2>
</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:
-->
|