Installation Instructions for PHP3 ---------------------------------- Installation of PHP3 is easier than any previous version of PHP. For the experienced, the quick steps for the UNIX version to configure PHP as an Apache module with MySQL support are: Apache 1.2x and 1.3x ------------------- gunzip php3*.gz tar -xvf php3*.tar cd php3 ./configure --with-apache=/usr/local/src/apache --with-mysql=/usr/local make install To recompile Apache you would further need to: cd /usr/local/src/apache/src edit Configuration and add the following line to the end of the file: For Apache 1.3.x add: AddModule modules/extra/mod_php3.o For Apache 1.2.x add: Module php3_module mod_php3.o (read below for more things you have to do if PHP3 is using any supporting libraries such as SQL client libraries, or the GD library. ./Configure make edit your srm.conf file and add the line: AddType application/x-httpd-php3 .php3 -------------- Now for a longer explanation. There are 4 simple steps: 1. Unpack your distribution file. You will have downloaded a file named something like php3xn.tar.gz. Unzip this file with a command like: gunzip php3xn.tar.gz Next you have to untar it with: tar -xvf php3xn.tar This will create a php3 directory. cd into this new directory. 2. 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. 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 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/extra 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. In the Apache src directory, edit the file named Configuration. If you do not have this file, copy Configuration.tmpl to Configuration. You should only need to add one line to the end of the file: For Apache 1.3.x add: AddModule modules/extra/mod_php3.o For Apache 1.2.x add: Module php3_module mod_php3.o For Apache 1.2.x you will also have to look in the mod_php3.module file which was copied to the src directory and set the EXTRA_LIBS line to the libs specified on the LIBS line of that file. 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. Also, look at the RULE_WANTHSREGEX setting in the mod_php3.module file and set the WANTHSREGEX directive accordingly in your Configuration file. This last step also applies to version of Apache 1.3.x prior to 1.3b3. Once you are satisfied with your Configuration settings, type: ./Configure If you get errors, chances are that your forgot a library or made a typo somewhere. Re-edit Configuration and try again. If it goes well, type: make 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-php3 .php3 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-php3-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.