Install MySQL4:
1 |
TYPE: "pkg_add mysql-server-4.0.20.tgz" |
Note the instructions on the screen. You will return to this after you install PHP.
Install PHP4:
1 |
TYPE pkg_add php4-core-4.3.10.tgz |
Enable the PHP4 module:
1 |
TYPE /usr/local/sbin/phpxs -s TYPE cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini |
Install PHP4_MySQL4 connectivity:
1 |
TYPE pkg_add php4-mysql-4.3.10.tgz TYPE /usr/local/sbin/phpxs -a mysql |
Enable MCRYPT:
1 |
TYPE pkg_add php4-mcrypt-4.3.10.tgz TYPE /usr/local/sbin/phpxs ?a mcrypt |
Enable MHASH:
1 |
TYPE pkg_add php4-mhash-4.3.10 TYPE /usr/loca./sbin/phpxs ?a mhash |
Enable IMAP:
1 |
TYPE pkg_add php4-imap-4.3.10.tgz TYPE /usr/local/sbin/phpxs ?a imap |
Enable DOMXML:
1 |
TYPE pkg_add php4-domxml-4.3.10.tgz TYPE /usr/local/sbin/phpxs ?a domxml |
Enable PEAR libraries:
1 |
TYPE pkg_add php4-pear-4.3.10.tgz |
Use PHP to manipulate graphics:
1 |
TYPE pkg_add php4-gd-4.3.10-no_x11.tgz TYPE /usr/local/sbin/phpxs ?a gd |
Enable CURL:
1 |
TYPE pkg_add php4-curl-4.3.10.tgz TYPE /usr/local/sbin/phpxs ?a curl |
Create MYSQL passwords and user:
1 |
TYPE /usr/local/bin/mysqld_safe & TYPE /usr/local/bin/mysqladmin -u root password mypassword |
Access the server with your new password:
1 |
TYPE /usr/local/bin/mysql -u root ?p |
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):
1 |
mysql> TYPE SELECT Host, User FROM mysql.user; mysql> TYPE SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd'); mysql> TYPE SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd'); |
Change ??@’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):
1 |
mysql> TYPE exit |
Now that you are back at the ?#? prompt, TYPE ps to verify that mysqld_safe is still running.
Edit APACHE httpd.conf file:
- vi /var/www/conf/httpd.conf
- Change the email address for ServerAdmin to you@youraddress.com.
- 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.
- TYPE ifconfig ?a to find the INET address associated with your working Ethernet card.
- Find the line that says inet 192.168.1.106 or some similar value.
- AddType application/x-httpd-php .php and delete the comment tag ?#?.
- Also, you must add php to the Apache Directory Index: DirectoryIndex index.html index.php (Optionally, add index.phtml, index.php4, and index.php3.).
- Exit VI and save forced.
- Press ESC and TYPE ?:wq!? ENTER.
Starting and Stopping APACHE as the SuperUser
To start Apache:
1 |
TYPE apachectl start (c as in current, t as in table, l as in linux) |
To stop Apache:
1 |
TYPE apachectl stop (c as in current, t as in table, l as in linux) |
Start Apache now. Then navigate to the htdocs directory to test PHP:
1 |
TYPE cd /var/www/htdocs TYPE ls |
You are now viewing the htdocs directory. This is the directory from which Apache serves files to the world:
1 |
TYPE lynx 127.0.0.1 |
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:
1 |
TYPE vi index.html |
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:
1 |
TYPE lynx 127.0.0.1/index.php |
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.)