#!/bin/sh # # +----------------------------------------------------------------------+ # | PHP HTML Embedded Scripting Language Version 3.0 | # +----------------------------------------------------------------------+ # | Copyright (c) 1997,1998 PHP Development Team (See Credits file) | # +----------------------------------------------------------------------+ # | This program is free software; you can redistribute it and/or modify | # | it under the terms of one of the following licenses: | # | | # | A) the GNU General Public License as published by the Free Software | # | Foundation; either version 2 of the License, or (at your option) | # | any later version. | # | | # | B) the PHP License as published by the PHP Development Team and | # | included in the distribution in the file: LICENSE | # | | # | This program is distributed in the hope that it will be useful, | # | but WITHOUT ANY WARRANTY; without even the implied warranty of | # | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # | GNU General Public License for more details. | # | | # | You should have received a copy of both licenses referred to here. | # | If you did not, or have any questions about PHP licensing, please | # | contact core@php.net. | # +----------------------------------------------------------------------+ # | Authors: Stig Sæther Bakken | # | Updated By: Jim Winstead | # | Ariel Shkedi or | # +----------------------------------------------------------------------+ # # $Id$ if [ "$1" = "-q" ]; then quiet_mode=on shift fi if [ `echo -e "\n" | wc -l` = 2 ]; then # bash supports echo -e for handling escape sequences ECHO_CMD="echo -e" elif test -f /bin/echo; then ECHO_CMD="/bin/echo" elif test -f /usr/bin/echo; then ECHO_CMD="/usr/bin/echo" else # fall back to the default echo - \n would most probably be displayed as-is ECHO_CMD="echo" fi if echo '\c' | grep -s c >/dev/null 2>&1 then ECHO_N="echo -n" ECHO_C="" else ECHO_N="echo" ECHO_C='\c' fi echo ' *************************************************************************** * * * Welcome to the PHP 3.0 setup script. Use this script if you do not * * want or know how to use the configure program. See the INSTALL file * * for further installation instructions. * * * * You will now be asked a series of questions for your installation. * * For each question, your options will be shown in parantheses, and * * for some a default value is listed shown in brackets. * * * *************************************************************************** ' display_prompt() { prm=$1 shift typ=$1 shift def=$1 shift $ECHO_N "$prm $ECHO_C" case $typ in yesno) $ECHO_N "(yes/no) $ECHO_C";; yesnodir) $ECHO_N "(\`yes', \`no' or dir) $ECHO_C";; dir) $ECHO_N "(dir) $ECHO_C";; esac if test "$typ" = "yesnodir"; then set $def def=$1 fi $ECHO_N "[$def] : $ECHO_C" } define_option() { if test "$#" != "5"; then echo "wrong number of arguments to define_option" >&2 return fi name=$1 shift prompt=$1 shift type=$1 shift default=$1 shift docstring=$1 optname=`echo $name | sed -e 's/[^a-zA-Z0-9_]/_/g'` options="$options $optname" eval "option_name_$optname='$name'" eval "option_prompt_$optname='$prompt'" eval "option_type_$optname='$type'" eval "option_default_$optname='$default'" eval "option_docstring_$optname='$docstring'" answer="" if [ "$quiet_mode" != "on" ]; then show_help "$optname" "$type" "$default" fi while test "$answer" = ""; do display_prompt "$prompt" "$type" "$default" read answer test -t || echo $answer # Echo the answer if it did not come # from a terminal. if test "$type" = "yesnodir"; then set $default if test "$1" = "yes"; then if test "$answer" = ""; then answer=yes fi fi case "$answer" in */*) ;; [Yy]*) dir=$2 shift shift $ECHO_N "Enter $@ directory [$dir] : $ECHO_C" read answer test -t || echo $answer if test "$answer" = ""; then answer=$dir fi ;; esac fi if test "$answer" = ""; then if test "$type" = "yesnodir"; then set $default answer=$1 else answer=$default fi elif test "$answer" = "?"; then show_help "$optname" "$type" "$default" answer="" fi done if test "$type" = "yesnodir"; then set $default if test $1 = "yes"; then case "$answer" in "$2") answer=yes;; [Yy]*) answer=yes;; [Nn]*) answer=no;; esac else case "$answer" in [Yy]*) answer=$2;; [Nn]*) answer=no;; esac fi elif test "$type" = "yesno"; then case "$answer" in [Yy]*) answer=yes;; [Nn]*) answer=no;; esac fi eval "option_value_$optname='$answer'" } show_help() { echo '' ( eval "$ECHO_CMD \$option_docstring_$1" ; if test "$2" = "yesnodir"; then set $3 echo "If you answer \`yes', the default directory is \`$2'." fi ) echo '' } generate_config_command() { configure_options="" for optname in $options; do eval "name=\$option_name_$optname" eval "value=\$option_value_$optname" eval "default=\$option_default_$optname" set $default if test "$value" != "$1"; then if test "$value" != "$2"; then configure_options="$configure_options --$name=$value" else configure_options="$configure_options --$name" fi fi done echo "./configure$configure_options" } # now define all the options define_option with-apache 'Build as an Apache module?' yesnodir \ 'no /usr/local/etc/httpd Apache base install' \ ' Whether to build PHP as an Apache module. If you are running\n Apache, building PHP as a module will give better performance and\n security. If you answer no PHP will be built as a CGI program.\n The CGI version also enables Apache users to run different PHP3-enabled\n pages under different user-ids.' if test "$option_value_with_apache" != "no"; then define_option with-mod_charset 'Enable transfer tables used by mod_charset?' yesno no \ ' Whether to respect transfer tables used by mod_charset when PHP compiled\n as Apache module. It is required to allow mod_charset (aka Russian Apache)\n to work properly.' fi if test "$option_value_with_apache" = "no"; then define_option with-fhttpd 'Build as an fhttpd module?' yesnodir \ 'no /usr/local/src/fhttpd fhttpd sources' \ ' Whether to build PHP as fhttpd module. If you are running\n fhttpd, building PHP as a module will give better performance,\n more control and remote execution capability. More info about fhttpd \n can be found at http://phobos.illtel.denver.co.us/pub/fhttpd/.' fi for stub in ext/*/setup.stub; do test -f $stub && . $stub done define_option with-config-file-path 'Default config directory?' yesnodir \ 'no /usr/local/lib Configuration file' \ ' Directory where the PHP3 configuration file (php3.ini) is\n located.' # systems should be system's define_option with-system-regex 'Use the system regex library?' yesno no \ " Whether to use the systems regular expression library rather than\n the bundled one. If you are building PHP3 as a server module, you must\n use the same library when building PHP3 as when linking the server.\n Enable this if the systems library provides special features you need.\n It is recommended that you use the bundled library if possible." define_option enable-debug 'Compile with debug information?' yesno yes \ ' Whether to enable debug information. Answering "no" here will make\n PHP run faster, but it will be harder to trace bugs. You are \n encouraged to leave debugging on while PHP 3.0 is in alpha and \n beta state.' define_option enable-safe-mode 'Enable safe mode by default?' yesno no \ " Whether to enable PHP safe mode. This imposes several\n restrictions on what PHP can do, such as opening only files within\n the document root. Read the Security chapter of the documentation\n for more information. CGI users should always enable secure mode.\n This only sets the default, it may be enabled or disabled in the\n configuration file later. " # broken configure.in doesn't check apache (bug?) #if test "$option_value_with_apache" != "no"; then # defexecdir="$option_value_with_apache/php-bin" #else defexecdir=/usr/local/bin #fi define_option with-exec-dir 'Default safe mode exec dir?' dir "$defexecdir" \ " The directory where executables that may be run from safe mode\n are located." define_option enable-track-vars 'Enable variable tracking by default?' yesno \ no \ ' Enable the HTTP_GET_VARS, HTTP_POST_VARS and HTTP_COOKIE_VARS arrays by\n default (can be turned on or off in the configuration file).' define_option enable-magic-quotes 'Enable magic quotes by default?' yesno no \ ' Whether to magic quotes by default. This can be changed in the\n configuration file.' define_option enable-debugger 'Enable PHP remote debugger?' yesno no \ " Whether to enable PHP remote debugging support. This feature\n is still under development." # configure.in only checks these if it's a cgi so setup does the same if test "$option_value_with_apache" = "no"; then # outputing the bank line isn't really possible, but it would be nice define_option enable-force-cgi-redirect 'Enable redirect checking?' yesno no \ ' When using PHP as a CGI binary, this will make PHP always first check\n that it is used by redirection (for example under Apache, by using\n Action directives). This makes sure that the PHP binary cannot be used\n to bypass standard web server authentication procedures by calling it\n directly, like http://my.host/cgi-bin/php/secret/doc.html. This\n example accesses http://my.host/secret/doc.html but does not honour\n any security settings enforced by httpd for directory /secret.\n \n Not enabling this option disables the check and enables bypassing\n httpd security and authentication settings. Do this only if your server\n software is unable to indicate that a safe redirection was done and\n all your files under your document root and user directories may be\n accessed by anyone. (See the doc_root and user_dir options in the\n configuartion file).' define_option enable-discard-path 'Enable discard path?' yesno no \ ' If this is enabled, the PHP CGI binary can safely be placed outside\n of the web tree and people will not be able to circumvent .htaccess\n security.' fi define_option enable-memory-limit 'Enable memory limit?' yesno no \ ' Compile with memory limit support.' define_option enable-short-tags 'Allow short tag by default?' yesno yes \ " Whether to enable the short form of the PHP HTML embed tags.\n The short form is \"\", while the long form is\n \"\". If you plan on using XML on your site, you\n should disable the short form. This is the default and can be overridden\n in the configuration file." define_option enable-url-fopen-wrapper 'Enable URL fopen wrappers?' yesno yes \ " Enable the URL-aware fopen wrapper that allows accessing files via http\n or ftp." # only the cgi version of PHP is installed to bindir if test "$option_value_with_apache" = "no"; then define_option bindir 'Install php in:' dir "/usr/local/bin" \ " Directory where PHP should be installed." fi echo ' *************************************************************************** * * * Running configure... * * * *************************************************************************** ' if test ! -f configure; then autoconf fi command=`generate_config_command` mv do-conf do-conf.bak > /dev/null 2>&1 echo $command > do-conf chmod +x do-conf echo $command eval $command echo ' *************************************************************************** * * * Configuration options were saved in do-conf, if desired you can * * edit this file and then run it. Run ./configure --help for a list * * of options. * * * * Read the INSTALL file for more information and for help in * * configuring apache. See the web site at: http://www.php.net/ for * * documentation and more. If desired copy the php3.ini-dist file to * * your config directory/php3.ini and edit it. * * * *************************************************************************** '