การติดตั้ง httpd_Apache_MySQL_PHP

5
กกกกกกกกกก httpd Apache MySQL PHP 1. กกกกกกกกกกกกกกกกก httpd-2.0.59.tar.gz ( installs in /usr/local ) 1.1. ทททททท Download ทททท httpd- 2.0.59.tar.gz ททท www.sunfreeware.com 1.2 ทททททททททททททท httpd-2.0.59.tar.gz ททททททททททททท gzip –d httpd-2.0.59.tar.gz ทท ททททททททททททททททททท .tar (httpd-2.0.59.tar) ทททททททททททททททททททททททททททททททททททททททททททท tar –xvfz httpd-2.0.59.tar 1.3. ทททททททททททททททททททททททททททททททททท Compile ทททททททททททททททท httpd-2.0.59.tar.gz ทททททททททททท SourceCode ทททททททท 3 ททททททท ททท 1.3.1 ทททททท PATH ทททททททททททททททททท ททททททท ./configure –prefix=/usr/local ททททททททททททททท PATH ทททททททททททท directory ททททททท ททททท (ทททททททท location ทททททททท ทททท) 1.3.2 ทททททท Compile SourceCode ททท ทททททททททท make 1.3.3 ทททททททททททททททททททททททททท make install 1.4. ททททททททททททททททททททททททททททททท web Browser ททททททททท httpd ทททททท URL ททททททท ททททททททททท httpd

description

วิชา ComputerLabKnow2Pro.com

Transcript of การติดตั้ง httpd_Apache_MySQL_PHP

Page 1: การติดตั้ง httpd_Apache_MySQL_PHP

การติ�ดติ��ง httpd Apache MySQL PHP

1. ขั้��นติอนการติ�ดติ��ง httpd-2.0.59.tar.gz ( installs in

/usr/local )1.1. ทำ��ก�ร Download ไฟล์ httpd-2.0.59.tar.gz จ�ก

www.sunfreeware.com1.2 จ�กนั้ �นั้แตกไฟล์ httpd-2.0.59.tar.gz โดยใช้�คำ��สั่ �ง

gzip –d httpd-2.0.59.tar.gz จะได�ไฟล์ทำ��มี�นั้�มีสั่ก�ล์ .tar

(httpd-2.0.59.tar) จ�กนั้ �นั้ให้�ทำ��ก�รแตกไฟล์อี�กคำร �งโดยใช้�คำ��สั่ �ง tar –xvfz httpd-2.0.59.tar

1.3. เมี"�อีทำ��ก�รแตกไฟล์แล์�วจะต�อีงทำ��ก�ร Compile เนั้"�อีงจ�กโปรแกรมี httpd-2.0.59.tar.gz อีย%&ในั้ร%ปขอีง SourceCode ซึ่)�งจะมี� 3 ข �นั้ตอีนั้ คำ"อี

1.3.1 ก��ห้นั้ด PATH ในั้ก�รต*ดต �งโดยใช้�คำ��สั่ �ง ./configure –prefix=/usr/local ซึ่)�งในั้ก�รก��ห้นั้ด PATH จะต�อีงอีย%&ในั้ directory ขอีงไฟล์นั้ �นั้ๆ (ต�อีงอีย%& location เด�ยวก บไฟล์)1.3.2 ทำ��ก�ร Compile SourceCode โดยใช้�คำ��สั่ �ง make1.3.3 ทำ��ก�รต*ดต �งโดยใช้�คำ��สั่ �ง make install

1.4. ทำ��ก�รทำดสั่อีบโปรแกรมีโดยทำ��ก�รเป-ด web Browser

แล์�วพิ*มีพิ httpd ทำ��แถบ URL จะปร�กฏห้นั้��ต&�งขอีง httpd

2. ขั้��นติอนการติ�ดติ��ง apache-2.0.59-sol10-x86-local.gz (installs in /usr/local/apache2 )

2.1. ทำ��ก�รแตกไฟล์ apache-2.0.59-sol10-x86-

local.gz โดยใช้�คำ��สั่ �ง gzip –d apache-2.0.59-sol10-x86-

local.gz จะได�ไฟล์ทำ��เป1นั้ Binary file คำ"อีถ%ก Compile แล์�ว

Page 2: การติดตั้ง httpd_Apache_MySQL_PHP

2.2.ทำ�� ก�รต*ดต �ง apache-2.0.59-sol10-x86-local โดยใช้�คำ��สั่ �ง pkgadd –d apache-2.0.59-sol10-x86-local ระบบจะทำ��ก�รต*ดต �งโดยอี ตโนั้มี ต*

2.3. ทำ��ก�รต*ดต �ง Library ทำ�� apache-2.0.59 ต�อีงก�รได�แก& expat, libiconv, gdbm, zlib, db-4.2.52.NC, openssl-0.9.8h, and libgcc or gcc (*Apache Version 2.0.59)

2.4. เมี"�อีทำ��ก�รต*ดต �งเสั่ร2จให้�ทำ��ก�ร configuration files

