summaryrefslogtreecommitdiff
path: root/INSTALL
blob: 5311acab3c125b5e09d0a00a2e93da6785928266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Installation Instructions for PHP 4.0
-------------------------------------

Note!  As of 4.0b3, PHP will require GNU make.

For the impatient here is a quick set of steps that will build PHP as
an Apache module for Apache 1.3.x with MySQL support.  A more verbose
explanation follows.


QUICK INSTALL

$ gunzip -c apache_1.3.x.tar.gz | tar xf -
$ cd apache_1.3.x
$ ./configure
$ cd ..

$ gunzip -c php-4.0.x.tar.gz | tar xf -
$ cd php-4.0.x
$ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
$ make
$ make install

$ cd ../apache_1.3.x
$ ./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.)
make
 (you should now have an httpd binary which you can copy to your Apache bin dir)
cd ../php-4.0.x
cp php.ini-dist /usr/local/lib/php.ini
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


VERBOSE INSTALL

Installing PHP can be done in four simple steps:

1. Unpack your distribution file.  

   You will have downloaded a file named something like php4xn.tar.gz.
   Unzip this file with a command like: gunzip php4xn.tar.gz

   Next you have to untar it with: tar -xvf php4xn.tar

   This will create a php-4.0.x directory.  cd into this new directory.

2. Configure PHP.

   You now have to choose the options you would like.  There are quite
   a few of them.  To see a list, type: ./configure --help

   You can also use the supplied 'setup' script, which will ask you
   a series of questions and automatically run the configure script
   for you.

   The only options that you are likely to want to use are the ones in
   the last section entitled, "--enable and --with options recognized:"

   A popular choice is to build the Apache module version.  You need
   to know where the source code directory for your Apache server is
   located.  Then use an option like: --with-apache=/usr/local/src/apache
   if that is your Apache source code directory.  If you only specify
   --with-apache, then it will default to look for your Apache source 
   in /usr/local/etc/httpd.

   NOTE: The directory you specify should be the top-level of the
   unpacked Apache (or Stronghold) distribution. The configure program
   will automatically look for httpd.h in different directories under that
   location depending on which version of Apache, including Stronghold,
   you are running.

   For MySQL support, since newer versions of MySQL installs its various
   components under /usr/local, this is the default.  If you have
   changed the location you can specify it with: --with-mysql=/opt/local
   for example.  Otherwise just use: --with-mysql

   *NOTE*  If you are using Apache 1.3b6 or later, you should run the 
   Apache Configure script at least once before compiling PHP.  It 
   doesn't matter how you have Apache configured at this point.

3. Compile and install the files.  Simply type: make install

   For the Apache module version this will copy the appropriate files
   to the src/modules/php4 directory in your Apache distribution if
   you are using Apache 1.3.x.  If you are still running Apache 1.2.x
   these files will be copied directly to the main src directory.

   For Apache 1.3b6 and later, you can use the new APACI configuration
   mechanism.  To automatically build Apache with PHP support, use:

       cd apache_1.3.x
       ./configure --prefix=/<path>/apache \
                   --activate-module=src/modules/php4/libphp4.a
       make
       make install

   If you do not wish to use this new configuration tool, the old
   install procedure (src/Configure) will work fine.

   If you are using the old Apache ./Configure script, you will have to 
   edit the Apache src/Configuration file manually.  If you do not have 
   this file, copy Configuration.tmpl to Configuration.

   For Apache 1.3.x add:

      AddModule modules/php4/libphp4.a

   For Apache 1.3.x don't do anything else.  Just add this line and then
   run "./Configure" followed by "make".

   For Apache 1.2.x add:

      Module php4_module mod_php4.o

   For Apache 1.2.x you will also have to look in the libphp4.module file,
   which was copied to the src directory. The EXTRA_LIBS line in the Apache
   Configuration file needs to be set to use the same libs as specified on
   the LIBS line in libphp4.module. You also need to make sure to add
   "-L." to the beginning of the EXTRA_LIBS line.

   So, as an example, your EXTRA_LIBS line might look like:

	EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient

   NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
   is in the libphp4.module file.

   Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file 
   and set the WANTHSREGEX directive accordingly in your Configuration file.
   This last step applies to versions of Apache prior to 1.3b3.

   This is a bit of a hassle, but should serve as incentive to move to
   Apache 1.3.x where this step has been eliminated.

   Once you are satisfied with your Configuration settings, type: ./Configure
   If you get errors, chances are that you forgot a library or made a typo
   somewhere.  Re-edit Configuration and try again.  If it goes well,
   type: make

4. Setting up the server.
   
   You should now have a new httpd binary.  Shut down your existing server,
   if you have one, and copy this new binary overtop of it.  Perhaps make
   a backup of your previous one first.  Then edit your conf/srm.conf file
   and add the line:

      AddType application/x-httpd-php .php

   There is also an interesting feature which can be quite instructive and
   helpful while debugging.  That is the option of having colour syntax
   highlighting.  To enable this, add the following line:

      AddType application/x-httpd-php-source .phps

   Any file ending in .phps will now be displayed with full colour syntax
   highlighting instead of being executed.

   When you are finished making changes to your srm.conf file, you can
   start up your server.

USING PHP3 AND PHP4 AS CONCURRENT APACHE MODULES

   Recent operating systems provide the ability to perform versioning and
   scoping. This features make it possible to let PHP3 and PHP4 run as
   concurrent modules in one Apache server. 
   
   This feature is known to work on the following platforms:

   - Linux with recent binutils (binutils 2.9.1.0.25 tested)
   - Solaris 2.5 or better
   - FreeBSD (3.2, 4.0 tested)
   
   To enable it, configure PHP3 and PHP4 to use APXS (--with-apxs) and the
   necessary link extensions (--enable-versioning). Otherwise, all standard
   installations instructions apply. For example:

   		$ ./configure \
				--with-apxs=/apache/bin/apxs \
				--enable-versioning \
				--with-mysql \
				--enable-track-vars

   If this also works on your platform or if you know a way to do it, please
   report it to our bug database at http://bugs.php.net