Server - System - Manager - CentOS, Operation System, VBB, HACKING AND SECURITY

Go Back   Server - System - Manager - CentOS, Operation System, VBB, HACKING AND SECURITY > CentOS Việt Nam - Viet Nam Linux CentOS Community > Cài đặt CentOS và ứng dụng > PHP for CentOS

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-07-2008
Lovelinux's Avatar
Super Moderator
 
Join Date: Jun 2008
Posts: 221
Thanks: 22
Thanked 46 Times in 24 Posts
Thumbs up Hướng dẫn cài đặt một số extension cơ bản cho PHP

Theo như tớ biết thì PHP là một bọn phát triển độc lập - dành cho Linux, nên những extension gì mà có trên linux thì có thể có trên Windows, tất nhiên hiếm có trường hợp ngược lại
Cách 1: Như bác neu.edu.vn sử dụng yum
thì ngay khi cài đặt php ta gửi kèm các tham số
Code:
yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel --with-mysql --with-xml
để remove 1 extension đi thì ta có thể dùng
Code:
yum remove tên_extension
...

Cách 2: Sử dụng source
Để xem tất cả các extension mà PHP hỗ trợ bạn chỉ cần download source về và gõ:
Code:
./configure --help
ví dụ:
Code:
./configure --with-mcrypt --with-ftp
sau đó make và make install như thường


Theo mình khuyến cáo là nên cài từ source thì control sẽ tốt hơn, vì ta hiểu rõ nó hơn!

-------------------------
To see a list of the extensions that PHP can support, invoke the script as
Code:
./configure --help
Reply With Quote
  #2 (permalink)  
Old 21-07-2008
tui3gang's Avatar
Administrator
 
Join Date: Jun 2008
Posts: 29
Thanks: 0
Thanked 5 Times in 4 Posts
Default Cài đặt PHP PEAR - SMTP Mail Package

PEAR bao gồm 3 phần:
a) NET/SMTP : hỗ trợ giao thức SMTP
b) Mail : các class chứa hàm gửi mail
c) Net/Socke : Network Socket Interface
Các bước cài đặt:
Bước 1: Download files
# cd /tmp
# wget http://download.pear.php.net/package/Mail-1.1.14.tgz
# wget http://download.pear.php.net/package...MTP-1.2.10.tgz
# wget http://download.pear.php.net/package...cket-1.0.8.tgz
Bước 2: Extract
# tar -zxvf Mail-1.1.14.tgz
# tar -zxvf Net_SMTP-1.2.10.tgz
# tar -zxvf Net_Socket-1.0.8.tgz
Bước 3: Cài đặt
# cd /usr/share/pear
# mkdir Net
# cd Net
# cp /tmp/Net_SMTP-1.2.10/SMTP.php .
# cp /tmp/Net_Socket-1.0.8/Socket.php .
# cd ..
# cp -avr /tmp/Mail-1.1.14/Mail/ .
# cp -avr /tmp/Mail-1.1.14/Mail.php .
Bước 4: Test
Tạo file: testmail.php với nội dung như bên dưới:
<?php
include("Mail.php");
/* mail setup recipients, subject etc */
$recipients = "thuylam@tui3gang.com";//Email người nhận
$headers["From"] = "vccorp@tui3gang.com";//Email người gửi
$headers["To"] = "thuylam@tui3gang.com";//Email người nhận
$headers["Subject"] = "Test mail PEAR - www.TUI3GANG.com";
$mailmsg = "Đã gửi mail thành công, test bởi: www.hackingart.com.";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "mail.tui3gang.com"; //SMTP server
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "vccorp@tui3gang.com"; //Username SMTP
$smtpinfo["password"] = "123456789"; //Password SMTP
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>
Lưu lại vào webroot của bạn. Truy cập vào địa chỉ: http://www.yourdomain.com/testmail.php
Kiểm tra hộp thư của bạn. Nếu bạn nhận được email mới, có nghĩa là đã setup thành công.

P/S: trang download.pear.php.net rất khó truy cập, nên có thể download bản mirror của các gói trên tại: http://mirror.internode.on.net/pub/gentoo/distfile

Last edited by tui3gang; 21-07-2008 at 06:31 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hướng dẫn cài đặt Linux CentOS trên máy ảo VMWave Lovelinux Cài đặt CentOS và ứng dụng 1 23-07-2008 09:57 PM
Cảnh giới Niết bàn là ở đây, ngay trước mắt ta và nó ở ngay trong cuộc đời này! Lovelinux Giai tri - chat chit - Relax 0 23-07-2008 07:42 PM
Request: hướng dẫn cài server! thu_6_ngay_13 Hỏi đáp về CentOS 15 16-07-2008 04:23 PM
Cài đặt extension cho PHP ! hoahongtim PHP for CentOS 8 10-07-2008 04:50 PM
Từng buớc một để triển khai hệ thống Cluster Lovelinux Cài đặt CentOS và ứng dụng 1 09-07-2008 08:12 PM


All times are GMT +1. The time now is 11:50 AM.


© Diễn đàn HackingArt (HA) được xây dựng và phát triển bởi các thành viên.
+ Diễn đàn HackingArt là nơi trao đổi của các webmaster chuyên nghiệp.