@@ -5,7 +5,6 @@ Installing PHP
5
5
6
6
* General Installation Considerations
7
7
* Installation on Unix systems
8
- + Apache 1.3.x on Unix systems
9
8
+ Apache 2.x on Unix systems
10
9
+ Lighttpd 1.4 on Unix systems
11
10
+ Sun, iPlanet and Netscape servers on Sun Solaris
@@ -103,7 +102,6 @@ Installation on Unix systems
103
102
104
103
Table of Contents
105
104
106
- * Apache 1.3.x on Unix systems
107
105
* Apache 2.x on Unix systems
108
106
* Lighttpd 1.4 on Unix systems
109
107
* Sun, iPlanet and Netscape servers on Sun Solaris
@@ -163,208 +161,6 @@ Table of Contents
163
161
you can't figure out why, see the Problems section.
164
162
__________________________________________________________________
165
163
166
- Apache 1.3.x on Unix systems
167
-
168
- This section contains notes and hints specific to Apache installs of
169
- PHP on Unix platforms. We also have instructions and notes for Apache 2
170
- on a separate page.
171
-
172
- You can select arguments to add to the configure on line 10 below from
173
- the list of core configure options and from extension specific options
174
- described at the respective places in the manual. The version numbers
175
- have been omitted here, to ensure the instructions are not incorrect.
176
- You will need to replace the 'xxx' here with the correct values from
177
- your files.
178
-
179
- Example #1 Installation Instructions (Apache Shared Module Version) for
180
- PHP
181
- 1. gunzip apache_xxx.tar.gz
182
- 2. tar -xvf apache_xxx.tar
183
- 3. gunzip php-xxx.tar.gz
184
- 4. tar -xvf php-xxx.tar
185
- 5. cd apache_xxx
186
- 6. ./configure --prefix=/www --enable-module=so
187
- 7. make
188
- 8. make install
189
- 9. cd ../php-xxx
190
-
191
- 10. Now, configure your PHP. This is where you customize your PHP
192
- with various options, like which extensions will be enabled. Do a
193
- ./configure --help for a list of available options. In our example
194
- we'll do a simple configure with Apache 1 and MySQL support. Your
195
- path to apxs may differ from our example.
196
-
197
- ./configure --with-mysql --with-apxs=/www/bin/apxs
198
-
199
- 11. make
200
- 12. make install
201
-
202
- If you decide to change your configure options after installation,
203
- you only need to repeat the last three steps. You only need to
204
- restart apache for the new module to take effect. A recompile of
205
- Apache is not needed.
206
-
207
- Note that unless told otherwise, 'make install' will also install PEAR,
208
- various PHP tools such as phpize, install the PHP CLI, and more.
209
-
210
- 13. Setup your php.ini file:
211
-
212
- cp php.ini-development /usr/local/lib/php.ini
213
-
214
- You may edit your .ini file to set PHP options. If you prefer your
215
- php.ini in another location, use --with-config-file-path=/some/path in
216
- step 10.
217
-
218
- If you instead choose php.ini-production, be certain to read the list
219
- of changes within, as they affect how PHP behaves.
220
-
221
- 14. Edit your httpd.conf to load the PHP module. The path on the right hand
222
- side of the LoadModule statement must point to the path of the PHP
223
- module on your system. The make install from above may have already
224
- added this for you, but be sure to check.
225
-
226
- LoadModule php7_module libexec/libphp7.so
227
-
228
- 15. And in the AddModule section of httpd.conf, somewhere under the
229
- ClearModuleList, add this:
230
-
231
- AddModule mod_php7.c
232
-
233
- 16. Tell Apache to parse certain extensions as PHP. For example,
234
- let's have Apache parse the .php extension as PHP. You could
235
- have any extension(s) parse as PHP by simply adding more, with
236
- each separated by a space. We'll add .phtml to demonstrate.
237
-
238
- AddType application/x-httpd-php .php .phtml
239
-
240
- It's also common to setup the .phps extension to show highlighted PHP
241
- source, this can be done with:
242
-
243
- AddType application/x-httpd-php-source .phps
244
-
245
- 17. Use your normal procedure for starting the Apache server. (You must
246
- stop and restart the server, not just cause the server to reload by
247
- using a HUP or USR1 signal.)
248
-
249
- Alternatively, to install PHP as a static object:
250
-
251
- Example #2 Installation Instructions (Static Module Installation for
252
- Apache) for PHP
253
- 1. gunzip -c apache_1.3.x.tar.gz | tar xf -
254
- 2. cd apache_1.3.x
255
- 3. ./configure
256
- 4. cd ..
257
-
258
- 5. gunzip -c php-5.x.y.tar.gz | tar xf -
259
- 6. cd php-5.x.y
260
- 7. ./configure --with-mysql --with-apache=../apache_1.3.x
261
- 8. make
262
- 9. make install
263
-
264
- 10. cd ../apache_1.3.x
265
-
266
- 11. ./configure --prefix=/www --activate-module=src/modules/php7/libphp7.a
267
- (The above line is correct! Yes, we know libphp7.a does not exist at this
268
- stage. It isn't supposed to. It will be created.)
269
-
270
- 12. make
271
- (you should now have an httpd binary which you can copy to your Apache bin d
272
- ir if
273
- it is your first install then you need to "make install" as well)
274
-
275
- 13. cd ../php-5.x.y
276
- 14. cp php.ini-development /usr/local/lib/php.ini
277
-
278
- 15. You can edit /usr/local/lib/php.ini file to set PHP options.
279
- Edit your httpd.conf or srm.conf file and add:
280
- AddType application/x-httpd-php .php
281
-
282
- Depending on your Apache install and Unix variant, there are many
283
- possible ways to stop and restart the server. Below are some typical
284
- lines used in restarting the server, for different apache/unix
285
- installations. You should replace /path/to/ with the path to these
286
- applications on your systems.
287
-
288
- Example #3 Example commands for restarting Apache
289
- 1. Several Linux and SysV variants:
290
- /etc/rc.d/init.d/httpd restart
291
-
292
- 2. Using apachectl scripts:
293
- /path/to/apachectl stop
294
- /path/to/apachectl start
295
-
296
- 3. httpdctl and httpsdctl (Using OpenSSL), similar to apachectl:
297
- /path/to/httpsdctl stop
298
- /path/to/httpsdctl start
299
-
300
- 4. Using mod_ssl, or another SSL server, you may want to manually
301
- stop and start:
302
- /path/to/apachectl stop
303
- /path/to/apachectl startssl
304
-
305
- The locations of the apachectl and http(s)dctl binaries often vary. If
306
- your system has locate or whereis or which commands, these can assist
307
- you in finding your server control programs.
308
-
309
- Different examples of compiling PHP for apache are as follows:
310
- ./configure --with-apxs --with-pgsql
311
-
312
- This will create a libphp7.so shared library that is loaded into Apache
313
- using a LoadModule line in Apache's httpd.conf file. The PostgreSQL
314
- support is embedded into this library.
315
-
316
- ./configure --with-apxs --with-pgsql=shared
317
-
318
- This will create a libphp7.so shared library for Apache, but it will
319
- also create a pgsql.so shared library that is loaded into PHP either by
320
- using the extension directive in php.ini file or by loading it
321
- explicitly in a script using the dl() function.
322
-
323
- ./configure --with-apache=/path/to/apache_source --with-pgsql
324
-
325
- This will create a libmodphp7.a library, a mod_php7.c and some
326
- accompanying files and copy this into the src/modules/php7 directory in
327
- the Apache source tree. Then you compile Apache using
328
- --activate-module=src/modules/php7/libphp7.a and the Apache build
329
- system will create libphp7.a and link it statically into the httpd
330
- binary. The PostgreSQL support is included directly into this httpd
331
- binary, so the final result here is a single httpd binary that includes
332
- all of Apache and all of PHP.
333
-
334
- ./configure --with-apache=/path/to/apache_source --with-pgsql=shared
335
-
336
- Same as before, except instead of including PostgreSQL support directly
337
- into the final httpd you will get a pgsql.so shared library that you
338
- can load into PHP from either the php.ini file or directly using dl().
339
-
340
- When choosing to build PHP in different ways, you should consider the
341
- advantages and drawbacks of each method. Building as a shared object
342
- will mean that you can compile apache separately, and don't have to
343
- recompile everything as you add to, or change, PHP. Building PHP into
344
- apache (static method) means that PHP will load and run faster. For
345
- more information, see the Apache » web page on DSO support.
346
-
347
- Note:
348
-
349
- Apache's default httpd.conf currently ships with a section that
350
- looks like this:
351
-
352
- User nobody
353
- Group "#-1"
354
-
355
- Unless you change that to "Group nogroup" or something like that
356
- ("Group daemon" is also very common) PHP will not be able to open
357
- files.
358
-
359
- Note:
360
-
361
- Make sure you specify the installed version of apxs when using
362
- --with-apxs=/path/to/apxs . You must NOT use the apxs version that
363
- is in the apache sources but the one that is actually installed on
364
- your system.
365
- __________________________________________________________________
366
- __________________________________________________________________
367
-
368
164
Apache 2.x on Unix systems
369
165
370
166
This section contains notes and hints specific to Apache 2.x installs
0 commit comments