Install Apache-modSSL, MySQL, and PHP
Once you get the command prompt back, you can move on to the fun part. Enter the following commands one at a time, waiting for the command prompt between each instance of
TYPE.
Install the Perl language (required for MySQL):
TYPE cd /usr/ports/lang/perl5
TYPE make
TYPE make test
TYPE make install
TYPE make clean
TYPE cd ~
TYPE rehash
TYPE use.perl port
The last three commands tells your FreeBSD machine to use the freshly upgraded Perl language and not the default that ships with your version of FreeBSD. If you ever need to switch back TYPE use.perl system.
Install the MySQL database:
TYPE cd /usr/ports/databases/mysql40-server
TYPE make
TYPE make install
TYPE make clean
It is a good idea to edit /etc/make.conf to tell various ports which versions of Berkeley DB and MySQL to use:
TYPE ee /etc/make.conf
Add the following two lines, one on top of the other as shown:
WITH_BDB_VER=40
WITH_MYSQL_VER=40
| Editor's Note: Be sure to modify the code above, if necessary, to match the version number of MySQL that you are currently using. |
Press Escape to exit, and save your changes before you leave the editor.
Install the Apache13x+mod_ssl server:
TYPE cd /usr/ports/www/apache13-modssl
TYPE make
TYPE make certificate
You'll see a series of self-explanatory on-screen directions here. Create an [R]SA server key for good performance. Change all of the snake-oil information to your own private information. When you are asked to encrypt this key, choose [y]es, and then:
TYPE make install
TYPE make clean
Install the PHP language:
TYPE cd /usr/ports/www/mod_php4
TYPE make
Now you get to choose your installation preferences. Notice that the MySQL dependent choices have been made for you. Certain options require a licensing fee (e.g., PDFlib). If you do not recognize a particular component, do not install it. Certain components create dependencies on other components. To simplify this installation and circumvent errors, stick to a minimal configuration. Include DOMXML and DOMXSLT support. PHP integrates well with XML. For universality amongst databases, choose the UNIXODBC support also. UNIXODBC will allow you to connect PHP with many databases:
TYPE make install
TYPE make clean
Congratulations! You have Apache-modSSL, MySQL, and PHP installed on your FreeBSD system. Wasn't that easy? Still skeptical? Then test it out.
Test Your Installation
To test the installation, you need a Web browser. I like to use LYNX.
Install LYNX-ssl Web Browser:
TYPE cd /usr/ports/www/lynx-ssl
TYPE make
TYPE make clean
Now, shutdown and reboot your machine to have Apache and MySQL start as daemon processes in the background. If you made a certificate, you will need to enter your local pass- key when prompted:
TYPE shutdown -r now
TYPE lynx 127.0.0.1
This command tells your Web browser to view the local Apache configuration. And what do you knowit worked! You should see the default congratulatory Apache screen. (Note: The keystroke Q or Control-C gets you out of LYNX.)