You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

324 lines
12 KiB

28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
28 years ago
27 years ago
  1. Installation Instructions for PHP 4.0
  2. -------------------------------------
  3. For the impatient here is a quick set of steps that will build PHP as
  4. first a dynamic Apache module (DSO) for Apache 1.3.x with MySQL support
  5. and then a static module. A more verbose explanation follows.
  6. Note! Only install either the static module or the dynamic one. Do not
  7. install both.
  8. If you want both PHP 3 and 4 modules in the same Apache server, check the
  9. bottom of this file for instructions.
  10. INSTALLATION WITH THE ZEUS WEB SERVER:
  11. --Please see the 'README.Zeus' file included in this distribution
  12. QUICK INSTALL (DSO)
  13. For this to work your Apache httpd must have mod_so enabled.
  14. Check using httpd -l. You should see something like:
  15. Compiled-in modules:
  16. http_core.c
  17. mod_so.c
  18. Chances are you will see a lot more modules than these two. That's ok,
  19. as long as mod_so.c shows up you can proceed with the following steps:
  20. $ gunzip -c php-4.0.x.tar.gz | tar xf -
  21. $ cd php-4.0.x
  22. $ ./configure --with-mysql --with-apxs
  23. $ make
  24. $ make install
  25. If you get an error telling you that the apxs script could not be found,
  26. look for it on your system and if you find it, provide the full path to it
  27. as: --with-apxs=/path/to/apxs
  28. The only thing left to do is to edit your httpd.conf file and make sure the
  29. PHP 4 mime type is there and uncommented. You need a line that looks like
  30. this:
  31. AddType application/x-httpd-php .php
  32. Then restart your server (apachectl restart) and you should be able to
  33. serve up PHP files now. Make a test file called test.php and put some
  34. PHP tags in it. Like <?phpinfo()?>, for example.
  35. QUICK INSTALL (Static)
  36. $ gunzip -c apache_1.3.x.tar.gz | tar xf -
  37. $ cd apache_1.3.x
  38. $ ./configure
  39. $ cd ..
  40. $ gunzip -c php-4.0.x.tar.gz | tar xf -
  41. $ cd php-4.0.x
  42. $ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
  43. $ make
  44. $ make install
  45. $ cd ../apache_1.3.x
  46. $ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
  47. (The above line is correct! Yes, we know libphp4.a does not exist at this
  48. stage. It isn't supposed to. It will be created.)
  49. make
  50. (you should now have an httpd binary which you can copy to your Apache bin dir)
  51. cd ../php-4.0.x
  52. cp php.ini-dist /usr/local/lib/php.ini
  53. You can edit /usr/local/lib/php.ini file to set PHP options.
  54. Edit your httpd.conf or srm.conf file and add:
  55. AddType application/x-httpd-php .php
  56. VERBOSE INSTALL
  57. Chances are you are reading this because the quick install steps above
  58. did not work for you. If this is the case, congratulations, you are
  59. among the elite few that actually reads documentation. It really is
  60. not a difficult install and once you have done it once you will fly
  61. through it.
  62. Installing PHP can be done in four simple steps:
  63. 1. Unpack your distribution file.
  64. You will have downloaded a file named something like php-4.0.x.tar.gz.
  65. Unzip this file with a command like: gunzip php-4.0.x.tar.gz
  66. Next you have to untar it with: tar -xvf php-4.0.x.tar
  67. This will create a php-4.0.x directory. cd into this new directory.
  68. 2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
  69. a static module
  70. You now have to choose the options you would like. There are quite
  71. a few of them. To see a list, type: ./configure --help
  72. The only options that you are likely to want to use are the ones in
  73. the last section entitled, "--enable and --with options recognized:"
  74. A popular choice is to build the Apache module version. In order to
  75. build PHP as a dynamic module for Apache-1.3.x you have to first have
  76. Apache installed. Assuming Apache is already installed, make sure
  77. the shared object module is enabled. To check this, type: httpd -l
  78. You should see something like:
  79. Compiled-in modules:
  80. http_core.c
  81. mod_so.c
  82. You will most likely have a lot more modules than what is shown here.
  83. As long as mod_so.c shows up in the list, PHP should be happy.
  84. Now, type: ./configure --with-mysql --with-apxs
  85. If you get an error telling you that the apxs script could not be found,
  86. look for it on your system and if you find it, provide the full path to it
  87. as: --with-apxs=/path/to/apxs
  88. You might also want other flags on this configure line. --with-mysql
  89. is just an example.
  90. There are a few things that can go wrong during this configure step.
  91. The most common is that you have asked for an option and that the
  92. configure script can not find the files required to enable this
  93. option in PHP. Chances are you can provide the full path to the
  94. base directory under which the related files were installed. For
  95. example, if you have installed the GD library in /opt/gd which means
  96. that /opt/gd/include has your GD header files and /opt/gd/lib contains
  97. your GD library files, you would use --with-gd=/opt/gd
  98. Skip to step 3 for compilation and installation instructions.
  99. 2b. Configure PHP (Static Module) - Skip if you performed 2a
  100. You now have to choose the options you would like. There are quite
  101. a few of them. To see a list, type: ./configure --help
  102. The only options that you are likely to want to use are the ones in
  103. the last section entitled, "--enable and --with options recognized:"
  104. A popular choice is to build the Apache module version. You need
  105. to know where the source code directory for your Apache server is
  106. located. Then use an option like: --with-apache=/usr/local/src/apache
  107. if that is your Apache source code directory. If you only specify
  108. --with-apache, then it will default to look for your Apache source
  109. in /usr/local/etc/httpd.
  110. NOTE: The directory you specify should be the top-level of the
  111. unpacked Apache (or Stronghold) distribution. The configure program
  112. will automatically look for httpd.h in different directories under that
  113. location depending on which version of Apache, including Stronghold,
  114. you are running.
  115. For MySQL support, since newer versions of MySQL installs its various
  116. components under /usr/local, this is the default. If you have
  117. changed the location you can specify it with: --with-mysql=/opt/local
  118. for example. Otherwise just use: --with-mysql
  119. *NOTE* If you are using Apache 1.3b6 or later, you should run the
  120. Apache Configure script at least once before compiling PHP. It
  121. doesn't matter how you have Apache configured at this point.
  122. Skip to step 3b at this point.
  123. 3. Compile and install the files. Simply type: make install
  124. 3a. Dynamic Module Installation
  125. Nothing else is needed here. Proceed to step 4a.
  126. 3b. Static Module Installation
  127. For the Apache module version this will copy the appropriate files
  128. to the src/modules/php4 directory in your Apache distribution if
  129. you are using Apache 1.3.x. If you are still running Apache 1.2.x
  130. these files will be copied directly to the main src directory.
  131. For Apache 1.3b6 and later, you can use the new APACI configuration
  132. mechanism. To automatically build Apache with PHP support, use:
  133. cd apache_1.3.x
  134. ./configure --prefix=/<path>/apache \
  135. --activate-module=src/modules/php4/libphp4.a
  136. make
  137. make install
  138. If you do not wish to use this new configuration tool, the old
  139. install procedure (src/Configure) will work fine.
  140. If you are using the old Apache ./Configure script, you will have to
  141. edit the Apache src/Configuration file manually. If you do not have
  142. this file, copy Configuration.tmpl to Configuration.
  143. For Apache 1.3.x add:
  144. AddModule modules/php4/libphp4.a
  145. For Apache 1.3.x don't do anything else. Just add this line and then
  146. run "./Configure" followed by "make".
  147. For Apache 1.2.x add:
  148. Module php4_module mod_php4.o
  149. For Apache 1.2.x you will also have to look in the libphp4.module file,
  150. which was copied to the src directory. The EXTRA_LIBS line in the Apache
  151. Configuration file needs to be set to use the same libs as specified on
  152. the LIBS line in libphp4.module. You also need to make sure to add
  153. "-L." to the beginning of the EXTRA_LIBS line.
  154. So, as an example, your EXTRA_LIBS line might look like:
  155. EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
  156. NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
  157. is in the libphp4.module file.
  158. Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
  159. and set the WANTHSREGEX directive accordingly in your Configuration file.
  160. This last step applies to versions of Apache prior to 1.3b3.
  161. This is a bit of a hassle, but should serve as incentive to move to
  162. Apache 1.3.x where this step has been eliminated.
  163. Once you are satisfied with your Configuration settings, type: ./Configure
  164. If you get errors, chances are that you forgot a library or made a typo
  165. somewhere. Re-edit Configuration and try again. If it goes well,
  166. type: make
  167. Assuming it compiles without errors, proceed to step 4b.
  168. 4a. Setting up the server. (Dynamic Module)
  169. The make install command in step 3 should have done most of your
  170. work for you. It actually edits your httpd.conf file and tries to
  171. enable the dynamic PHP module. To verify this, look for a line that
  172. looks like this:
  173. LoadModule php4_module libexec/libphp4.so
  174. The actual path before the libphp4.so part might differ slightly. This
  175. is likely fine. If you are paranoid you can examine the output from the
  176. make install step to see where the libphp4.so file was actually put and
  177. place the full path to this file on this LoadModule line.
  178. If somewhere in your httpd.conf file you have a ClearModuleList line
  179. then you also need this line:
  180. AddModule mod_php4.c
  181. And finally you need to tell Apache which file extension should trigger
  182. PHP. You do this by creating a special mime type and associating it
  183. with an extension. We suggest using:
  184. AddType application/x-httpd-php .php
  185. You are however free to use any extension you wish, including .html.
  186. Note! If a line has a # at the beginning, then it is commented out
  187. and you need to remove the # for that line to take effect.
  188. Once you have made these changes you should be ready to restart your
  189. server and try it out. Type: apachectl restart
  190. The create a test file named test.php in your web tree somewhere and
  191. put some test PHP tags in it. <?phpinfo()?> is a good first test.
  192. This tag tells PHP to do a braindump and tells you all sorts of things
  193. about itself.
  194. 4b. Setting up the server. (Static Module)
  195. You should now have a new httpd binary. Shut down your existing server,
  196. if you have one, and copy this new binary overtop of it. Perhaps make
  197. a backup of your previous one first. Then edit your conf/httpd.conf file
  198. and add the line:
  199. AddType application/x-httpd-php .php
  200. There is also an interesting feature which can be quite instructive and
  201. helpful while debugging. That is the option of having colour syntax
  202. highlighting. To enable this, add the following line:
  203. AddType application/x-httpd-php-source .phps
  204. Any file ending in .phps will now be displayed with full colour syntax
  205. highlighting instead of being executed.
  206. When you are finished making changes to your httpd.conf file, you can
  207. start up your server. Note that on some older server setups, the
  208. AddType lines are in the conf/srm.conf file instead of conf/httpd.conf.
  209. Note! If a line has a # at the beginning, then it is commented out
  210. and you need to remove the # for that line to take effect.
  211. USING PHP3 AND PHP4 AS CONCURRENT APACHE MODULES
  212. Recent operating systems provide the ability to perform versioning and
  213. scoping. This features make it possible to let PHP3 and PHP4 run as
  214. concurrent modules in one Apache server.
  215. This feature is known to work on the following platforms:
  216. - Linux with recent binutils (binutils 2.9.1.0.25 tested)
  217. - Solaris 2.5 or better
  218. - FreeBSD (3.2, 4.0 tested)
  219. To enable it, configure PHP3 and PHP4 to use APXS (--with-apxs) and the
  220. necessary link extensions (--enable-versioning). Otherwise, all standard
  221. installations instructions apply. For example:
  222. $ ./configure \
  223. --with-apxs=/apache/bin/apxs \
  224. --enable-versioning \
  225. --with-mysql \
  226. --enable-track-vars
  227. If this also works on your platform or if you know a way to do it, please
  228. report it to our bug database at http://bugs.php.net