≡ Menu

Instal OpenBSD to Secure Web Server part Install MySQL and PHP

openbsd

Install MySQL4:

Note the instructions on the screen. You will return to this after you install PHP.

Install PHP4:

Enable the PHP4 module:

Install PHP4_MySQL4 connectivity:

Enable MCRYPT:

Enable MHASH:

Enable IMAP:

Enable DOMXML:

Enable PEAR libraries:

Use PHP to manipulate graphics:

Enable CURL:

Create MYSQL passwords and user:

Access the server with your new password:

Enter your password at the prompt. You should see the mysql prompt. A problem with MySQL is it ships with two anonymous users who have no passwords. Change this within MySQL by entering the following (Note: the ?? marks are two single quotation marks in a row):

Change [email protected]’host_name? to the value that corresponds to the name you gave your system, displayed on your screen under Host where User = root (e.g., lockdown.cyborgspiders.com):

Now that you are back at the ?#? prompt, TYPE ps to verify that mysqld_safe is still running.

Edit APACHE httpd.conf file:

  1. vi /var/www/conf/httpd.conf
  2. Change the email address for ServerAdmin to [email protected]
  3. Change your ServerName to a valid DNS entry. If you do not have a valid DNS name for your host, enter the IP address associated with your LAN.
  4. TYPE ifconfig ?a to find the INET address associated with your working Ethernet card.
  5. Find the line that says inet 192.168.1.106 or some similar value.
  6. AddType application/x-httpd-php .php and delete the comment tag ?#?.
  7. Also, you must add php to the Apache Directory Index: DirectoryIndex index.html index.php (Optionally, add index.phtml, index.php4, and index.php3.).
  8. Exit VI and save forced.
  9. Press ESC and TYPE ?:wq!? ENTER.

Starting and Stopping APACHE as the SuperUser

To start Apache:

To stop Apache:

Start Apache now. Then navigate to the htdocs directory to test PHP:

You are now viewing the htdocs directory. This is the directory from which Apache serves files to the world:

This should show you a congratulations screen. Apache is running with the index.html file.

For PHP to work, you must create an index.php file:

Remember, press i for insert mode. Beneath the tag, add . Press ESC:wq index.php. This saves the file as index.php with your changes. Test this out:

You should see a very detailed display about your new PHP-enabled Apache Web server. Read through it. Notice how the variables in the httpd.conf file and the php.ini file affect the output. Depending on your purposes, you will want to make configuration changes to these files. (Note: the Apache documentation is installed by default. To avoid embarrassment (and death threats) on the mailing lists, RTFM.)

{ 0 comments… add one }

Leave a Comment

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.