summaryrefslogtreecommitdiff
path: root/INSTALL
diff options
context:
space:
mode:
Diffstat (limited to 'INSTALL')
-rw-r--r--INSTALL1058
1 files changed, 621 insertions, 437 deletions
diff --git a/INSTALL b/INSTALL
index 7775bf7594..dcf56e4c78 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,32 +4,41 @@ Installing PHP
Table of Contents
1. General Installation Considerations
- 2. Installation on Mac OS X
+ 2. Installation on Unix systems
- Using Packages
- Compiling for OS X Server
- Compiling for MacOS X Client
-
- 3. Installation on Unix systems
-
- Gentoo installation notes
- HP-UX specific installation notes
- OpenBSD installation notes
- Solaris specific installation tips
Apache 1.3.x on Unix systems
Apache 2.0 on Unix systems
Caudium
fhttpd related notes
Sun, iPlanet and Netscape servers on Sun Solaris
CGI and commandline setups
+ HP-UX specific installation notes
+ OpenBSD installation notes
+ Solaris specific installation tips
+ Gentoo installation notes
- 4. Problems?
+ 3. Installation on Mac OS X
+
+ Using Packages
+ Compiling for OS X Server
+ Compiling for MacOS X Client
+
+ 4. Installation of PECL extensions
+
+ Introduction to PECL Installations
+ Downloading PECL extensions
+ PECL for Windows users
+ Compiling shared PECL extensions with PEAR
+ Compiling shared PECL extensions with phpize
+ Compiling PECL extensions statically into PHP
+
+ 5. Problems?
Read the FAQ
Other problems
Bug reports
- 5. Runtime Configuration
+ 6. Runtime Configuration
The configuration file
How to change configuration settings
@@ -87,127 +96,7 @@ Chapter 1. General Installation Considerations
nearest to you for downloading the distributions.
_________________________________________________________________
-Chapter 2. Installation on Mac OS X
-
- This section contains notes and hints specific to installing PHP on
- Mac OS X. There are two slightly different versions of Mac OS X,
- Client and Server, our manual deals with installing PHP on both
- systems. Note that PHP is not available for MacOS 9 and earlier
- versions.
- _________________________________________________________________
-
-Using Packages
-
- 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.
- _________________________________________________________________
-
-Compiling for OS X Server
-
- Mac OS X Server install.
-
- 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
-
- 3. If you want the compiler to do some optimization, you may also
- want to add this line:
-
-setenv OPTIM=-O2
-
- 4. 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.
- 5. Type make and make install. This will add a directory to your
- Apache source directory under src/modules/php4.
- 6. 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. Run make and make install again.
- 7. 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.
- _________________________________________________________________
-
-Compiling for MacOS X Client
-
- The following instructions will help you install a PHP module for the
- Apache web server included in MacOS X. This version includes support
- for the MySQL and PostgreSQL databases. These instructions are
- graciously provided by Marc Liyanage.
-
- Warning
-
- Be careful when you do this, you could screw up your Apache web
- server!
-
- Do this to install:
-
- 1. Open a terminal window.
- 2. Type wget
- http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz,
- wait for the download to finish.
- 3. Type gunzip libphp4.so.gz.
- 4. Type sudo apxs -i -a -n php4 libphp4.so
- 5. Now type sudo open -a TextEdit /etc/httpd/httpd.conf. TextEdit
- will open with the web server configuration file. Locate these two
- lines towards the end of the file: (Use the Find command)
-
-#AddType application/x-httpd-php .php
-#AddType application/x-httpd-php-source .phps
-
- Remove the two hash marks (#), then save the file and quit
- TextEdit.
- 6. Finally, type sudo apachectl graceful to restart the web server.
-
- 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: <?php phpinfo() ?>.
-
- Now open up 127.0.0.1/~your_username/test.php in your web browser. You
- should see a status table with information about the PHP module.
- _________________________________________________________________
-
-Chapter 3. Installation on Unix systems
+Chapter 2. Installation on Unix systems
This section will guide you through the general configuration and
installation of PHP on Unix systems. Be sure to investigate any
@@ -235,304 +124,24 @@ Chapter 3. Installation on Unix systems
* Basic Unix skills (being able to operate "make" and a C compiler)
* An ANSI C compiler
- * flex
- * bison
+ * flex: Version 2.5.4
+ * bison: Version 1.28 (preferred), 1.35, or 1.75
* A web server
* Any module specific components (such as gd, pdf libs, etc.)
The initial PHP setup and configuration process is controlled by the
- use of the commandline options of the configure script. Our manual
- documents the different options separately. You will find the core
- options in the appendix, while the different extension specific
- options are descibed on the reference pages.
+ use of the commandline options of the configure script. You could get
+ a list of all available options along with short explanations running
+ ./configure --help. Our manual documents the different options
+ separately. You will find the core options in the appendix, while the
+ different extension specific options are descibed on the reference
+ pages.
When PHP is configured, you are ready to build the module and/or
executables. The command make should take care of this. If it fails
and you can't figure out why, see the Problems section.
_________________________________________________________________
-Gentoo installation notes
-
- This section contains notes and hints specific to installing PHP on
- Gentoo Linux.
- _________________________________________________________________
-
-Using Portage (emerge)
-
- While you can just download the PHP source and compile it youself,
- using Gentoo's packaging system is the simplest and cleanest method of
- installing PHP. If you are not familiar with building software on
- Linux, this is the way to go.
-
- If you have built your Gentoo system so far, you are probably used to
- Portage already. Installing Apache and PHP is no different than the
- other system tools.
-
- The first decision you need to make is whether you want to install
- Apache 1.3.x or Apache 2.x. While both can be used with PHP, the steps
- given bellow will use Apache 1.3.x. Another thing to consider is
- whether your local Portage tree is up to date. If you have not updated
- it recently, you need to run emerge sync before anything else. This
- way, you will be using the most recent stable version of Apache and
- PHP.
-
- Now that everything is in place, you can use the following example to
- install Apache and PHP:
-
- Example 3-1. Gentoo Install Example with Apache 1.3
-# emerge \<apache-2
-# USE="-*" emerge php mod_php
-# ebuild /var/db/pkg/dev-php/mod_php-<your PHP version>/mod_php-<your PHP versi
-on>.ebuild config
-# nano /etc/conf.d/apache
- Add "-D PHP4" to APACHE_OPTS
-
-# rc-update add apache default
-# /etc/init.d/apache start
-
- You can read more about emerge in the excellent Portage Manual
- provided on the Gentoo website.
-
- If you need to use Apache 2, you can simply use emerge apache in the
- last example.
- _________________________________________________________________
-
-Better control on configuration
-
- In the last section, PHP was emerged without any activated modules. As
- of this writing, the only module activated by default with Portage is
- XML which is needed by PEAR. This may not be what you want and you
- will soon discover that you need more activated modules, like MySQL,
- gettext, GD, etc.
-
- When you compile PHP from source yourself, you need to activate
- modules via the configure command. With Gentoo, you can simply provide
- USE flags which will be passed to the configure script automatically.
- To see which USE flags to use with emerge, you can try:
-
- Example 3-2. Getting the list of valid USE flags
-# USE="-*" emerge -pv php
-
-[ebuild N ] dev-php/php-4.3.6-r1 -X -berkdb -crypt -curl -debug -doc
--fdftk -firebird -flash -freetds -gd -gd-external -gdbm -gmp -hardenedphp
--imap -informix -ipv6 -java -jpeg -kerberos -ldap -mcal -memlimit -mssql
--mysql -ncurses -nls -oci8 -odbc -pam -pdflib -png -postgres -qt -readline
--snmp -spell -ssl -tiff -truetype -xml2 -yaz 3,876 kB
-
- As you can see from the last output, PHP considers a lot of USE flags.
- Look at them closely and choose what you need. If you choose a flag
- and you do not have the proper librairies, Portage will compile them
- for you. It is a good idea to use emerge -pv again to see what Portage
- will compile in accordance to your USE flags. As an example, if you do
- not have X installed and you choose to include X in the USE flags,
- Portage will compile X prior to PHP, which can take a couple of hours.
-
- If you choose to compile PHP with MySQL, cURL and GD support, the
- command will look something like this:
-
- Example 3-3. Install PHP with USE flags
- # USE="-* curl mysql gd" emerge php mod_php
-
- As in the last example, do not forget to emerge php as well as
- mod_php. php is responsible for the command line version of PHP as
- mod_php is for the Apache module version of PHP.
- _________________________________________________________________
-
-Common Problems
-
- * If you see the PHP source instead of the result the script should
- produce, you have probably forgot to edit /etc/conf.d/apache.
- Apache needs to be started with the -D PHP4 flag. To see if the
- flag is present, you should be able to see it when using ps ax |
- grep apache while Apache is running.
- * Due to slotting problems, you might end up with more than one
- version of PHP installed on your system. If this is the case, you
- need to unmerge the old versions manually by using emerge unmerge
- mod_php-<old version>.
- * If you cannot emerge PHP because of Java, try putting -* in front
- of your USE flags like in the above examples.
- * If you are having problems configuring Apache and PHP, you can
- always search the Gentoo Forums. Try searching with the keywords
- "Apache PHP".
- _________________________________________________________________
-
-HP-UX specific installation notes
-
- This section contains notes and hints specific to installing PHP on
- HP-UX systems. (Contributed by paul_mckay at clearwater-it dot co dot
- uk).
-
- Note: These tips were written for PHP 4.0.4 and Apache 1.3.9.
-
- 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. uncompress 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. uncompress this file and install binutils
- 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-1
- 0.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 non-gnu directory of the
- ftp site. Download the file, gunzip, then tar -xvf it. Go into the
- newly created flex directory and run ./configure, followed by
- make, and then make install.
- If you have errors here, it's probably because gcc etc. are not in
- your PATH so add them to your PATH.
- 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, e.g. 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.
- _________________________________________________________________
-
-OpenBSD installation notes
-
- This section contains notes and hints specific to installing PHP on
- OpenBSD 3.4.
- _________________________________________________________________
-
-Using Binary Packages
-
- Using binary packages to install PHP on OpenBSD is the recommended and
- simplest method. The core package has been separated from the various
- modules, and each can be installed and removed independently from the
- others. The files you need can be found on your OpenBSD CD or on the
- FTP site.
-
- The main package you need to install is php4-core-4.3.3.tgz, which
- contains the basic engine (plus gettext and iconv). Next, take a look
- at the module packages, such as php4-mysql-4.3.3.tgz or
- php4-imap-4.3.3.tgz. You need to use the phpxs command to activate and
- deactivate these modules in your php.ini.
-
- Example 3-4. OpenBSD Package Install Example
-# pkg_add php4-core-4.3.3.tgz
-# /usr/local/sbin/phpxs -s
-# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini
- (add in mysql)
-# pkg_add php4-mysql-4.3.3.tgz
-# /usr/local/sbin/phpxs -a mysql
- (add in imap)
-# pkg_add php4-imap-4.3.3.tgz
-# /usr/local/sbin/phpxs -a imap
- (remove mysql as a test)
-# pkg_delete php4-mysql-4.3.3
-# /usr/local/sbin/phpxs -r mysql
- (install the PEAR libraries)
-# pkg_add php4-pear-4.3.3.tgz
-
- Read the packages(7) manual page for more information about binary
- packages on OpenBSD.
- _________________________________________________________________
-
-Using Ports
-
- You can also compile up PHP from source using the ports tree. However,
- this is only recommended for users familiar with OpenBSD. The PHP 4
- port is split into two sub-directories: core and extensions. The
- extensions directory generates sub-packages for all of the supported
- PHP modules. If you find you do not want to create some of these
- modules, use the no_* FLAVOR. For example, to skip building the imap
- module, set the FLAVOR to no_imap.
- _________________________________________________________________
-
-Common Problems
-
- * The default install of Apache runs inside a chroot(2) jail, which
- will restrict PHP scripts to accessing files under /var/www. You
- will therefore need to create a /var/www/tmp directory for PHP
- session files to be stored, or use an alternative session backend.
- In addition, database sockets need to be placed inside the jail or
- listen on the localhost interface. If you use network functions,
- some files from /etc such as /etc/resolv.conf and /etc/services
- will need to be moved into /var/www/etc. The OpenBSD PEAR package
- automatically installs into the correct chroot directories, so no
- special modification is needed there. More information on the
- OpenBSD Apache is available in the OpenBSD FAQ.
- * The OpenBSD 3.4 package for the gd extension requires XFree86 to
- be installed. If you do not wish to use some of the font features
- that require X11, install the php4-gd-4.3.3-no_x11.tgz package
- instead.
- _________________________________________________________________
-
-Older Releases
-
- Older releases of OpenBSD used the FLAVORS system to compile up a
- statically linked PHP. Since it is hard to generate binary packages
- using this method, it is now deprecated. You can still use the old
- stable ports trees if you wish, but they are unsupported by the
- OpenBSD team. If you have any comments about this, the current
- maintainer for the port is Anil Madhavapeddy (avsm at openbsd dot
- org).
- _________________________________________________________________
-
-Solaris specific installation tips
-
- This section contains notes and hints specific to installing PHP on
- Solaris systems.
- _________________________________________________________________
-
-Required software
-
- Solaris installs often lack C compilers and their related tools. Read
- this FAQ for information on why using GNU versions for some of these
- tools is necessary. The required software is as follows:
-
- * gcc (recommended, other C compilers may work)
- * make
- * flex
- * bison
- * m4
- * autoconf
- * automake
- * perl
- * gzip
- * tar
- * GNU sed
-
- In addition, you will need to install (and possibly compile) any
- additional software specific to your configuration, such as Oracle or
- MySQL.
- _________________________________________________________________
-
-Using Packages
-
- You can simplify the Solaris install process by using pkgadd to
- install most of your needed components.
- _________________________________________________________________
-
Apache 1.3.x on Unix systems
This section contains notes and hints specific to Apache installs of
@@ -546,7 +155,7 @@ Apache 1.3.x on Unix systems
You will need to replace the 'xxx' here with the correct values from
your files.
- Example 3-5. Installation Instructions (Apache Shared Module Version)
+ Example 2-1. Installation Instructions (Apache Shared Module Version)
for PHP
1. gunzip apache_xxx.tar.gz
2. tar -xvf apache_xxx.tar
@@ -628,13 +237,46 @@ Apache 1.3.x on Unix systems
stop and restart the server, not just cause the server to reload by
using a HUP or USR1 signal.)
+ Alternatively, to install PHP as a static object:
+
+ Example 2-2. Installation Instructions (Static Module Installation for
+ Apache) for PHP
+1. gunzip -c apache_1.3.x.tar.gz | tar xf -
+2. cd apache_1.3.x
+3. ./configure
+4. cd ..
+
+5. gunzip -c php-4.x.y.tar.gz | tar xf -
+6. cd php-4.x.y
+7. ./configure --with-mysql --with-apache=../apache_1.3.x
+8. make
+9. make install
+
+10. cd ../apache_1.3.x
+
+11. ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
+ (The above line is correct! Yes, we know libphp4.a does not exist at this
+ stage. It isn't supposed to. It will be created.)
+
+12. make
+ (you should now have an httpd binary which you can copy to your Apache bin
+dir if
+ is is your first install then you need to "make install" as well)
+
+13. cd ../php-4.x.y
+14. cp php.ini-dist /usr/local/lib/php.ini
+
+15. You can edit /usr/local/lib/php.ini file to set PHP options.
+ Edit your httpd.conf or srm.conf file and add:
+ AddType application/x-httpd-php .php
+
Depending on your Apache install and Unix variant, there are many
possible ways to stop and restart the server. Below are some typical
lines used in restarting the server, for different apache/unix
installations. You should replace /path/to/ with the path to these
applications on your systems.
- Example 3-6. Example commands for restarting Apache
+ Example 2-3. Example commands for restarting Apache
1. Several Linux and SysV variants:
/etc/rc.d/init.d/httpd restart
@@ -752,7 +394,7 @@ Apache 2.0 on Unix systems
will need to replace the 'NN' here with the correct values from your
files.
- Example 3-7. Installation Instructions (Apache 2 Shared Module
+ Example 2-4. Installation Instructions (Apache 2 Shared Module
Version)
1. gzip -d httpd-2_0_NN.tar.gz
2. tar xvf httpd-2_0_NN.tar
@@ -844,6 +486,8 @@ Apache 2.0 on Unix systems
about the consequences and understand what you are doing. For more
information read the Apache documentation about the MPM-Modules.
+ Note: If you want to use content negotiation, read related FAQ.
+
Note: To build a multithreaded version of Apache your system must
support threads. This also implies to build PHP with experimental
Zend Thread Safety (ZTS). Therefore not all extensions might be
@@ -857,7 +501,7 @@ Caudium
that this is not supported with PHP 3. Follow the simple instructions
below to install PHP 4 for Caudium.
- Example 3-8. Caudium Installation Instructions
+ Example 2-5. Caudium Installation Instructions
1. Make sure you have Caudium installed prior to attempting to
install PHP 4. For PHP 4 to work correctly, you will need Pike
7.0.268 or newer. For the sake of this example we assume that
@@ -1162,7 +806,547 @@ Using Variables
extensions'.
_________________________________________________________________
-Chapter 4. Problems?
+HP-UX specific installation notes
+
+ This section contains notes and hints specific to installing PHP on
+ HP-UX systems. (Contributed by paul_mckay at clearwater-it dot co dot
+ uk).
+
+ Note: These tips were written for PHP 4.0.4 and Apache 1.3.9.
+
+ 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. uncompress 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. uncompress this file and install binutils
+ 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-1
+ 0.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 non-gnu directory of the
+ ftp site. Download the file, gunzip, then tar -xvf it. Go into the
+ newly created flex directory and run ./configure, followed by
+ make, and then make install.
+ If you have errors here, it's probably because gcc etc. are not in
+ your PATH so add them to your PATH.
+ 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, e.g. 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.
+ _________________________________________________________________
+
+OpenBSD installation notes
+
+ This section contains notes and hints specific to installing PHP on
+ OpenBSD 3.4.
+ _________________________________________________________________
+
+Using Binary Packages
+
+ Using binary packages to install PHP on OpenBSD is the recommended and
+ simplest method. The core package has been separated from the various
+ modules, and each can be installed and removed independently from the
+ others. The files you need can be found on your OpenBSD CD or on the
+ FTP site.
+
+ The main package you need to install is php4-core-4.3.3.tgz, which
+ contains the basic engine (plus gettext and iconv). Next, take a look
+ at the module packages, such as php4-mysql-4.3.3.tgz or
+ php4-imap-4.3.3.tgz. You need to use the phpxs command to activate and
+ deactivate these modules in your php.ini.
+
+ Example 2-6. OpenBSD Package Install Example
+# pkg_add php4-core-4.3.3.tgz
+# /usr/local/sbin/phpxs -s
+# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini
+ (add in mysql)
+# pkg_add php4-mysql-4.3.3.tgz
+# /usr/local/sbin/phpxs -a mysql
+ (add in imap)
+# pkg_add php4-imap-4.3.3.tgz
+# /usr/local/sbin/phpxs -a imap
+ (remove mysql as a test)
+# pkg_delete php4-mysql-4.3.3
+# /usr/local/sbin/phpxs -r mysql
+ (install the PEAR libraries)
+# pkg_add php4-pear-4.3.3.tgz
+
+ Read the packages(7) manual page for more information about binary
+ packages on OpenBSD.
+ _________________________________________________________________
+
+Using Ports
+
+ You can also compile up PHP from source using the ports tree. However,
+ this is only recommended for users familiar with OpenBSD. The PHP 4
+ port is split into two sub-directories: core and extensions. The
+ extensions directory generates sub-packages for all of the supported
+ PHP modules. If you find you do not want to create some of these
+ modules, use the no_* FLAVOR. For example, to skip building the imap
+ module, set the FLAVOR to no_imap.
+ _________________________________________________________________
+
+Common Problems
+
+ * The default install of Apache runs inside a chroot(2) jail, which
+ will restrict PHP scripts to accessing files under /var/www. You
+ will therefore need to create a /var/www/tmp directory for PHP
+ session files to be stored, or use an alternative session backend.
+ In addition, database sockets need to be placed inside the jail or
+ listen on the localhost interface. If you use network functions,
+ some files from /etc such as /etc/resolv.conf and /etc/services
+ will need to be moved into /var/www/etc. The OpenBSD PEAR package
+ automatically installs into the correct chroot directories, so no
+ special modification is needed there. More information on the
+ OpenBSD Apache is available in the OpenBSD FAQ.
+ * The OpenBSD 3.4 package for the gd extension requires XFree86 to
+ be installed. If you do not wish to use some of the font features
+ that require X11, install the php4-gd-4.3.3-no_x11.tgz package
+ instead.
+ _________________________________________________________________
+
+Older Releases
+
+ Older releases of OpenBSD used the FLAVORS system to compile up a
+ statically linked PHP. Since it is hard to generate binary packages
+ using this method, it is now deprecated. You can still use the old
+ stable ports trees if you wish, but they are unsupported by the
+ OpenBSD team. If you have any comments about this, the current
+ maintainer for the port is Anil Madhavapeddy (avsm at openbsd dot
+ org).
+ _________________________________________________________________
+
+Solaris specific installation tips
+
+ This section contains notes and hints specific to installing PHP on
+ Solaris systems.
+ _________________________________________________________________
+
+Required software
+
+ Solaris installs often lack C compilers and their related tools. Read
+ this FAQ for information on why using GNU versions for some of these
+ tools is necessary. The required software is as follows:
+
+ * gcc (recommended, other C compilers may work)
+ * make
+ * flex
+ * bison
+ * m4
+ * autoconf
+ * automake
+ * perl
+ * gzip
+ * tar
+ * GNU sed
+
+ In addition, you will need to install (and possibly compile) any
+ additional software specific to your configuration, such as Oracle or
+ MySQL.
+ _________________________________________________________________
+
+Using Packages
+
+ You can simplify the Solaris install process by using pkgadd to
+ install most of your needed components.
+ _________________________________________________________________
+
+Gentoo installation notes
+
+ This section contains notes and hints specific to installing PHP on
+ Gentoo Linux.
+ _________________________________________________________________
+
+Using Portage (emerge)
+
+ While you can just download the PHP source and compile it yourself,
+ using Gentoo's packaging system is the simplest and cleanest method of
+ installing PHP. If you are not familiar with building software on
+ Linux, this is the way to go.
+
+ If you have built your Gentoo system so far, you are probably used to
+ Portage already. Installing Apache and PHP is no different than the
+ other system tools.
+
+ The first decision you need to make is whether you want to install
+ Apache 1.3.x or Apache 2.x. While both can be used with PHP, the steps
+ given bellow will use Apache 1.3.x. Another thing to consider is
+ whether your local Portage tree is up to date. If you have not updated
+ it recently, you need to run emerge sync before anything else. This
+ way, you will be using the most recent stable version of Apache and
+ PHP.
+
+ Now that everything is in place, you can use the following example to
+ install Apache and PHP:
+
+ Example 2-7. Gentoo Install Example with Apache 1.3
+# emerge \<apache-2
+# USE="-*" emerge php mod_php
+# ebuild /var/db/pkg/dev-php/mod_php-<your PHP version>/mod_php-<your PHP versi
+on>.ebuild config
+# nano /etc/conf.d/apache
+ Add "-D PHP4" to APACHE_OPTS
+
+# rc-update add apache default
+# /etc/init.d/apache start
+
+ You can read more about emerge in the excellent Portage Manual
+ provided on the Gentoo website.
+
+ If you need to use Apache 2, you can simply use emerge apache in the
+ last example.
+ _________________________________________________________________
+
+Better control on configuration
+
+ In the last section, PHP was emerged without any activated modules. As
+ of this writing, the only module activated by default with Portage is
+ XML which is needed by PEAR. This may not be what you want and you
+ will soon discover that you need more activated modules, like MySQL,
+ gettext, GD, etc.
+
+ When you compile PHP from source yourself, you need to activate
+ modules via the configure command. With Gentoo, you can simply provide
+ USE flags which will be passed to the configure script automatically.
+ To see which USE flags to use with emerge, you can try:
+
+ Example 2-8. Getting the list of valid USE flags
+# USE="-*" emerge -pv php
+
+[ebuild N ] dev-php/php-4.3.6-r1 -X -berkdb -crypt -curl -debug -doc
+-fdftk -firebird -flash -freetds -gd -gd-external -gdbm -gmp -hardenedphp
+-imap -informix -ipv6 -java -jpeg -kerberos -ldap -mcal -memlimit -mssql
+-mysql -ncurses -nls -oci8 -odbc -pam -pdflib -png -postgres -qt -readline
+-snmp -spell -ssl -tiff -truetype -xml2 -yaz 3,876 kB
+
+ As you can see from the last output, PHP considers a lot of USE flags.
+ Look at them closely and choose what you need. If you choose a flag
+ and you do not have the proper libraries, Portage will compile them
+ for you. It is a good idea to use emerge -pv again to see what Portage
+ will compile in accordance to your USE flags. As an example, if you do
+ not have X installed and you choose to include X in the USE flags,
+ Portage will compile X prior to PHP, which can take a couple of hours.
+
+ If you choose to compile PHP with MySQL, cURL and GD support, the
+ command will look something like this:
+
+ Example 2-9. Install PHP with USE flags
+ # USE="-* curl mysql gd" emerge php mod_php
+
+ As in the last example, do not forget to emerge php as well as
+ mod_php. php is responsible for the command line version of PHP as
+ mod_php is for the Apache module version of PHP.
+ _________________________________________________________________
+
+Common Problems
+
+ * If you see the PHP source instead of the result the script should
+ produce, you have probably forgot to edit /etc/conf.d/apache.
+ Apache needs to be started with the -D PHP4 flag. To see if the
+ flag is present, you should be able to see it when using ps ax |
+ grep apache while Apache is running.
+ * Due to slotting problems, you might end up with more than one
+ version of PHP installed on your system. If this is the case, you
+ need to unmerge the old versions manually by using emerge unmerge
+ mod_php-<old version>.
+ * If you cannot emerge PHP because of Java, try putting -* in front
+ of your USE flags like in the above examples.
+ * If you are having problems configuring Apache and PHP, you can
+ always search the Gentoo Forums. Try searching with the keywords
+ "Apache PHP".
+ _________________________________________________________________
+
+Chapter 3. Installation on Mac OS X
+
+ This section contains notes and hints specific to installing PHP on
+ Mac OS X. There are two slightly different versions of Mac OS X,
+ Client and Server, our manual deals with installing PHP on both
+ systems. Note that PHP is not available for MacOS 9 and earlier
+ versions.
+ _________________________________________________________________
+
+Using Packages
+
+ 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.
+ _________________________________________________________________
+
+Compiling for OS X Server
+
+ Mac OS X Server install.
+
+ 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
+
+ 3. If you want the compiler to do some optimization, you may also
+ want to add this line:
+
+setenv OPTIM=-O2
+
+ 4. 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.
+ 5. Type make and make install. This will add a directory to your
+ Apache source directory under src/modules/php4.
+ 6. 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. Run make and make install again.
+ 7. 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.
+ _________________________________________________________________
+
+Compiling for MacOS X Client
+
+ The following instructions will help you install a PHP module for the
+ Apache web server included in MacOS X. This version includes support
+ for the MySQL and PostgreSQL databases. These instructions are
+ graciously provided by Marc Liyanage.
+
+ Warning
+
+ Be careful when you do this, you could screw up your Apache web
+ server!
+
+ Do this to install:
+
+ 1. Open a terminal window.
+ 2. Type wget
+ http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz,
+ wait for the download to finish.
+ 3. Type gunzip libphp4.so.gz.
+ 4. Type sudo apxs -i -a -n php4 libphp4.so
+ 5. Now type sudo open -a TextEdit /etc/httpd/httpd.conf. TextEdit
+ will open with the web server configuration file. Locate these two
+ lines towards the end of the file: (Use the Find command)
+
+#AddType application/x-httpd-php .php
+#AddType application/x-httpd-php-source .phps
+
+ Remove the two hash marks (#), then save the file and quit
+ TextEdit.
+ 6. Finally, type sudo apachectl graceful to restart the web server.
+
+ 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: <?php phpinfo() ?>.
+
+ Now open up 127.0.0.1/~your_username/test.php in your web browser. You
+ should see a status table with information about the PHP module.
+ _________________________________________________________________
+
+Chapter 4. Installation of PECL extensions
+
+Introduction to PECL Installations
+
+ PHP extensions may be installed in a variety of ways. PECL is a
+ repository of PHP extensions living within the PEAR structure, and the
+ following demonstrates how to install these extensions.
+
+ These instructions assume /your/phpsrcdir/ is the path to the PHP
+ source, and extname is the name of the PECL extension. Adjust
+ accordingly. These instructions also assume a familiarity with the
+ pear command.
+
+ Shared extensions may be installed by including them inside of php.ini
+ using the extension PHP directive. See also the extensions_dir
+ directive, and dl(). The installation methods described below do not
+ automatically configure PHP to include these extensions, this step
+ must be done manually.
+
+ When building PHP modules, it's important to have the appropriate
+ versions of the required tools (autoconf, automake, libtool, etc.) See
+ the Anonymous CVS Instructions for details on the required tools, and
+ required versions.
+ _________________________________________________________________
+
+Downloading PECL extensions
+
+ There are several options for downloading PECL extensions, such as:
+
+ * http://pecl.php.net
+ Listed here is information like the ChangeLog, release
+ information, requirements, revisions, etc. Although not every PECL
+ extension has a webpage, most do.
+ * pear download extname
+ The pear command may also be used to download source files.
+ Specific revisions may also be specified.
+ * CVS
+ All PECL files reside in CVS. A web-based view may be seen at
+ http://cvs.php.net/pecl/. To download straight from CVS, consider
+ the following where phpfi is the password for user cvsread:
+
+$ cvs -d:pserver:cvsread@cvs.php.net:/repository login
+$ cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/extname
+
+ * Windows downloads
+ Windows users may find compiled PECL binaries by downloading the
+ Collection of PECL modules from the PHP Downloads page, and by
+ retrieving a PECL Snapshot. To compile PHP under Windows, read the
+ Win32 Build README.
+ _________________________________________________________________
+
+PECL for Windows users
+
+ Like with any other PHP extension DLL, to install move the PECL
+ extension DLLs into the extension_dir folder and include them within
+ php.ini. For example:
+
+ extension=php_extname.dll
+
+ After doing this, restart the web server.
+ _________________________________________________________________
+
+Compiling shared PECL extensions with PEAR
+
+ PEAR makes it easy to create shared PHP extensions. Using the pear
+ command, do the following:
+
+ $ pear install extname
+
+ That will download the source for extname, and compile it on the
+ system. This results in an extname.so file that may then be included
+ in php.ini
+
+ In case the systems preferred_state is set higher than an available
+ extname version, like it's set to stable and the extension is still in
+ beta, either alter the preferred_state via pear config-set or specify
+ a specific version of the PECL extension. For example:
+
+ $ pear install extname-0.1.1
+
+ Regardless, pear will copy this extname.so into the extensions
+ directory. Adjust php.ini accordingly.
+ _________________________________________________________________
+
+Compiling shared PECL extensions with phpize
+
+ If using pear is not an option, like for building shared PECL
+ extensions from CVS, or for unreleased PECL packages, then creating a
+ shared extension may also be done by manually using the phpize
+ command. The pear command essentially does this but it may also be
+ done manually. Assuming the source file is named extname.tgz, and that
+ it was downloaded into the current directory, consider the following:
+
+$ pear download extname
+$ gzip -d < extname.tgz | tar -xvf -
+$ cd extname
+$ phpize
+$ ./configure && make
+
+ Upon success, this will create extname.so and put it into the modules/
+ and/or .libs/ directory within the extname/ source. Move this shared
+ extension (extname.so) into the PHP extensions directory, and adjust
+ php.ini accordingly.
+ _________________________________________________________________
+
+Compiling PECL extensions statically into PHP
+
+ To statically include the extension within the PHP build, put the
+ extensions source into the ext/ directory found in the PHP source. For
+ example:
+
+$ cd /your/phpsrcdir/ext
+$ pear download extname
+$ gzip -d < extname.tgz | tar -xvf -
+$ mv extname-x.x.x extname
+$ rm package.xml
+
+ This will result in the following directory:
+
+ /your/phpsrcdir/ext/extname
+
+ From here, build PHP as normal:
+
+$ cd /your/phpsrcdir
+$ ./buildconf
+$ ./configure --help
+$ ./configure --with-extname --enable-someotherext --with-foobar
+$ make
+$ make install
+
+ Whether --enable-extname or --with-extname is used depends on the
+ extension. Typically an extension that does not require external
+ libraries uses --enable. To be sure, run the following after
+ buildconf:
+
+ $ ./configure --help | grep extname
+ _________________________________________________________________
+
+Chapter 5. Problems?
Read the FAQ
@@ -1201,7 +1385,7 @@ Bug reports
reports!
_________________________________________________________________
-Chapter 5. Runtime Configuration
+Chapter 6. Runtime Configuration
The configuration file
@@ -1224,14 +1408,14 @@ The configuration file
filesystem if it exists.
The php.ini directives handled by extensions are documented
- respectively on the pages of the extensions themselfs. The list of the
- core directives is available in the appendix. Probably not all the PHP
- directives are documented in the manual though. For a completel list
- of directives available in your PHP version, please read your well
- commented php.ini file. Alternatively, you may find the the latest
- php.ini from CVS helpful too.
-
- Example 5-1. php.ini example
+ respectively on the pages of the extensions themselves. The list of
+ the core directives is available in the appendix. Probably not all the
+ PHP directives are documented in the manual though. For a completel
+ list of directives available in your PHP version, please read your
+ well commented php.ini file. Alternatively, you may find the the
+ latest php.ini from CVS helpful too.
+
+ Example 6-1. php.ini example
; any text on a line after an unquoted semicolon (;) is ignored
[php] ; section markers (text within square brackets) are also ignored
; Boolean values can be set to either:
@@ -1290,7 +1474,7 @@ Running PHP as an Apache module
php_admin_flag can not be overridden by .htaccess or
virtualhost directives.
- Example 5-2. Apache configuration example
+ Example 6-2. Apache configuration example
<IfModule mod_php5.c>
php_value include_path ".:/usr/local/lib/php"
php_admin_flag safe_mode on