cvs: phpdoc /php copyright.php getting-started.php install.hpux.php install.linux.php install.macosx.php install.openbsd.php install.solaris.php
install.unix.php install.windows.php installation.php intro-whatcando.php introduction.php preface.php tutorial.firstpage.php tutorial.forms.php
tutorial.oldcode.php tutorial.php tutorial.useful.php tutorial.whatsnext.php

From: Date: Fri, 04 Oct 2002 07:17:05 +0000
Subject: cvs: phpdoc /php copyright.php getting-started.php install.hpux.php install.linux.php install.macosx.php install.openbsd.php install.solaris.php
install.unix.php install.windows.php installation.php intro-whatcando.php introduction.php preface.php tutorial.firstpage.php tutorial.forms.php
tutorial.oldcode.php tutorial.php tutorial.useful.php tutorial.whatsnext.php
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969348967@lists.php.net to get a copy of this message
coldocean Fri Oct 4 03:17:05 2002 EDT Added files: /phpdoc/php copyright.php getting-started.php install.hpux.php install.linux.php install.macosx.php install.openbsd.php install.solaris.php install.unix.php install.windows.php installation.php intro-whatcando.php introduction.php preface.php tutorial.firstpage.php tutorial.forms.php tutorial.oldcode.php tutorial.php tutorial.useful.php tutorial.whatsnext.php Log:

Index: phpdoc/php/copyright.php +++ phpdoc/php/copyright.php <HTML ><HEAD ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP ¤â¥U" HREF="index.php"><LINK REL="NEXT" TITLE="Preface" HREF="preface.php"></HEAD ><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP ¤â¥U</TH ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="legalnotice" ><A NAME="copyright" ></A ><P ><B >Copyright</B ></P ><P >&#13; This manual is © Copyright 1997, 1998, 1999, 2000, 2001, 2002 by the PHP Documentation Group. The members of this group are listed on the front page of this manual. </P ><P >&#13; This manual can be redistributed under the terms of 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. </P ><P >&#13; The 'Extending PHP 4.0' section of this manual is copyright © 2000 by Zend Technologies, Ltd. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <A HREF="http://www.opencontent.org/openpub/" TARGET="_top" >http://www.opencontent.org/openpub/</A >). </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >&nbsp;</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.php" ACCESSKEY="H" >&#20839;&#23481;</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >&nbsp;</TD ></TR ></TABLE ></DIV ></BODY ></HTML > Index: phpdoc/php/getting-started.php +++ phpdoc/php/getting-started.php Index: phpdoc/php/install.hpux.php +++ phpdoc/php/install.hpux.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('installation.php', '¦w¸Ë'), 'next' => array('install.linux.php', 'Unix/Linux installs'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Unix/HP-UX installs','install.hpux.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.hpux" ></A >Unix/HP-UX installs</H1 ><P >&#13; This section contains notes and hints specific to installing PHP on HP-UX systems. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="install.hpux.example" ></A ><P ><B >&#31684;&#20363; 3-1. Installation Instructions for HP-UX 10 </B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >From: paul_mckay@clearwater-it.co.uk 04-Jan-2001 09:49 (These tips are for PHP 4.0.4 and Apache v1.3.9) So you want to install PHP and Apache on a HP-UX 10.20 box? 1. You need gzip, download a binary distribution from http://hpux.connect.org.uk/ftp/hpux/Gnu/gzip-1.2.4a/gzip-1.2.4a-sd-10.20.depot.Z uncompress the file and install using swinstall 2. You need gcc, download a binary distribution from http://gatekeep.cs.utah.edu/ftp/hpux/Gnu/gcc-2.95.2/gcc-2.95.2-sd-10.20.depot.gz gunzip this file and install gcc using swinstall. 3. You need the GNU binutils, you can download a binary distribution from http://hpux.connect.org.uk/ftp/hpux/Gnu/binutils-2.9.1/binutils-2.9.1-sd-10.20.depot.gz gunzip and install using swinstall. 4. You now need bison, you can download a binary distribution from http://hpux.connect.org.uk/ftp/hpux/Gnu/bison-1.28/bison-1.28-sd-10.20.depot.gz install as above. 5. You now need flex, you need to download the source from one of the http://www.gnu.org mirrors. It is in the &#60;filename&#62;non-gnu&#60;/filename&#62; directory of the ftp site. Download the file, gunzip, then tar -xvf it. Go into the newly created flex directory and do a ./configure, then a make, and then a make install If you have errors here, it's probably because gcc etc. are not in your PATH so add them to your PATH. Right, now into the hard stuff. 6. Download the PHP and apache sources. 7. gunzip and tar -xvf them. We need to hack a couple of files so that they can compile ok. 8. Firstly the configure file needs to be hacked because it seems to lose track of the fact that you are a hpux machine, there will be a better way of doing this but a cheap and cheerful hack is to put lt_target=hpux10.20 on line 47286 of the configure script. 9. Next, the Apache GuessOS file needs to be hacked. Under apache_1.3.9/src/helpers change line 89 from "echo "hp${HPUXMACH}-hpux${HPUXVER}"; exit 0" to: "echo "hp${HPUXMACH}-hp-hpux${HPUXVER}"; exit 0" 10. You cannot install PHP as a shared object under HP-UX so you must compile it as a static, just follow the instructions at the Apache page. 11. PHP and apache should have compiled OK, but Apache won't start. you need to create a new user for Apache, eg www, or apache. You then change lines 252 and 253 of the conf/httpd.conf in Apache so that instead of User nobody Group nogroup you have something like User www Group sys This is because you can't run Apache as nobody under hp-ux. Apache and PHP should then work. Hope this helps somebody, Paul Mckay.</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></DIV ><?php manualFooter('Unix/HP-UX installs','install.hpux.php'); ?> Index: phpdoc/php/install.linux.php +++ phpdoc/php/install.linux.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('install.hpux.php', 'Unix/HP-UX installs'), 'next' => array('install.macosx.php', 'Unix/Mac OS X installs'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Unix/Linux installs','install.linux.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.linux" ></A >Unix/Linux installs</H1 ><P >&#13; This section contains notes and hints specific to installing PHP on Linux distributions. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.linux.packages" ></A >Using Packages</H2 ><P >&#13; Many Linux distributions have some sort of package installation system, such as RPM. This can assist in setting up a standard configuration, but if you need to have a different set of features (such as a secure server, or a different database driver), you may need to build PHP and/or your webserver. If you are unfamiliar with building and compiling your own software, it is worth checking to see whether somebody has already built a packaged version of PHP with the features you need. </P ></DIV ></DIV ><?php manualFooter('Unix/Linux installs','install.linux.php'); ?> Index: phpdoc/php/install.macosx.php +++ phpdoc/php/install.macosx.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('install.linux.php', 'Unix/Linux installs'), 'next' => array('install.openbsd.php', 'Unix/OpenBSD installs'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Unix/Mac OS X installs','install.macosx.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.macosx" ></A >Unix/Mac OS X installs</H1 ><P >&#13; This section contains notes and hints specific to installing PHP on Mac OS X Server. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.macosx.packages" ></A >Using Packages</H2 ><P >&#13; There are a few pre-packaged and pre-compiled versions of PHP for Mac OS X. This can help in setting up a standard configuration, but if you need to have a different set of features (such as a secure server, or a different database driver), you may need to build PHP and/or your web server yourself. If you are unfamiliar with building and compiling your own software, it's worth checking whether somebody has already built a packaged version of PHP with the features you need. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.macosx.compile" ></A >Compiling for OS X server</H2 ><P >&#13; There are two slightly different versions of Mac OS X, client and server. The following is for OS X Server. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="install.macosx.compile.example" ></A ><P ><B >&#31684;&#20363; 3-2. Mac OS X server install</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >1. Get the latest distributions of Apache and PHP 2. Untar them, and run the configure program on Apache like so. ./configure --exec-prefix=/usr \ --localstatedir=/var \ --mandir=/usr/share/man \ --libexecdir=/System/Library/Apache/Modules \ --iconsdir=/System/Library/Apache/Icons \ --includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \ --enable-shared=max \ --enable-module=most \ --target=apache 4. You may also want to add this line: setenv OPTIM=-O2 If you want the compiler to do some optimization. 5. Next, go to the PHP 4 source directory and configure it. ./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/share/man \ --with-xml \ --with-apache=/src/apache_1.3.12 If you have any other additions (MySQL, GD, etc.), be sure to add them here. For the --with-apache string, put in the path to your apache source directory, for example "/src/apache_1.3.12". 6. make 7. make install This will add a directory to your Apache source directory under src/modules/php4. 8. Now, reconfigure Apache to build in PHP 4. ./configure --exec-prefix=/usr \ --localstatedir=/var \ --mandir=/usr/share/man \ --libexecdir=/System/Library/Apache/Modules \ --iconsdir=/System/Library/Apache/Icons \ --includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \ --enable-shared=max \ --enable-module=most \ --target=apache \ --activate-module=src/modules/php4/libphp4.a You may get a message telling you that libmodphp4.a is out of date. If so, go to the src/modules/php4 directory inside your apache source directory and run this command: ranlib libmodphp4.a Then go back to the root of the apache source directory and run the above configure command again. That'll bring the link table up to date. 9. make 10. make install 11. copy and rename the php.ini-dist file to your "bin" directory from your PHP 4 source directory: cp php.ini-dist /usr/local/bin/php.ini or (if your don't have a local directory) cp php.ini-dist /usr/bin/php.ini</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P >&#13; Other examples for <A HREF="http://www.stepwise.com/Articles/Workbench/Apache-1.3.14-MacOSX.html" TARGET="_top" >Mac OS X client</A > and <A HREF="http://www.stepwise.com/Articles/Workbench/Apache-1.3.14-MacOSX.html" TARGET="_top" >Mac OS X server</A > are available at <A HREF="http://www.stepwise.com/" TARGET="_top" >Stepwise</A >. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.macosx.client" ></A >Compiling for MacOS X client</H2 ><P >&#13; Those tips are graciously provided by <A HREF="http://www.entropy.ch/software/macosx/" TARGET="_top" >Marc Liyanage</A >. </P ><P >&#13; The PHP module for the Apache web server included in Mac OS X. This version includes support for the MySQL and PostgreSQL databases. </P ><P >&#13; NOTE: Be careful when you do this, you could screw up your Apache web server! </P ><P >&#13; Do this to install: <P ></P ><UL ><LI ><P >&#13; 1. Open a terminal window </P ></LI ><LI ><P >&#13; 2. Type "wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz", wait for download to finish </P ></LI ><LI ><P >&#13; 3. Type "gunzip libphp4.so.gz" </P ></LI ><LI ><P >&#13; 4. Type "sudo apxs -i -a -n php4 libphp4.so" </P ></LI ></UL > Now type "<TT CLASS="literal" >sudo open -a TextEdit /etc/httpd/httpd.conf</TT >" TextEdit will open with the web server configuration file. Locate these two lines towards the end of the file: (Use the Find command) <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="apache" >#AddType application/x-httpd-php .php #AddType application/x-httpd-php-source .phps</PRE ></TD ></TR ></TABLE > Remove the two hash marks (<TT CLASS="literal" >#</TT >), then save the file and quit TextEdit. </P ><P >&#13; Finally, type "<TT CLASS="literal" >sudo apachectl graceful</TT >" to restart the web server. </P ><P >&#13; PHP should now be up and running. You can test it by dropping a file into your "Sites" folder which is called "test.php". Into that file, write this line: "<TT CLASS="literal" >&#60;?php phpinfo() ?&#62;</TT >". </P ><P >&#13; Now open up <TT CLASS="literal" >127.0.0.1/~your_username/test.php</TT > in your web browser. You should see a status table with information about the PHP module. </P ></DIV ></DIV ><?php manualFooter('Unix/Mac OS X installs','install.macosx.php'); ?> Index: phpdoc/php/install.openbsd.php +++ phpdoc/php/install.openbsd.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('install.macosx.php', 'Unix/Mac OS X installs'), 'next' => array('install.solaris.php', 'Unix/Solaris installs'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Unix/OpenBSD installs','install.openbsd.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.openbsd" ></A >Unix/OpenBSD installs</H1 ><P >&#13; This section contains notes and hints specific to installing PHP on <A HREF="http://www.openbsd.org/" TARGET="_top" >OpenBSD</A >. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.openbsd.ports" ></A >Using Ports</H2 ><P >&#13; This is the recommended method of installing PHP on OpenBSD, as it will have the latest patches and security fixes applied to it by the maintainers. To use this method, ensure that you have a <A HREF="http://www.openbsd.org/ports.html" TARGET="_top" >&#13; recent ports tree</A >. Then simply find out which flavors you wish to install, and issue the <B CLASS="command" >make install</B > command. Below is an example of how to do this. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="install.openbsd.ports.example" ></A ><P ><B >&#31684;&#20363; 3-3. OpenBSD Ports Install Example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >$ cd /usr/ports/www/php4 $ make show VARNAME=FLAVORS (choose which flavors you want from the list) $ env FLAVOR="imap gettext ldap mysql gd" make install $ /usr/local/sbin/php4-enable</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.openbsd.packages" ></A >Using Packages</H2 ><P >&#13; There are pre-compiled packages available for your release of <A HREF="http://www.openbsd.org/" TARGET="_top" >OpenBSD</A >. These integrate automatically with the version of Apache installed with the OS. However, since there are a large number of options (called <SPAN CLASS="emphasis" ><I CLASS="emphasis" >flavors</I ></SPAN >) available for this port, you may find it easier to compile it from source using the ports tree. Read the <A HREF="http://www.openbsd.org/cgi-bin/man.cgi?query=packages" TARGET="_top" >packages(7)</A > manual page for more information in what packages are available. </P ></DIV ></DIV ><?php manualFooter('Unix/OpenBSD installs','install.openbsd.php'); ?> Index: phpdoc/php/install.solaris.php +++ phpdoc/php/install.solaris.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('install.openbsd.php', 'Unix/OpenBSD installs'), 'next' => array('install.unix.php', 'Installation on UNIX systems'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Unix/Solaris installs','install.solaris.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.solaris" ></A >Unix/Solaris installs</H1 ><P >&#13; This section contains notes and hints specific to installing PHP on Solaris systems. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.solaris.required" ></A >Required software</H2 ><P >&#13; Solaris installs often lack C compilers and their related tools. The required software is as follows: <P ></P ><UL ><LI ><P >&#13; gcc (recommended, other C compilers may work) </P ></LI ><LI ><P >&#13; make </P ></LI ><LI ><P >&#13; flex </P ></LI ><LI ><P >&#13; bison </P ></LI ><LI ><P >&#13; m4 </P ></LI ><LI ><P >&#13; autoconf </P ></LI ><LI ><P >&#13; automake </P ></LI ><LI ><P >&#13; perl </P ></LI ><LI ><P >&#13; gzip </P ></LI ><LI ><P >&#13; tar </P ></LI ></UL > In addition, you will need to install (and possibly compile) any additional software specific to your configuration, such as Oracle or MySQL. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.solaris.packages" ></A >Using Packages</H2 ><P >&#13; You can simplify the Solaris install process by using pkgadd to install most of your needed components. </P ></DIV ></DIV ><?php manualFooter('Unix/Solaris installs','install.solaris.php'); ?> Index: phpdoc/php/install.unix.php +++ phpdoc/php/install.unix.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('install.solaris.php', 'Unix/Solaris installs'), 'next' => array('install.windows.php', 'Installation on Windows systems'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Installation on UNIX systems','install.unix.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.unix" ></A >Installation on UNIX systems</H1 ><P >&#13; This section will guide you through the general configuration and installation of PHP on Unix systems. Be sure to investigate any sections specific to your platform or web server before you begin the process. </P ><P >&#13; Prerequisite knowledge and software: <P ></P ><UL ><LI ><P >&#13; Basic UNIX skills (being able to operate "make" and a C compiler, if compiling) </P ></LI ><LI ><P >&#13; An ANSI C compiler (if compiling) </P ></LI ><LI ><P >&#13; flex (for compiling) </P ></LI ><LI ><P >&#13; bison (for compiling) </P ></LI ><LI ><P >&#13; A web server </P ></LI ><LI ><P >&#13; Any module specific components (such as gd, pdf libs, etc.) </P ></LI ></UL > </P ><P >&#13; There are several ways to install PHP for the Unix platform, either with a compile and configure process, or through various pre-packaged methods. This documentation is mainly focused around the process of compiling and configuring PHP. </P ><P >&#13; The initial PHP setup and configuration process is controlled by the use of the commandline options of the <TT CLASS="filename" >configure</TT > script. This page outlines the usage of the most common options, but there are many others to play with. Check out the <A HREF="install.configure.php" >Complete list of configure options</A > for an exhaustive rundown. There are several ways to install PHP: <P ></P ><UL ><LI ><P >&#13; As an <A HREF="install.apache.php" >Apache module</A > </P ></LI ><LI ><P >&#13; As an <A HREF="install.fhttpd.php" >fhttpd module</A > </P ></LI ><LI ><P >&#13; For use with <A HREF="install.otherhttpd.php" >AOLServer, NSAPI, phttpd, Pi3Web, Roxen, thttpd, or Zeus.</A > </P ></LI ><LI ><P >&#13; As a <A HREF="install.commandline.php" >CGI executable</A > </P ></LI ></UL > </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.unix.apache-module" ></A >Apache Module Quick Reference</H2 ><P >&#13; PHP can be compiled in a number of different ways, but one of the most popular is as an Apache module. The following is a quick installation overview. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="install.unix.apache-module.quick" ></A ><P ><B >&#31684;&#20363; 3-4. Quick Installation Instructions for PHP 4 (Apache Module Version) </B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="shell" >1. gunzip apache_1.3.x.tar.gz 2. tar xvf apache_1.3.x.tar 3. gunzip php-x.x.x.tar.gz 4. tar xvf php-x.x.x.tar 5. cd apache_1.3.x 6. ./configure --prefix=/www 7. cd ../php-x.x.x 8. ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars 9. make 10. make install 11. cd ../apache_1.3.x 12. ./configure --activate-module=src/modules/php4/libphp4.a 13. make 14. make install 15. cd ../php-x.x.x 16. cp php.ini-dist /usr/local/lib/php.ini 17. Edit your httpd.conf or srm.conf file and add: AddType application/x-httpd-php .php 18. Use your normal procedure for restarting the Apache server. (You must stop and restart the server, not just cause the server to reload by use a HUP or USR1 signal.)</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.building" ></A >Building</H2 ><P >&#13; When PHP is configured, you are ready to build the CGI executable. The command <B CLASS="command" >make</B > should take care of this. If it fails and you can't figure out why, see the <A HREF="install.problems.php" >Problems section</A >. </P ></DIV ></DIV ><?php manualFooter('Installation on UNIX systems','install.unix.php'); ?> Index: phpdoc/php/install.windows.php +++ phpdoc/php/install.windows.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('install.unix.php', 'Installation on UNIX systems'), 'next' => array('install.commandline.php', 'Servers-CGI/Commandline'), 'up' => array('installation.php', '¦w¸Ë'), 'toc' => array( array('installation.php#install.general', 'General Installation Considerations'), array('install.hpux.php', 'Unix/HP-UX installs'), array('install.linux.php', 'Unix/Linux installs'), array('install.macosx.php', 'Unix/Mac OS X installs'), array('install.openbsd.php', 'Unix/OpenBSD installs'), array('install.solaris.php', 'Unix/Solaris installs'), array('install.unix.php', 'Installation on UNIX systems'), array('install.windows.php', 'Installation on Windows systems'), array('install.commandline.php', 'Servers-CGI/Commandline'), array('install.apache.php', 'Servers-Apache'), array('install.caudium.php', 'Servers-Caudium'), array('install.fhttpd.php', 'Servers-fhttpd'), array('install.iis.php', 'Servers-IIS/PWS'), array('install.netscape-enterprise.php', 'Servers-Netscape and iPlanet'), array('install.omnihttpd.php', 'Servers-OmniHTTPd Server'), array('install.oreilly.php', 'Servers-Oreilly Website Pro'), array('install.sambar.php', 'Servers-Sambar'), array('install.xitami.php', 'Servers-Xitami'), array('install.otherhttpd.php', 'Servers-Other web servers'), array('install.problems.php', 'Problems?'), array('install.configure.php', 'Complete list of configure options'), ))); manualHeader('Installation on Windows systems','install.windows.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.windows" ></A >Installation on Windows systems</H1 ><P >&#13; This section applies to Windows 95/98/Me and Windows NT/2000/XP. Do not expect PHP to work on 16 bit platforms such as Windows 3.1. Sometimes we refer to the supported Windows platforms as Win32. </P ><P >&#13; There are two main ways to install PHP for Windows: either <A HREF="install.windows.php#install.windows.manual" >manually</A > or by using the <A HREF="install.windows.php#install.windows.installer" >InstallShield</A > installer. </P ><P >&#13; If you have Microsoft Visual Studio, you can also <A HREF="install.windows.php#install.windows.build" >build</A > PHP from the original source code. </P ><P >&#13; Once you have PHP installed on your Windows system, you may also want to <A HREF="install.windows.php#install.windows.extensions" >load various extensions</A > for added functionality. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.windows.installer" ></A >Windows InstallShield</H2 ><P >&#13; The Windows PHP installer available from the downloads page at <A HREF="http://www.php.net/" TARGET="_top" >http://www.php.net/</A >, this installs the CGI version of PHP and, for IIS, PWS, and Xitami, configures the web server as well. Also note, that while the InstallShield installer is an easy way to make PHP work, it is restricted in many aspects, as automatic setup of extensions for example is not supported. </P ><P >&#13; Install your selected <SPAN CLASS="acronym" >HTTP</SPAN > server on your system and make sure that it works. </P ><P >&#13; Run the executable installer and follow the instructions provided by the installation wizard. Two types of installation are supported - standard, which provides sensible defaults for all the settings it can, and advanced, which asks questions as it goes along. </P ><P >&#13; The installation wizard gathers enough information to set up the <TT CLASS="filename" >php.ini</TT > file and configure the web server to use PHP. For IIS and also PWS on NT Workstation, a list of all the nodes on the server with script map settings is displayed, and you can choose those nodes to which you wish to add the PHP script mappings. </P ><P >&#13; Once the installation has completed the installer will inform you if you need to restart your system, restart the server, or just start using PHP. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >&#35686;&#21578;</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >&#13; Be aware, that this setup of PHP is not secure. If you would like to have a secure PHP setup, you'd better go on the manual way, and set every option carefully. This automatically working setup gives you an instantly working PHP installation, but it is not meant to be used on online servers. </P ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.windows.manual" ></A >Manual Installation Steps</H2 ><P >&#13; This install guide will help you manually install and configure PHP on your Windows webserver. You need to download the zip binary distribution from the downloads page at <A HREF="http://www.php.net/" TARGET="_top" >http://www.php.net/</A >. The original version of this guide was compiled by <A HREF="mailto:bob_silva@mail.umesd.k12.or.us" TARGET="_top" >Bob Silva</A >, and can be found at <A HREF="http://www.umesd.k12.or.us/php/win32install.html" TARGET="_top" >http://www.umesd.k12.or.us/php/win32install.html</A >. </P ><P >&#13; This guide provides manual installation support for: <P ></P ><UL ><LI ><P >&#13; Personal Web Server 3 and 4 or newer </P ></LI ><LI ><P >&#13; Internet Information Server 3 and 4 or newer </P ></LI ><LI ><P >&#13; Apache 1.3.x </P ></LI ><LI ><P >&#13; OmniHTTPd 2.0b1 and up </P ></LI ><LI ><P >&#13; Oreilly Website Pro </P ></LI ><LI ><P >&#13; Xitami </P ></LI ><LI ><P >&#13; Netscape Enterprise Server, iPlanet </P ></LI ></UL > </P ><P >&#13; PHP 4 for Windows comes in two flavours - a CGI executable (php.exe), and several SAPI modules (for example: php4isapi.dll). The latter form is new to PHP 4, and provides significantly improved performance and some new functionality. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >&#35686;&#21578;</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >&#13; The SAPI modules have been significantly improved in the 4.1 release, however, you may find that you encounter possible server errors or other server modules such as ASP failing, in older systems. </P ></TD ></TR ></TABLE ></DIV ><P >&#13; If you choose one of the SAPI modules and use Windows 95, be sure to download the DCOM update from the <A HREF="http://download.microsoft.com/msdownload/dcom/95/x86/en/dcom95.exe" TARGET="_top" >Microsoft DCOM pages</A >. For the ISAPI module, an ISAPI 4.0 compliant Web server is required (tested on IIS 4.0, PWS 4.0 and IIS 5.0). IIS 3.0 is <SPAN CLASS="emphasis" ><I CLASS="emphasis" >NOT</I ></SPAN > supported. You should download and install the Windows NT 4.0 Option Pack with IIS 4.0 if you want native PHP support. </P ><P >&#13; The following steps should be performed on all installations before the server specific instructions. <P ></P ><UL ><LI ><P >&#13; Extract the distribution file to a directory of your choice. <TT CLASS="filename" >c:\php\</TT > is a good start. You probably do not want to use a path in which spaces are included (for example: c:\program files\php is not a good idea). Some web servers will crash if you do. </P ></LI ><LI ><P >&#13; You need to ensure that the DLLs which PHP uses can be found. The precise DLLs involved depend on which web server you use and whether you want to run PHP as a CGI or as a server module. <TT CLASS="filename" >php4ts.dll</TT > is always used. If you are using a server module (e.g. ISAPI or Apache) then you will need the relevant DLL from the <TT CLASS="filename" >sapi</TT > folder. If you are using any PHP extension DLLs then you will need those as well. To make sure that the DLLs can be found, you can either copy them to the system directory (e.g. <TT CLASS="filename" >winnt/system32</TT > or <TT CLASS="filename" >windows/system</TT >) or you can make sure that they live in the same directory as the main PHP executable or DLL your web server will use (e.g. <TT CLASS="filename" >php.exe</TT >, <TT CLASS="filename" >php4apache.dll</TT >). </P ><P >&#13; The PHP binary, the SAPI modules, and some extensions rely on external DLLs for execution. Make sure that these DLLs in the distribution exist in a directory that is in the Windows PATH. The best bet to do it is to copy the files below into your system directory, which is typically: <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD >&#13; <TT CLASS="filename" >c:\windows\system</TT > for Windows 9x/ME </TD ></TR ><TR ><TD >&#13; <TT CLASS="filename" >c:\winnt\system32</TT > for Windows NT/2000 </TD ></TR ><TR ><TD >&#13; <TT CLASS="filename" >c:\windows\system32</TT > for Windows XP </TD ></TR ></TBODY ></TABLE ><P ></P > The files to copy are: <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD >&#13; <TT CLASS="filename" >php4ts.dll</TT >, if it already exists there, overwrite it </TD ></TR ><TR ><TD >&#13; The files in your distribution's 'dlls' directory. If you have them already installed on your system, overwrite them only if something doesn't work correctly (Before overwriting them, it is a good idea to make a backup of them, or move them to another folder - just in case something goes wrong). </TD ></TR ></TBODY ></TABLE ><P ></P > </P ><P >&#13; Download the latest version of the Microsoft Data Access Components (MDAC) for your platform, especially if you use Microsoft Windows 9x/NT4. MDAC is available at <A HREF="http://www.microsoft.com/data/" TARGET="_top" >http://www.microsoft.com/data/</A >. </P ></LI ><LI ><P >&#13; Copy your chosen ini file (see below) to your '%WINDOWS%' directory on Windows 9x/Me or to your '%SYSTEMROOT%' directory under Windows NT/2000/XP and rename it to <TT CLASS="filename" >php.ini</TT >. Your '%WINDOWS%' or '%SYSTEMROOT%' directory is typically: <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><TT CLASS="filename" >c:\windows</TT > for Windows 9x/ME/XP</TD ></TR ><TR ><TD ><TT CLASS="filename" >c:\winnt</TT > or <TT CLASS="filename" >c:\winnt40</TT > for NT/2000 servers</TD ></TR ></TBODY ></TABLE ><P ></P > </P ><P >&#13; There are two ini files distributed in the zip file, <TT CLASS="filename" >php.ini-dist</TT > and <TT CLASS="filename" >php.ini-optimized</TT >. We advise you to use <TT CLASS="filename" >php.ini-optimized</TT >, because we optimized the default settings in this file for performance, and security. The best is to study all the <A HREF="configuration.php#configuration.file" >ini settings</A > and set every element manually yourself. If you would like to achieve the best security, then this is the way for you, although PHP works fine with these default ini files. </P ></LI ><LI ><P >&#13; Edit your new <TT CLASS="filename" >php.ini</TT > file: <P ></P ><UL ><LI ><P >&#13; You will need to change the 'extension_dir' setting to point to your php-install-dir, or where you have placed your <TT CLASS="filename" >php_*.dll</TT > files. Please do not forget the last backslash. ex: <TT CLASS="filename" >c:\php\extensions\</TT > </P ></LI ><LI ><P >&#13; If you are using OmniHTTPd, do not follow the next step. Set the 'doc_root' to point to your webservers document_root. For example: <TT CLASS="filename" >c:\apache\htdocs</TT > or <TT CLASS="filename" >c:\webroot</TT > </P ></LI ><LI ><P >&#13; Choose which extensions you would like to load when PHP starts. See the section about <A HREF="install.windows.php#install.windows.extensions" >Windows extensions</A >, about how to set up one, and what is already built in. Note that on a new installation it is advisable to first get PHP working and tested without any extensions before enabling them in <TT CLASS="filename" >php.ini</TT >. </P ></LI ><LI ><P >&#13; On PWS and IIS, you can set the <TT CLASS="filename" >browscap.ini</TT > to point to: <TT CLASS="filename" >c:\windows\system\inetsrv\browscap.ini</TT > on Windows 9x/Me, <TT CLASS="filename" >c:\winnt\system32\inetsrv\browscap.ini</TT > on NT/2000, and <TT CLASS="filename" >c:\windows\system32\inetsrv\browscap.ini</TT > on XP. </P ></LI ><LI ><P >&#13; Note that the <TT CLASS="filename" >mibs</TT > directory supplied with the Windows distribution contains support files for SNMP. This directory should be moved to <TT CLASS="filename" >DRIVE:\usr\mibs</TT > (<TT CLASS="filename" >DRIVE</TT > being the drive where PHP is installed.) </P ></LI ><LI ><P >&#13; If you're using NTFS on Windows NT, 2000 or XP, make sure that the user running the webserver has read permissions to your <TT CLASS="filename" >php.ini</TT > (e.g. make it readable by Everyone). </P ></LI ></UL > </P ></LI ><LI ><P >&#13; For PWS give execution permission to the webroot: <P ></P ><UL ><LI ><P >&#13; Start PWS Web Manager </P ></LI ><LI ><P >&#13; Edit Properties of the "Home"-Directory </P ></LI ><LI ><P >&#13; Select the "execute"-Checkbox </P ></LI ></UL > </P ></LI ></UL > </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.windows.build" ></A >Building from source</H2 ><P >&#13; Before getting started, it is worthwhile answering the question: "Why is building on Windows so hard?" Two reasons come to mind: </P ><P ></P ><OL TYPE="1" ><LI ><P >&#13; Windows does not (yet) enjoy a large community of developers who are willing to freely share their source. As a direct result, the necessary investment in infrastructure required to support such development hasn't been made. By and large, what is available has been made possible by the porting of necessary utilities from Unix. Don't be surprised if some of this heritage shows through from time to time. </P ></LI ><LI ><P >&#13; Pretty much all of the instructions that follow are of the "set and forget" variety. So sit back and try follow the instructions below as faithfully as you can. </P ></LI ></OL ><DIV CLASS="sect3" ><H3 CLASS="sect3" ><A NAME="install.windows.build.prepare" ></A >Preparations</H3 ><P >&#13; Before you get started, you have a lot to download... </P ><P ></P ><UL ><LI ><P >&#13; For starters, get the Cygwin toolkit from the closest <A HREF="http://sources.redhat.com/cygwin/download.html" TARGET="_top" >cygwin</A > mirror site. This will provide you most of the popular GNU utilities used by the build process. </P ></LI ><LI ><P >&#13; Download the rest of the build tools you will need from the PHP site at <A HREF="http://www.php.net/extra/win32build.zip" TARGET="_top" >http://www.php.net/extra/win32build.zip</A >. </P ></LI ><LI ><P >&#13; Get the source code for the DNS name resolver used by PHP at <A HREF="http://www.php.net/extra/bindlib_w32.zip" TARGET="_top" >http://www.php.net/extra/bindlib_w32.zip</A >. This is a replacement for the <TT CLASS="filename" >resolv.lib</TT > library included in <TT CLASS="filename" >win32build.zip</TT >. </P ></LI ><LI ><P >&#13; If you don't already have an unzip utility, you will need one. A free version is available from <A HREF="http://www.cdrom.com/pub/infozip/UnZip.html" TARGET="_top" >InfoZip</A >. </P ></LI ><LI ><P >If you plan to compile PHP as a static Apache module you will also need the <A HREF="http://httpd.apache.org/dist/httpd/" TARGET="_top" >Apache sources</A > of your version of Apache. </P ></LI ></UL ><P >&#13; Finally, you are going to need the source to PHP 4 itself. You can get the latest development version using <A HREF="http://www.php.net/anoncvs.php" TARGET="_top" >anonymous CVS</A >. If you get a <A HREF="http://snaps.php.net/" TARGET="_top" >snapshot</A > or a <A HREF="http://www.php.net/downloads.php" TARGET="_top" >source</A > tarball, you not only will have to untar and ungzip it, but you will have to convert the bare linefeeds to crlf's in the <TT CLASS="filename" >*.dsp</TT > and <TT CLASS="filename" >*.dsw</TT > files before Microsoft Visual C++ will have anything to do with them. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >&#27880;: </B > Place the <TT CLASS="filename" >Zend</TT > and <TT CLASS="filename" >TSRM</TT > directories inside the <TT CLASS="filename" >php4</TT > directory in order for the projects to be found during the build process. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="sect3" ><H3 CLASS="sect3" ><A NAME="install.windows.build.install" ></A >Putting it all together</H3 ><P ></P ><UL ><LI ><P >&#13; Follow the instructions for installing the unzip utility of your choosing. </P ></LI ><LI ><P >&#13; Execute <TT CLASS="filename" >setup.exe</TT > and follow the installation instructions. If you choose to install to a path other than <TT CLASS="filename" >c:\cygnus</TT >, let the build process know by setting the Cygwin environment variable. On Windows 95/98 setting an environment variable can be done by placing a line in your <TT CLASS="filename" >autoexec.bat</TT >. On Windows NT, go to My Computer =&#62; Control Panel =&#62; System and select the environment tab. </P ></LI ></UL ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >&#35686;&#21578;</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >&#13; Make a temporary directory for Cygwin to use, otherwise many commands (particularly bison) will fail. On Windows 95/98, <TT CLASS="userinput" ><B >mkdir C:\TMP</B ></TT >. For Windows NT, <TT CLASS="userinput" ><B >mkdir %SystemDrive%\tmp</B ></TT >. </P ></TD ></TR ></TABLE ></DIV ><P ></P ><UL ><LI ><P >&#13; Make a directory and unzip <TT CLASS="filename" >win32build.zip</TT > into it. </P ></LI ><LI ><P >&#13; Launch Microsoft Visual C++, and from the menu select Tools =&#62; Options. In the dialog, select the directories tab. Sequentially change the dropdown to Executables, Includes, and Library files, and ensure that <TT CLASS="filename" >cygwin\bin</TT >, <TT CLASS="filename" >win32build\include</TT >, and <TT CLASS="filename" >win32build\lib</TT > are in each list, respectively. (To add an entry, select a blank line at the end of the list and begin typing). Typical entries will look like this: </P ><P ></P ><UL ><LI ><P >&#13; <TT CLASS="filename" >c:\cygnus\bin</TT > </P ></LI ><LI ><P >&#13; <TT CLASS="filename" >c:\php-win32build\include</TT > </P ></LI ><LI ><P >&#13; <TT CLASS="filename" >c:\php-win32build\lib</TT > </P ></LI ></UL ><P >&#13; Press OK, and exit out of Visual C++. </P ></LI ><LI ><P >&#13; Make another directory and unzip <TT CLASS="filename" >bindlib_w32.zip</TT > into it. Decide whether you want to have debug symbols available (bindlib - Win32 Debug) or not (bindlib - Win32 Release). Build the appropriate configuration: </P ><P ></P ><UL ><LI ><P >&#13; For GUI users, launch VC++, and then select File =&#62; Open Workspace and select bindlib. Then select Build=&#62;Set Active Configuration and select the desired configuration. Finally select Build=&#62;Rebuild All. </P ></LI ><LI ><P >&#13; For command line users, make sure that you either have the C++ environment variables registered, or have run <B CLASS="command" >vcvars.bat</B >, and then execute one of the following: </P ><P ></P ><UL ><LI ><P >&#13; <TT CLASS="userinput" ><B >msdev bindlib.dsp /MAKE "bindlib - Win32 Debug"</B ></TT > </P ></LI ><LI ><P >&#13; <TT CLASS="userinput" ><B >msdev bindlib.dsp /MAKE "bindlib - Win32 Release"</B ></TT > </P ></LI ></UL ></LI ><LI ><P >&#13; At this point, you should have a usable <TT CLASS="filename" >resolv.lib</TT > in either your <TT CLASS="filename" >Debug</TT > or <TT CLASS="filename" >Release</TT > subdirectories. Copy this file into your <TT CLASS="filename" >win32build\lib</TT > directory over the file by the same name found in there. </P ></LI ></UL ></LI ></UL ></DIV ><DIV CLASS="sect3" ><H3 CLASS="sect3" ><A NAME="install.windows.build.compile" ></A >Compiling</H3 ><P >&#13; The best way to get started is to build the standalone/CGI version. </P ><P ></P ><UL ><LI ><P >&#13; For GUI users, launch VC++, and then select File =&#62; Open Workspace and select php4ts. Then select Build=&#62;Set Active Configuration and select the desired configuration. Finally select Build=&#62;Rebuild All. </P ></LI ><LI ><P >&#13; For command line users, make sure that you either have the C++ environment variables registered, or have run <B CLASS="command" >vcvars.bat</B >, and then execute one of the following: </P ><P ></P ><UL ><LI ><P >&#13; <TT CLASS="userinput" ><B >msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"</B ></TT > </P ></LI ><LI ><P >&#13; <TT CLASS="userinput" ><B >msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"</B ></TT > </P ></LI ><LI ><P >&#13; At this point, you should have a usable <TT CLASS="filename" >php.exe</TT > in either your <TT CLASS="filename" >Debug_TS</TT > or <TT CLASS="filename" >Release_TS</TT > subdirectories. </P ></LI ></UL ></LI ></UL ><P >&#13; Repeat the above steps with <TT CLASS="filename" >php4isapi.dsp</TT > (which can be found in <TT CLASS="filename" >sapi\isapi</TT >) in order to build the code necessary for integrating PHP with Microsoft IIS. </P ><P >&#13; It is possible to do minor customization to the build process by editing the main/config.win32.h.in file. </P ></DIV ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.windows.extensions" ></A >Installation of Windows extensions</H2 ><P >&#13; After installing PHP and a webserver on Windows, you will probably want to install some extensions for added functionality. The following table describes some of the extensions available. You can choose which extensions you would like to load when PHP starts by uncommenting the: 'extension=php_*.dll' lines in <TT CLASS="filename" >php.ini</TT >. You can also load a module dynamically in your script using <A HREF="function.dl.php" ><B CLASS="function" >dl()</B ></A >. </P ><P >&#13; The DLLs for PHP extensions are prefixed with 'php_' in PHP 4 (and 'php3_' in PHP 3). This prevents confusion between PHP extensions and their supporting libraries. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >&#27880;: </B > In PHP 4.0.6 BCMath, Calendar, COM, FTP, MySQL, ODBC, PCRE, Session, WDDX and XML support is <SPAN CLASS="emphasis" ><I CLASS="emphasis" >built in</I ></SPAN >. You don't need to load any additional extensions in order to use these functions. See your distributions <TT CLASS="filename" >README.txt</TT > or <TT CLASS="filename" >install.txt</TT > for a list of built in modules. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >&#27880;: </B > Some of these extensions need extra DLLs to work. Couple of them can be found in the distribution package, in the 'dlls' folder but some, for example Oracle (php_oci8.dll) require DLLs which are not bundled with the distribution package. </P ><P >&#13; Copy the bundled DLLs from 'DLLs' folder to your Windows PATH, safe places are: <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD >c:\windows\system for Windows 9x/Me</TD ></TR ><TR ><TD >c:\winnt\system32 for Windows NT/2000</TD ></TR ><TR ><TD >c:\windows\system32 for Windows XP</TD ></TR ></TBODY ></TABLE ><P ></P > If you have them already installed on your system, overwrite them only if something doesn't work correctly (Before overwriting them, it is a good idea to make a backup of them, or move them to another folder - just in case something goes wrong). </P ></BLOCKQUOTE ></DIV ><P >&#13; <DIV CLASS="table" ><A NAME="AEN742" ></A ><P ><B >&#34920;&#26684; 3-1. PHP Extensions</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Extension</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Description</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Notes</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_bz2.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.bzip2.php" >bzip2</A > compression functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_calendar.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.calendar.php" >Calendar</A > conversion functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Built in since PHP 4.0.3</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_cpdf.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.cpdf.php" >ClibPDF</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_crack.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.crack.php" >Crack</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_crypt.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Crypt functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >unknown</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_ctype.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ctype.php" >ctype</A > family functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_curl.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.curl.php" >CURL</A >, Client URL library functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: libeay32.dll, ssleay32.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_cybercash.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.cybercash.php" >Cybercash</A > payment functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_db.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.dbm.php" >DBM</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Deprecated. Use DBA instead (php_dba.dll)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_dba.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.dba.php" >DBA</A >: DataBase (dbm-style) Abstraction layer functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_dbase.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.dbase.php" >dBase</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_dbm.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Berkeley DB2 library</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >unknown</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_domxml.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.domxml.php" >DOM XML</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: libxml2.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_dotnet.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.dotnet.php" >.NET</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_exif.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="function.read-exif-data.php" >Read EXIF</A > headers from JPEG</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_fbsql.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.fbsql.php" >FrontBase</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_fdf.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.fdf.php" >FDF</A >: Forms Data Format functions.</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: fdftk.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_filepro.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.filepro.php" >filePro</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Read-only access</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_ftp.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ftp.php" >FTP</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Built-in since PHP 4.0.3</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_gd.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.image.php" >GD</A > library image functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_gettext.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.gettext.php" >Gettext</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: gnu_gettext.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_hyperwave.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.hyperwave.php" >HyperWave</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_iconv.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.iconv.php" >ICONV</A > characterset conversion</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: iconv-1.3.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_ifx.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ifx.php" >Informix</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: Informix libraries</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_iisfunc.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >IIS management functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_imap.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.imap.php" >IMAP</A > POP3 and NNTP functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP 3: php3_imap4r1.dll</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_ingres.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ingres.php" >Ingres II</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: Ingres II libraries</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_interbase.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ibase.php" >InterBase</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: gds32.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_java.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.java.php" >Java</A > extension</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: jvm.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_ldap.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ldap.php" >LDAP</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: libsasl.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_mhash.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.mhash.php" >Mhash</A > Functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_ming.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.ming.php" >Ming</A > functions for Flash</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_msql.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.msql.php" >mSQL</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: msql.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_msql1.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >mSQL 1 client</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >unknown</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_msql2.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >mSQL 2 client</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >unknown</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_mssql.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.mssql.php" >MSSQL</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: ntwdblib.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_mysql.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.mysql.php" >MySQL</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Built-in in PHP 4</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_nsmail.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Netscape mail functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >unknown</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php3_oci73.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Oracle functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >unknown</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_oci8.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.oci8.php" >Oracle 8</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: Oracle 8 client libraries</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_openssl.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.openssl.php" >OpenSSL</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: libeay32.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_oracle.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.oracle.php" >Oracle</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: Oracle 7 client libraries</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_pdf.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.pdf.php" >PDF</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_pgsql.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.pgsql.php" >PostgreSQL</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_printer.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.printer.php" >Printer</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_xslt.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.xslt.php" >XSLT</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: sablot.dll (bundled)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_snmp.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.snmp.php" >SNMP</A > get and walk functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >NT only!</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_sybase_ct.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.sybase.php" >Sybase</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Requires: Sybase client libraries</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_yaz.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.yaz.php" >YAZ</A > functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >php_zlib.dll</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="ref.zlib.php" >ZLib</A > compression functions</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >None</TD ></TR ></TBODY ></TABLE ></DIV > </P ></DIV ></DIV ><?php manualFooter('Installation on Windows systems','install.windows.php'); ?> Index: phpdoc/php/installation.php +++ phpdoc/php/installation.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('tutorial.whatsnext.php', 'What\'s next?'), 'next' => array('install.hpux.php', 'Unix/HP-UX installs'), 'up' => array('getting-started.php', '¤Jªù'), 'toc' => array( array('introduction.php', 'Introduction'), array('tutorial.php', 'A simple tutorial'), array('installation.php', '¦w¸Ë'), array('configuration.php', 'Configuration'), array('security.php', 'Security'), ))); manualHeader('¦w¸Ë','installation.php'); ?><DIV CLASS="chapter" ><H1 ><A NAME="installation" ></A >&#31456; 3. ¦w¸Ë</H1 ><DIV CLASS="TOC" ><DL ><DT ><B >&#20839;&#23481;&#30446;&#37636; Index: phpdoc/php/intro-whatcando.php +++ phpdoc/php/intro-whatcando.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('introduction.php', 'Introduction'), 'next' => array('tutorial.php', 'A simple tutorial'), 'up' => array('introduction.php', 'Introduction'), 'toc' => array( array('introduction.php#intro-whatis', 'What is PHP?'), array('intro-whatcando.php', 'What can PHP do?'), ))); manualHeader('What can PHP do?','intro-whatcando.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="intro-whatcando" ></A >What can PHP do?</H1 ><P >&#13; Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more. </P ><P >&#13; There are three main fields where PHP scripts are used. <P ></P ><UL ><LI ><P >&#13; Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a webserver and a web browser. You need to run the webserver, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. See the <A HREF="installation.php" >installation instructions</A > section for more information. </P ></LI ><LI ><P >&#13; Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about <A HREF="features.commandline.php" >Command line usage of PHP</A > for more information. </P ></LI ><LI ><P >&#13; Writing client-side GUI applications. PHP is probably not the very best language to write windowing applications, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution. If you are interested in PHP-GTK, visit <A HREF="http://gtk.php.net/" TARGET="_top" >it's own website</A >. </P ></LI ></UL > </P ><P >&#13; PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor. </P ><P >&#13; So with PHP, you have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object oriented programming, or a mixture of them. Although not every standard OOP feature is realized in the current version of PHP, many code libraries and large applications (including the PEAR library) are written only using OOP code. </P ><P >&#13; With PHP you are not limited to output HTML. PHP's abilities includes outputting images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content. </P ><P >&#13; One of the strongest and most significant feature in PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple. The following databases are currently supported: <A NAME="AEN97" ></A ><BLOCKQUOTE CLASS="BLOCKQUOTE" ><P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD >Adabas D</TD ><TD >Ingres</TD ><TD >Oracle (OCI7 and OCI8)</TD ></TR ><TR ><TD >dBase</TD ><TD >InterBase</TD ><TD >Ovrimos</TD ></TR ><TR ><TD >Empress</TD ><TD >FrontBase</TD ><TD >PostgreSQL</TD ></TR ><TR ><TD >FilePro (read-only)</TD ><TD >mSQL</TD ><TD >Solid</TD ></TR ><TR ><TD >Hyperwave</TD ><TD >Direct MS-SQL</TD ><TD >Sybase</TD ></TR ><TR ><TD >IBM DB2</TD ><TD >MySQL</TD ><TD >Velocis</TD ></TR ><TR ><TD >Informix</TD ><TD >ODBC</TD ><TD >Unix dbm</TD ></TR ></TBODY ></TABLE ><P ></P ></BLOCKQUOTE > We also have a DBX database abstraction extension allowing you to transparently use any database supported by that extension. Additionally PHP supports ODBC, the Open Database Connection standard, so you can connect to any other database supporting this world standard. </P ><P >&#13; PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection, PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use our CORBA extension to access remote objects. </P ><P >&#13; PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, we support the SAX and DOM standards. You can use our XSLT extension to transform XML documents. </P ><P >&#13; While using PHP in the ecommerce field, you'll find the Cybercash payment, CyberMUT, VeriSign Payflow Pro and CCVS functions useful for your online payment programs. </P ><P >&#13; At last but not least, we have many other interesting extensions, the mnoGoSearch search engine functions, the IRC Gateway functions, many compression utilities (gzip, bz2), calendar conversion, translation... </P ><P >&#13; As you can see this page is not enough to list all the features and benefits PHP can offer. Read on in the sections about <A HREF="installation.php" >installing PHP</A >, and see the <A HREF="funcref.php" >function reference</A > part for explanation of the extensions mentioned here. </P ></DIV ><?php manualFooter('What can PHP do?','intro-whatcando.php'); ?> Index: phpdoc/php/introduction.php +++ phpdoc/php/introduction.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('getting-started.php', '¤Jªù'), 'next' => array('intro-whatcando.php', 'What can PHP do?'), 'up' => array('getting-started.php', '¤Jªù'), 'toc' => array( array('introduction.php', 'Introduction'), array('tutorial.php', 'A simple tutorial'), array('installation.php', '¦w¸Ë'), array('configuration.php', 'Configuration'), array('security.php', 'Security'), ))); manualHeader('Introduction','introduction.php'); ?><DIV CLASS="chapter" ><H1 ><A NAME="introduction" ></A >&#31456; 1. Introduction</H1 ><DIV CLASS="TOC" ><DL ><DT ><B >&#20839;&#23481;&#30446;&#37636;</B ></DT ><DT ><A HREF="introduction.php#intro-whatis" >What is PHP?</A ></DT ><DT ><A HREF="intro-whatcando.php" >What can PHP do?</A ></DT ></DL ></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="intro-whatis" ></A >What is PHP?</H1 ><P >&#13; <SPAN CLASS="acronym" >PHP</SPAN > (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. </P ><P >&#13; Simple answer, but what does that mean? An example: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN70" ></A ><P ><B >&#31684;&#20363; 1-1. An introductory example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >&#60;html&#62; &#60;head&#62; &#60;title&#62;Example&#60;/title&#62; &#60;/head&#62; &#60;body&#62; &#60;?php echo "Hi, I'm a PHP script!"; ?&#62; &#60;/body&#62; &#60;/html&#62;</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; Notice how this is different from a script written in other languages like Perl or C -- instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). The PHP code is enclosed in special <A HREF="language.basic-syntax.php#language.basic-syntax.phpmode" >start and end tags</A > that allow you to jump into and out of "PHP mode". </P ><P >&#13; What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve. </P ><P >&#13; The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. Don't be afraid reading the long list of PHP's features. You can jump in, in a short time, and start writing simple scripts in a few hours. </P ><P >&#13; Although PHP's development is focused on server-side scripting, you can do much more with it. Read on, and see more in the <A HREF="intro-whatcando.php" >What can PHP do?</A > section. </P ></DIV ></DIV ><?php manualFooter('Introduction','introduction.php'); ?> Index: phpdoc/php/preface.php +++ phpdoc/php/preface.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('index.php', 'PHP ¤â¥U'), 'next' => array('getting-started.php', '¤Jªù'), 'up' => array('index.php', 'PHP ¤â¥U'), 'toc' => array( array('preface.php', 'Preface'), array('getting-started.php', '¤Jªù'), array('langref.php', '»y¨¥°Ñ¦Ò'), array('features.php', '¯S¦â'), array('funcref.php', '¨ç¼Æ°Ñ¦Ò'), array('streams.php', 'Streams API for PHP Extension Authors'), array('faq.php', 'FAQ'), array('appendixes.php', 'ªþ¿ý'), ))); manualHeader('Preface','preface.php'); ?><DIV CLASS="preface" ><H1 ><A NAME="preface" ></A >Preface</H1 ><BLOCKQUOTE CLASS="ABSTRACT" ><DIV CLASS="abstract" ><A NAME="AEN53" ></A ><P ></P ><P >&#13; <SPAN CLASS="acronym" >PHP</SPAN >, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Its syntax draws upon C, Java, and Perl, and is easy to learn. The main goal of the language is to allow web developers to write dynamically generated webpages quickly, but you can do much more with PHP. </P ><P ></P ></DIV ></BLOCKQUOTE ><P >&#13; This manual consists primarily of a function reference, but also contains a language reference, explanations of some of PHP's major features, and other supplemental information. </P ><P >&#13; You can download this manual in several formats at <A HREF="http://www.php.net/docs.php" TARGET="_top" >http://www.php.net/docs.php</A >. The downloads are updated as the content changes. More information about how this manual is developed can be found in the <A HREF="about.php" >'About the manual'</A > appendix. </P ></DIV ><?php manualFooter('Preface','preface.php'); ?> Index: phpdoc/php/tutorial.firstpage.php +++ phpdoc/php/tutorial.firstpage.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('tutorial.php', 'A simple tutorial'), 'next' => array('tutorial.useful.php', 'Something Useful'), 'up' => array('tutorial.php', 'A simple tutorial'), 'toc' => array( array('tutorial.php#tutorial.requirements', 'What do I need?'), array('tutorial.firstpage.php', 'Your first PHP-enabled page'), array('tutorial.useful.php', 'Something Useful'), array('tutorial.forms.php', 'Dealing with Forms'), array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), array('tutorial.whatsnext.php', 'What\'s next?'), ))); manualHeader('Your first PHP-enabled page','tutorial.firstpage.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.firstpage" ></A >Your first PHP-enabled page</H1 ><P >&#13; Create a file named <TT CLASS="filename" >hello.php</TT > under your webserver root directory with the following content: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN142" ></A ><P ><B >&#31684;&#20363; 2-1. Our first PHP script: <TT CLASS="filename" >hello.php</TT ></B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >&#60;html&#62; &#60;head&#62; &#60;title&#62;PHP Test&#60;/title&#62; &#60;/head&#62; &#60;body&#62; &#60;?php echo "Hello World&#60;p&#62;"; ?&#62; &#60;/body&#62; &#60;/html&#62;</PRE ></TD ></TR ></TABLE ><P >&#13; The output of this script will be: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="html" >&#60;html&#62; &#60;head&#62; &#60;title&#62;PHP Test&#60;/title&#62; &#60;/head&#62; &#60;body&#62; Hello World&#60;p&#62; &#60;/body&#62; &#60;/html&#62;</PRE ></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; Note that this is not like a CGI script. The file does not need to be executable or special in any way. Think of it as a normal HTML file which happens to have a set of special tags available to you that do a lot of interesting things. </P ><P >&#13; This program is extremely simple and you really didn't need to use PHP to create a page like this. All it does is display: <TT CLASS="literal" >Hello World</TT > using the PHP <A HREF="function.echo.php" ><B CLASS="function" >echo()</B ></A > statement. </P ><P >&#13; If you tried this example and it didn't output anything, or it prompted for download, or you see the whole file as text, chances are that the server you are on does not have PHP enabled. Ask your administrator to enable it for you using the <A HREF="installation.php" >Installation</A > chapter of the manual. If you want to develop PHP scripts locally, see the <A HREF="http://www.php.net/downloads.php" TARGET="_top" >downloads</A > section. You can develop locally on any Operating system, be sure to install an appropriate web server too. </P ><P >&#13; The point of the example is to show the special PHP tag format. In this example we used <TT CLASS="literal" >&#60;?php</TT > to indicate the start of a PHP tag. Then we put the PHP statement and left PHP mode by adding the closing tag, <TT CLASS="literal" >?&#62;</TT >. You may jump in and out of PHP mode in an HTML file like this all you want. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >A Note on Text Editors: </B > There are many text editors and Integrated Development Environments (IDEs) that you can use to create, edit and manage PHP files. A partial list of these tools is maintained at <A HREF="http://www.itworks.demon.co.uk/phpeditors.htm" TARGET="_top" >PHP Editor's List</A >. If you wish to recommend an editor, please visit the above page and ask the page maintainer to add the editor to the list. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >A Note on Word Processors: </B > Word processors such as StarOffice Writer, Microsoft Word and Abiword are not good choices for editing PHP files. </P ><P >&#13; If you wish to use one for this test script, you must ensure that you save the file as PLAIN TEXT or PHP will not be able to read and execute the script. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >A Note on Windows Notepad: </B > If you are writing your PHP scripts using Windows Notepad, you will need to ensure that your files are saved with the .php extension. (Notepad adds a .txt extension to files automatically unless you take one of the following steps to prevent it.) </P ><P > When you save the file and are prompted to provide a name for the file, place the filename in quotes (i.e. "hello.php"). </P ><P >&#13; Alternately, you can click on the 'Text Documents' drop-down menu in the save dialog box and change the setting to "All Files". You can then enter your filename without quotes. </P ></BLOCKQUOTE ></DIV ></DIV ><?php manualFooter('Your first PHP-enabled page','tutorial.firstpage.php'); ?> Index: phpdoc/php/tutorial.forms.php +++ phpdoc/php/tutorial.forms.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('tutorial.useful.php', 'Something Useful'), 'next' => array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), 'up' => array('tutorial.php', 'A simple tutorial'), 'toc' => array( array('tutorial.php#tutorial.requirements', 'What do I need?'), array('tutorial.firstpage.php', 'Your first PHP-enabled page'), array('tutorial.useful.php', 'Something Useful'), array('tutorial.forms.php', 'Dealing with Forms'), array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), array('tutorial.whatsnext.php', 'What\'s next?'), ))); manualHeader('Dealing with Forms','tutorial.forms.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.forms" ></A >Dealing with Forms</H1 ><P >&#13; One of the most powerful features of PHP is the way it handles HTML forms. The basic concept that is important to understand is that any form element in a form will automatically be available to your PHP scripts. Please read the manual section on <A HREF="language.variables.external.php" >Variables from outside of PHP</A > for more information and examples on using forms with PHP. Here's an example HTML form: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN248" ></A ><P ><B >&#31684;&#20363; 2-6. A simple HTML form</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="html" >&#60;form action="action.php" method="POST"&#62; Your name: &#60;input type="text" name="name" /&#62; Your age: &#60;input type="text" name="age" /&#62; &#60;input type="submit"&#62; &#60;/form&#62;</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; There is nothing special about this form. It is a straight HTML form with no special tags of any kind. When the user fills in this form and hits the submit button, the <TT CLASS="filename" >action.php</TT > page is called. In this file you would have something like this: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN254" ></A ><P ><B >&#31684;&#20363; 2-7. Printing data from our form</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >Hi &#60;?php echo $_POST["name"]; ?&#62;. You are &#60;?php echo $_POST["age"]; ?&#62; years old.</PRE ></TD ></TR ></TABLE ><P >&#13; A sample output of this script may be: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="html" >Hi Joe. You are 22 years old.</PRE ></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; It should be obvious what this does. There is nothing more to it. The <TT CLASS="varname" >$_POST["name"]</TT > and <TT CLASS="varname" >$_POST["age"]</TT > variables are automatically set for you by PHP. Earlier we used the <TT CLASS="varname" >$_SERVER</TT > autoglobal, now above we just introduced the <A HREF="reserved.variables.php#reserved.variables.post" >$_POST</A > autoglobal which contains all POST data. Notice how the <SPAN CLASS="emphasis" ><I CLASS="emphasis" >method</I ></SPAN > of our form is POST. If we used the method <SPAN CLASS="emphasis" ><I CLASS="emphasis" >GET</I ></SPAN > then our form information would live in the <A HREF="reserved.variables.php#reserved.variables.get" >$_GET</A > autoglobal instead. You may also use the <A HREF="reserved.variables.php#reserved.variables.request" >$_REQUEST</A > autoglobal if you don't care the source of your request data. It contains a mix of GET, POST, COOKIE and FILE data. See also the <A HREF="function.import-request-variables.php" ><B CLASS="function" >import_request_variables()</B ></A > function. </P ></DIV ><?php manualFooter('Dealing with Forms','tutorial.forms.php'); ?> Index: phpdoc/php/tutorial.oldcode.php +++ phpdoc/php/tutorial.oldcode.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('tutorial.forms.php', 'Dealing with Forms'), 'next' => array('tutorial.whatsnext.php', 'What\'s next?'), 'up' => array('tutorial.php', 'A simple tutorial'), 'toc' => array( array('tutorial.php#tutorial.requirements', 'What do I need?'), array('tutorial.firstpage.php', 'Your first PHP-enabled page'), array('tutorial.useful.php', 'Something Useful'), array('tutorial.forms.php', 'Dealing with Forms'), array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), array('tutorial.whatsnext.php', 'What\'s next?'), ))); manualHeader('Using old code with new versions of PHP','tutorial.oldcode.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.oldcode" ></A >Using old code with new versions of PHP</H1 ><P >&#13; Now that PHP has grown to be a popular scripting language, there are more resources out there that have listings of code you can reuse in your own scripts. For the most part the developers of the PHP language have tried to be backwards compatible, so a script written for an older version should run (ideally) without changes in a newer version of PHP, in practice some changes will usually be needed. </P ><P >&#13; Two of the most important recent changes that affect old code are: <P ></P ><UL ><LI ><P >&#13; The deprecation of the old <TT CLASS="varname" >$HTTP_*_VARS</TT > arrays (which need to be indicated as global when used inside a function or method). The following <A HREF="language.variables.predefined.php#language.variables.superglobals" >autoglobal arrays</A > were introduced in PHP <A HREF="http://www.php.net/release_4_1_0.php" TARGET="_top" >4.1.0</A >. They are: <TT CLASS="varname" >$_GET</TT >, <TT CLASS="varname" >$_POST</TT >, <TT CLASS="varname" >$_COOKIE</TT >, <TT CLASS="varname" >$_SERVER</TT >, <TT CLASS="varname" >$_ENV</TT >, <TT CLASS="varname" >$_REQUEST</TT >, and <TT CLASS="varname" >$_SESSION</TT >. The older <TT CLASS="varname" >$HTTP_*_VARS</TT > arrays, such as $HTTP_POST_VARS, still exist and have since PHP 3. </P ></LI ><LI ><P >&#13; External variables are no longer registered in the global scope by default. In other words, as of PHP <A HREF="http://www.php.net/release_4_2_0.php" TARGET="_top" >4.2.0</A > the PHP directive <A HREF="configuration.directives.php#ini.register-globals" >register_globals</A > is <SPAN CLASS="emphasis" ><I CLASS="emphasis" >off</I ></SPAN > by default in <TT CLASS="filename" >php.ini</TT >. The preferred method of accessing these values is via the autoglobal arrays mentioned above. Older scripts, books, and tutorials may rely on this directive being on. If on, for example, one could use <TT CLASS="varname" >$id</TT > from the URL <TT CLASS="literal" >http://www.example.com/foo.php?id=42</TT >. Whether on or off, <TT CLASS="varname" >$_GET['id']</TT > is available. </P ></LI ></UL > For more details on these changes, see the section on <A HREF="language.variables.predefined.php" >predefined variables</A > and links therein. </P ></DIV ><?php manualFooter('Using old code with new versions of PHP','tutorial.oldcode.php'); ?> Index: phpdoc/php/tutorial.php +++ phpdoc/php/tutorial.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('intro-whatcando.php', 'What can PHP do?'), 'next' => array('tutorial.firstpage.php', 'Your first PHP-enabled page'), 'up' => array('getting-started.php', '¤Jªù'), 'toc' => array( array('introduction.php', 'Introduction'), array('tutorial.php', 'A simple tutorial'), array('installation.php', '¦w¸Ë'), array('configuration.php', 'Configuration'), array('security.php', 'Security'), ))); manualHeader('A simple tutorial','tutorial.php'); ?><DIV CLASS="chapter" ><H1 ><A NAME="tutorial" ></A >&#31456; 2. A simple tutorial</H1 ><DIV CLASS="TOC" ><DL ><DT ><B >&#20839;&#23481;&#30446;&#37636;</B ></DT ><DT ><A HREF="tutorial.php#tutorial.requirements" >What do I need?</A ></DT ><DT ><A HREF="tutorial.firstpage.php" >Your first PHP-enabled page</A ></DT ><DT ><A HREF="tutorial.useful.php" >Something Useful</A ></DT ><DT ><A HREF="tutorial.forms.php" >Dealing with Forms</A ></DT ><DT ><A HREF="tutorial.oldcode.php" >Using old code with new versions of PHP</A ></DT ><DT ><A HREF="tutorial.whatsnext.php" >What's next?</A ></DT ></DL ></DIV ><P >&#13; Here we would like to show the very basics of PHP in a short simple tutorial. This text only deals with dynamic webpage creation with PHP, though PHP is not only capable of creating webpages. See the section titled <A HREF="intro-whatcando.php" >What can PHP do</A > for more information. </P ><P >&#13; PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages. </P ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.requirements" ></A >What do I need?</H1 ><P >&#13; In this tutorial we assume that your server has support for PHP activated and that all files ending in <TT CLASS="filename" >.php</TT > are handled by PHP. On most servers this is the default extension for PHP files, but ask your server administrator to be sure. If your server supports PHP then you don't need to do anything. Just create your <TT CLASS="filename" >.php</TT > files and put them in your web directory and the server will magically parse them for you. There is no need to compile anything nor do you need to install any extra tools. Think of these PHP-enabled files as simple HTML files with a whole new family of magical tags that let you do all sorts of things. </P ></DIV ></DIV ><?php manualFooter('A simple tutorial','tutorial.php'); ?> Index: phpdoc/php/tutorial.useful.php +++ phpdoc/php/tutorial.useful.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('tutorial.firstpage.php', 'Your first PHP-enabled page'), 'next' => array('tutorial.forms.php', 'Dealing with Forms'), 'up' => array('tutorial.php', 'A simple tutorial'), 'toc' => array( array('tutorial.php#tutorial.requirements', 'What do I need?'), array('tutorial.firstpage.php', 'Your first PHP-enabled page'), array('tutorial.useful.php', 'Something Useful'), array('tutorial.forms.php', 'Dealing with Forms'), array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), array('tutorial.whatsnext.php', 'What\'s next?'), ))); manualHeader('Something Useful','tutorial.useful.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.useful" ></A >Something Useful</H1 ><P >&#13; Let's do something a bit more useful now. We are going to check what sort of browser the person viewing the page is using. In order to do that we check the user agent string that the browser sends as part of its HTTP request. This information is stored in a <A HREF="language.variables.php" >variable</A >. Variables always start with a dollar-sign in PHP. The variable we are interested in right now is <TT CLASS="varname" >$_SERVER["HTTP_USER_AGENT"]</TT >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >PHP Autoglobals Note: </B > <A HREF="reserved.variables.php#reserved.variables.server" >$_SERVER</A > is a special reserved PHP variable that contains all web server information. It's known as an Autoglobal (or Superglobal). See the related manual page on <A HREF="language.variables.predefined.php#language.variables.superglobals" >Autoglobals</A > for more information. These special variables were introduced in PHP <A HREF="http://www.php.net/release_4_1_0.php" TARGET="_top" >4.1.0</A >. Before this time, we used the older <TT CLASS="varname" >$HTTP_*_VARS</TT > arrays instead, such as <TT CLASS="varname" >$HTTP_SERVER_VARS</TT >. Although deprecated, these older variables still exist. (See also the note on <A HREF="tutorial.oldcode.php" >old code</A >.) </P ></BLOCKQUOTE ></DIV ><P >&#13; To display this variable, we can simply do: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN187" ></A ><P ><B >&#31684;&#20363; 2-2. Printing a variable (Array element)</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >&#60;?php echo $_SERVER["HTTP_USER_AGENT"]; ?&#62;</PRE ></TD ></TR ></TABLE ><P >&#13; A sample output of this script may be: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="html" >Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)</PRE ></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; There are many <A HREF="language.types.php" >types</A > of variables available in PHP. In the above example we printed an <A HREF="language.types.array.php" >Array</A > element. Arrays can be very useful. </P ><P >&#13; <TT CLASS="varname" >$_SERVER</TT > is just one variable that's automatically made available to you by PHP. A list can be seen in the <A HREF="reserved.variables.php" >Reserved Variables</A > section of the manual or you can get a complete list of them by creating a file that looks like this: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN199" ></A ><P ><B >&#31684;&#20363; 2-3. Show all predefined variables with <A HREF="function.phpinfo.php" ><B CLASS="function" >phpinfo()</B ></A ></B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >&#60;?php phpinfo(); ?&#62;</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; If you load up this file in your browser you will see a page full of information about PHP along with a list of all the variables available to you. </P ><P >&#13; You can put multiple PHP statements inside a PHP tag and create little blocks of code that do more than just a single echo. For example, if we wanted to check for Internet Explorer we could do something like this: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN206" ></A ><P ><B >&#31684;&#20363; 2-4. Example using <A HREF="control-structures.php" >control structures</A > and <A HREF="functions.php" >functions</A ></B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >&#60;?php if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) { echo "You are using Internet Explorer&#60;br /&#62;"; } ?&#62;</PRE ></TD ></TR ></TABLE ><P >&#13; A sample output of this script may be: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="html" >You are using Internet Explorer&#60;br /&#62;</PRE ></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; Here we introduce a couple of new concepts. We have an <A HREF="control-structures.php#control-structures.if" >if</A > statement. If you are familiar with the basic syntax used by the C language this should look logical to you. If you don't know enough C or some other language where the syntax used above is used, you should probably pick up any introductory PHP book and read the first couple of chapters, or read the <A HREF="langref.php" >Language Reference</A > part of the manual. You can find a list of PHP books at <A HREF="http://www.php.net/books.php" TARGET="_top" >http://www.php.net/books.php</A >. </P ><P >&#13; The second concept we introduced was the <A HREF="function.strstr.php" ><B CLASS="function" >strstr()</B ></A > function call. <A HREF="function.strstr.php" ><B CLASS="function" >strstr()</B ></A > is a function built into PHP which searches a string for another string. In this case we are looking for <TT CLASS="literal" >"MSIE"</TT > inside <TT CLASS="varname" >$_SERVER["HTTP_USER_AGENT"]</TT >. If the string is found, the function returns <TT CLASS="constant" ><B >TRUE</B ></TT > and if it isn't, it returns <TT CLASS="constant" ><B >FALSE</B ></TT >. If it returns <TT CLASS="constant" ><B >TRUE</B ></TT >, the <A HREF="control-structures.php#control-structures.if" >if</A > statement evaluates to <TT CLASS="constant" ><B >TRUE</B ></TT > and the code within its {braces} is executed. Otherwise, it's not. Feel free to create similar examples, with <A HREF="control-structures.php#control-structures.if" >if</A >, <A HREF="control-structures.else.php" >else</A >, and other functions such as <A HREF="function.strtoupper.php" ><B CLASS="function" >strtoupper()</B ></A > and <A HREF="function.strlen.php" ><B CLASS="function" >strlen()</B ></A >. Each related manual page contains examples too. </P ><P >&#13; We can take this a step further and show how you can jump in and out of PHP mode even in the middle of a PHP block: </P ><P >&#13; <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN233" ></A ><P ><B >&#31684;&#20363; 2-5. Mixing both HTML and PHP modes</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >&#60;?php if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) { ?&#62; &#60;h3&#62;strstr must have returned true&#60;/h3&#62; &#60;center&#62;&#60;b&#62;You are using Internet Explorer&#60;/b&#62;&#60;/center&#62; &#60;?php } else { ?&#62; &#60;h3&#62;strstr must have returned false&#60;/h3&#62; &#60;center&#62;&#60;b&#62;You are not using Internet Explorer&#60;/b&#62;&#60;/center&#62; &#60;?php } ?&#62;</PRE ></TD ></TR ></TABLE ><P >&#13; A sample output of this script may be: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="html" >&#60;h3&#62;strstr must have returned true&#60;/h3&#62; &#60;center&#62;&#60;b&#62;You are using Internet Explorer&#60;/b&#62;&#60;/center&#62;</PRE ></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE > </P ><P >&#13; Instead of using a PHP echo statement to output something, we jumped out of PHP mode and just sent straight HTML. The important and powerful point to note here is that the logical flow of the script remains intact. Only one of the HTML blocks will end up getting sent to the viewer depending on if <A HREF="function.strstr.php" ><B CLASS="function" >strstr()</B ></A > returned <TT CLASS="constant" ><B >TRUE</B ></TT > or <TT CLASS="constant" ><B >FALSE</B ></TT > In other words, if the string <TT CLASS="literal" >MSIE</TT > was found or not. </P ></DIV ><?php manualFooter('Something Useful','tutorial.useful.php'); ?> Index: phpdoc/php/tutorial.whatsnext.php +++ phpdoc/php/tutorial.whatsnext.php <?php require('shared-manual.inc'); sendManualHeaders('ISO-8859-1','zh_tw'); setupNavigation(array( 'home' => array('index.php', 'PHP ¤â¥U'), 'prev' => array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), 'next' => array('installation.php', '¦w¸Ë'), 'up' => array('tutorial.php', 'A simple tutorial'), 'toc' => array( array('tutorial.php#tutorial.requirements', 'What do I need?'), array('tutorial.firstpage.php', 'Your first PHP-enabled page'), array('tutorial.useful.php', 'Something Useful'), array('tutorial.forms.php', 'Dealing with Forms'), array('tutorial.oldcode.php', 'Using old code with new versions of PHP'), array('tutorial.whatsnext.php', 'What\'s next?'), ))); manualHeader('What\'s next?','tutorial.whatsnext.php'); ?><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.whatsnext" ></A >What's next?</H1 ><P >&#13; With what you know now you should be able to understand most of the manual and also the various example scripts available in the example archives. You can also find other examples on the php.net websites in the links section: <A HREF="http://www.php.net/links.php" TARGET="_top" >http://www.php.net/links.php</A >. </P ></DIV ><?php manualFooter('What\'s next?','tutorial.whatsnext.php'); ?>
« previous php.doc (#969348967) next »