ในั้ Directory /usr/local/apache2/conf โดยไฟล์ทำ��ทำ��ก�ร configuration คำ"อี httpd-std.conf ให้�เปล์��ยนั้ช้"�อีเป1นั้ httpd.conf จ�กนั้ �นั้ให้�แก�ตรงบรรทำ ด Group #-1 เปล์��ยนั้เป1นั้ Group nobody แล์ะ Directoryindex ให้�เพิ*�มี index.php (โดยใช้�คำ��สั่ �ง vi httpd.conf ห้ร"อีเป-ดไฟล์ในั้ Directory

/usr/local/apache2/conf แล์�วแก�ไข)

2.5. ทำ��ก�ร RUN ห้ร"อี ห้ย�ดก�รทำ��ง�นั้ขอีง Apache โดยใช้�คำ��สั่ �ง /usr/apache2/bin/apachectrl start or stop

2.6. ทำดสั่อีบก�รทำ��ง�นั้ขอีงโปรแกรมีโดยทำ��ก�รเป-ด Web

Browser แล์�วพิ*มีพิ localhost ตรง URL จะปร�กฏห้นั้��ต&�ง Apache

3. ขั้��นติอนการติ�ดติ��ง php-5.2.1-sol10-x86-local.gz (installs in /usr/local/php)

3.1. ทำ��ก�รแตกไฟล์ php-5.2.1-sol10-x86-local.gz จะได�ไฟล์ทำ��เป1นั้ Binary file (ถ%ก Compile แล์�ว)

3.2. ทำ�� ก�รต*ดต �ง php-5.2.1-sol10-x86-local โดยใช้�คำ��สั่ �ง pkgadd –d php-5.2.1-sol10-x86-local ระบบจะทำ��ก�รต*ดต �งโดยอี ตโนั้มี ต*

3.3. ทำ��ก�รต*ดต �ง Library ทำ�� php-5.2.1 ต�อีงก�รได�แก& libiconv. libxml2, zlib, and libgcc-3.4.6 or gcc-3.4.6 (*PHP Version 5.2.1 ใช้�ก บ apache v.2.0.59 )

Page 3: การติดตั้ง httpd_Apache_MySQL_PHP

3.4. เมี"�อีต*ต �งเสั่ร2จให้�ทำ��ก�ร Copy ไฟล์ช้"�อี php.ini ในั้ directory usr/local/php/doc/php ไปไว�ทำ�� directory /usr/local/php/lib

3.5. ทำ��ก�ร configuration ไฟล์ httpd.conf โดยทำ��ก�รเพิ*�มี

LoadModule php5_module modules/libphp5.so (ตรง LoadModule)

AddType application/x-httpd-php .php (ตรง AddType)

3.6. ทำ��ก�รทำดสั่อีบโปรแกรมีโดยก�รเข�ยนั้ไฟล์ .php เก2บไว�ในั้ directory /usr/local/apache/htdocs ทำ��ก�รเป-ด Web

Browser แล์�วพิ*มีพิ localhost/index.php ตรง URL

4. ขั้��นติอนการติ�ดติ��ง mysql-5.0.51-sol10-x86-local.gz (installs in /usr/local/mysql)

4.1.ทำ��ก�รแตกไฟล์ mysql-5.0.51-sol10-x86-local.gz

จะได�ไฟล์ทำ��เป1นั้ Binary file (ถ%ก Compile แล์�ว)

4.2. ทำ�� ก�รต*ดต �ง mysql-5.0.51-sol10-x86-local โดยใช้�คำ��สั่ �ง pkgadd –d mysql-5.0.51-sol10-x86-local ระบบจะทำ��ก�รต*ดต �งโดยอี ตโนั้มี ต*

4.3. . ทำ��ก�รต*ดต �ง Library ทำ�� mysql-5.0.51 ต�อีงก�รได�แก& ncurses, zlib, libiconv, libintl, openssl-0.9.8h, and libgcc-3.4.6 or gcc-3.4.6

Page 4: การติดตั้ง httpd_Apache_MySQL_PHP

MySQL is an SQL database server - installs in /usr/local/mysql. Dependencies: ncurses, zlib, libiconv, libintl, openssl-0.9.8h, and you may need /usr/local/lib/libgcc_s.so.1 and /usr/local/lib/libstdc++.so.6 either from the libgcc-3.4.6 or gcc-3.4.6 or higher packages.Mysql requires a number of installation steps that can be found in the files in /usr/local/doc/mysql. I have only done the configure, make, make install steps and not the creation of the mysql user and group or the other steps that are needed. All the tests in the test suite executed correctly. You may also need to install the shutils to obtain the hostname program used in some of the mysql scripts. You might also try just doing a link ln -s /usr/bin/hostname /usr/local/bin/hostname. If you are upgrading a mysql installation, you should make sure you back up your previous installation and any databases you have created.

The PHP scripting language - installs in /usr/local/php. PHP requires that libiconv. libxml2, zlib, and either libgcc-3.4.6 or gcc-3.4.6 be installed. PHP is used with apache 2.0.59, not apache 2.2, and mysql which should also be installed along with any packages they may require. PHP needs configuration. php.ini related files are in /usr/local/php/doc/php along with other documentation. php.ini needs to be installed in /usr/local/php/lib. The libphp5.so file is installed in /usr/local/apache2/modules. The following two lines

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

need to be placed in your httpd.conf file in their appropriate places. Finally, you will need to have /usr/local/lib and /usr/local/pgsql/lib before /usr/lib in your library search path like LD_LIBRARY_PATH or similar.