FreeBSD6.2 fully install Apache2.0.59 + MySql5.1.18 + PHP5.2.2 + GD

Source: Internet
Author: User
FreeBSD6.2 fully installs Apache2.0.59 + MySql5.1.18 + PHP5.2.2 + GD-Linux Enterprise Application-Linux server application information. For more information, see the following. 1. Install MYSQL

Install mysql5.1.18 binary
# Tar-zxvf mysql-5.1.18-beta-freebsd6.0-i386.tar.gz # extract the installation package
# Mv mysql-5.1.18-beta-freebsd6.0-i386/usr/local/mysql # copy to the/usr/local directory and rename it mysql
# Cd/usr/local/mysql # enter the/usr/local/mysql directory
# Pw groupadd mysql # create a mysql Group
# Pw useradd mysql-g mysql # create a mysql user and add it to the mysql Group
# Chown-R mysql.
# Chgrp-R mysql. # Set the mysql group to access/usr/local/mysql
# Scripts/mysql_install_db -- user = mysql # initialize the table and use the mysql user to access it
# Chown-R root. # Set root to access/usr/local/mysql
# Chown-R mysql data # Set mysql users to access/usr/local/mysql/data, which contains mysql database files
# Chown-R mysql data/. # Set mysql users to access all files under/usr/local/mysql/data
# Chown-R mysql data/mysql/. # Set mysql users to access all files in/usr/local/mysql/data/mysql
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql & # Run mysql

Note:
#/Usr/local/mysql/libexec/mysqld start # start mysql
#/Usr/local/mysql/libexec/mysqld stop # stop mysql
#/Usr/local/mysql/libexec/mysqld restart # restart mysql

To run mysql after each system restart, you can write a script to the/usr/local/etc/rc. d directory to run mysql. We will write a script mysql_start.sh:
#! /Bin/sh
/Usr/local/mysql/bin/mysqld_safe &
Set file permissions to Executable
# Chmod + x mysql_start.sh

2. install APACHE

Install apache2.0.59 source file
# Tar-zxvf httpd-2.0.59.tar.gz
# Cd httpd-2.0.59
#./Configure \
-- Prefix =/usr/local/apache2 \ # configure the installation path
-- Enable-shared = max \ # set sharing
-- Enable-module = rewrite \ # enable rewrite
-- Enable-module = so # configure Apache to share the installed modules
# Make # compile
# Make install # install
# Make clean

Remarks (set startup ):
Automatically load apache services upon startup:
Edit the file apache_start.sh in the/usr/local/etc/rc. d directory.
#! /Bin/sh
/Usr/local/apache2/bin/httpd-k start
Set File Permissions
# Chmod + x apache_start.sh

Enable the rewrite module:
After apache is installed, load and compile the mod_rewrite.so module.
# Cd/usr/local/backup/httpd-2.0.59/modules/mappers
#/Usr/local/apache2/bin/apxs-c mod_rewrite.c-lgdbm
# Gcc-shared-o mod_rewrite.so mod_rewrite.o
#/Usr/local/apache2/bin/apxs-I-A-n rewrite mod_rewrite.so

3. install PHP

First, you need to load some GD library and other things. You can skip steps 2-9, but you must ensure that these components are installed by default.
Run pkg_info | grep softname to check whether the software has been installed.

1. zlib (Source File Installation)
# Tar-zxvf zlib-1.2.3.tar.gz
# Cd zlib-1.2.3
#./Configure
# Make
# Make install
# Make clean

2. libxml2
# Cd/usr/ports/textporc/libxml2
# Make install clean

3. libpng (if not installed, the default path of the system is/usr/local)
# Cd/usr/ports/graphics/png
# Make PREFIX =/usr/local/libpng2 install clean

4. jpeg (if not installed, the default path is/usr/local)
# Cd/usr/ports/graphics/jpeg
# Make install clean

5. freetype (if not installed, the default path is/usr/local)
# Cd/usr/ports/print/freetype2
# Make PREFIX =/usr/local/freetype install clean

6. gd (if not installed, the default path is/usr/local)
# Cd/usr/ports/graphics/gd
# Make install clean

7. libiconv
# Cd/usr/ports/converters/libiconv
# Make install clean

8. cdb (set to use hightman's scws)
# Cd/usr/ports/databases/cdb
# Make PREFIX =/usr/local/cdb install clean

9. gdbm (same as above)
# Cd/usr/ports/databases/gdbm
# Make PREFIX =/usr/local/gdbm install clean

10. PHP5 (source file version)
# Tar-zxvf php-5.2.2.tar.bz2
# Cd php-5.2.2
#./Configure \
-- Prefix =/usr/local/php \ # installation directory
-- With-apxs2 =/usr/local/apache2/bin/apxs \
-- With-mysql =/usr/local/mysql \
-- With-xml \ # supports xml
-- With-zlib \ # supports zlib
-- With-jpeg-dir =/usr/local \ # support for jpeg
-- With-png-dir =/usr/local \ # support for png
-- With-iconv \ # iconv supported
-- With-gd \ # support for gd
-- With-mcrypt \ # required for phpmyadmin to log on as a cookie
-- With-config-file-path =/usr/local/lib \
-- With-curl \
-- With-freetype-dir =/usr/local \
-- With-xsl \
-- With-expat \
-- Disable-debug \ # disable php internal debugging
-- Enable-safe-mode \ # enable php security mode
-- Enable-trans-sid \
-- Enable-memory-limit \
-- Enable-short-tags \ # supports PHP short tag
-- Disable-posix \
-- Enable-exif \
-- Enable-ftp \
-- Enable-sockets \
-- Enable-mbstring \
-- Enable-dba \
-- With-gdbm =/usr/local/gdbm \
-- With-cdb =/usr/local/cdb \
-- Enable-xslt \
-- Enable-soap \
-- Enable-wddx \
-- Enable-calendar \
-- Enable-bcmath \
-- Enable-gd-native-ttf
# Make
# Make install
# Make clean
# Cp/usr/local/backup/php-5.2.2/php. ini-dist/usr/local/lib/php. ini

4. Integrate PHP + APACHE

# Vi/usr/local/apache2/conf/httpd. conf

Add
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php. php

Zend Optimizer Installation

The downloaded version 3.2.8 cannot be installed because a dialog file is missing in the zui_files directory. You can copy a dialog file from Zend Optimizer of earlier versions and put it in this directory.
# Tar-zxvf ZendOptimizer-3.2.8-freebsd6.0-i386.tar.gz
# Cd ZendOptimizer-3.2.8-freebsd6.0-i386
#./Install. sh
Then follow the prompts to install it. It's a bit like installing it in windows! But pay attention to the Path Problem of httpd. conf and php. ini!
OK, everything is done! You can complete other optimization settings on your own.

Vi. Remarks

After installing all the components, you 'd better use phpinfo to check whether there are any missing components.

7. Thank you

Thank you for providing us with such a complete tutorial on the linux1022 forum in Hangzhou.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.