Apr 21

หากใครหา php5-gmp ซึ่งจะไปใช้กับ Ubuntu 7.10 ก็จะหาไม่ได้นะครับ ขั้นแรกคือรอ Ubuntu 8.04 (Hardy Heron) ซึ่งจะมีให้เลย แถมยังเป็น LTS (Long Time Support) อีกด้วย ก็จะ launch ในวันที่ 24 เมษายน ที่จะถึงนี้เอง
แต่พอดีผมใช้อยู่และรอไม่ได้ก็เลยต้องหาวิธีทำให้ PHP5 ของ Ubuntu 7.10 ใช้ได้ก็เลยไปหาใน Ubuntuforums.org มีคนทำเป็น package ด้วย link ดูได้จากด้านล่างนะครับ (อีกที่ มี compile package ไว้ให้ด้วย)
ผมได้แก้ให้เป็น version 5.2.3 ครับ แต่วิธีการเดียวกัน

Steps to enter at the command line:

1. apt-get install build-essential debhelper libgmp3c2 libgmp3-dev

(More tools might be needed depending on what you already have installed, but you will tend to get warnings about what is missing)

Then, download the PHP sources:

2. apt-get source php5

My version is 5.2.3, but yours may be different.

Get all the dependencies for building PHP:

3. apt-get build-dep php5

Change into the debian build directory for PHP:

** Found problem with : libsnmp10-dev - virtual package with libsnmp-dev
used with apt-get install —all of package–

4. cd php5-5.2.3/debian

Let’s edit the modulelist file.

5. vi modulelist

Insert a line below the one that says

gd GD

with the contents:
gmp GMP

Next, edit the rules file. Either open it from gedit directly or use:

6. vi rules

Look for the line that says:

–with-curl=shared,/usr \

Open a line below this with the contents:
--with-gmp=shared,/usr \

Make sure not to forget the backslash on the end. Also, GMP installed itself into /usr/local on my machine. Your location may be different.

Now, we edit the control file. Again, either use the gedit GUI to open the file or type:

7.vi control

Add this to the end of the file:
Package: php5-gmp
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${php:Depends}, php5-common (= ${Source-Version})
Description:GMP module for php5
This package provides a module for GMP to be used with PHP5.
.
PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
from C, Java and Perl with a couple of unique PHP-specific features thrown
in. The goal of the language is to allow web developers to write
dynamically generated pages quickly.

Make sure that you keep all that text as one big block with no extra lines between it. It’s ok to have an extra line after it, but not between it. Just see how the other entries are entered and go from there.

Move up a directory.

8. cd ..

Now, run:

9. sudo dpkg-buildpackage

This will do the whole configure/compile for PHP and create debs in the parent directory. This does take awhile, though. When this process is done, move up to the parent directory:

10. cd ..

And, you will see all of the PHP debs, including the new php5-gmp_[version].deb

Run a dpkg -i on the ones you need (I just used the gmp one):

11.dpkg -i php5-gmp_523-1ubuntu6.3_i386.deb

เป็นอันเสร็จพิธี อย่าลืม restart apache นะครับ

อ้างอิง

written by Mr-San \\ tags: , , ,

Mar 13

วันนี้มาลอง Compile Kernel ของ FreeBSD 7.0 กัน ตามนี้เลย

cd /usr/src/sys/i386/conf
cp GENERIC IPFWKERN

## edit IPFWKERN ##
เพิ่ม

options IPFIREWALL
options IPDIVERT
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=100
options IPFIREWALL_FORWARD
options IPSTEALTH
options ACCEPT_FILTER_HTTP
options ACCEPT_FILTER_DATA

หลังจากเสร็จแล้ว

config IPFWKERN
cd /usr/src
make kernel KERNCONF=IPFWKERN
make installkernel KERNCONF=IPFWKERN

หลังจากนั้น แก้ /etc/rc.conf เพิ่ม

firewall_enable="YES"
firewall_type="/etc/ipfw.rules"
filewall_logging="YES"

แล้วอย่าลืมสร้าง ipfw.rules ล่ะครับ
หลังจากนั้นก็ Reboot เป็นอันเสรํจเรียบร้อย

written by Mr-San \\ tags: , ,

Jan 25

ใช้ทุกครั้งก็ต้องมาหาทุกครั้ง เลยมาจดไว้กันลืม
เป็นการสร้าง Database และ Grant ให้ User สามารถใช้งานร่วมกับ Database ได้

mysqladmin -u username -p create databasename

หลังจากนั้น login เข้าไปใน MySql

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password';

เท่านี้ก็จะได้ User ที่สามารถใช้ร่วมกับ Database ที่สร้างขึ้นอย่างง่ายดาย
อ้อ อย่าลืม

FLUSH PRIVILEGES

written by Mr-San \\ tags: , , ,

Jun 28

วิธีการป้องกันไม่ให้ Users มีสิทธิ์ แก้ไข IP Address ได้เองบน Windows XP มีขั้นตอนดังนี้
Start -> Run -> gpedit.msc
แล้วจะได้หน้าตาดังรูปด้านล่าง

gpedit.msc-prohibit setting IP

ทำการแก้ไข ตามข้อในรูป ให้เป็น Enable
แต่จะมีผลกับ Users และ Network Operation เท่านั้นครับ
อ้างอิงจาก
http://technet.microsoft.com/en-us/library/bb457072.aspx

written by Mr-San

May 17

วันนี้นั่งเล่น maildrop มา ก็เลยหยิบมาแบ่งปันกันให้คนอื่นได้ใช้นะครับ
อันนี้เป็นไฟล์ mailfilter ซึ่งอยู่ใน /var/vpopmail/domains/example.net/

SHELL="/bin/sh"
import EXT
import HOST
VPOP="| /var/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/var/vpopmail/bin/vuserinfo -d $EXT@$HOST`

#logfile “/var/log/maildrop.log”
log “=== BEGIN maildrop processing for $EXT@$HOST ===”

if ( $VHOME eq “” )
{
#log ” ERROR: VHOME isn’t set, falling back to vdelivermail”
#log “=== EXIT === ”
to “$VPOP”
}

# make special folder
`test -d $VHOME/Maildir/.Spam`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Spam directory”
`/usr/local/bin/maildirmake -f Spam $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Drafts`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Drafts directory”
`/usr/local/bin/maildirmake -f Drafts $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Sent`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Sent directory”
`/usr/local/bin/maildirmake -f Sent $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Trash`
if( $RETURNCODE == 1 )
{
log ” INFO: Make .Trash directory”
`/usr/local/bin/maildirmake -f Trash $VHOME/Maildir`
}

# try filtering it using user-defined rules
`test -r $VHOME/.mailfilter`
if( $RETURNCODE == 0 )
{
#log ” INFO: including $VHOME/.mailfilter”
exception {
include $VHOME/.mailfilter
}
}

if (/^X-Spam-Status: *Yes/)
{
# then try delivering it to a Spam folder
exception {
# to “$VPOP”
to “$VHOME/Maildir/.Spam/”
}
# ah well, I guess they’ll just have to live with disappointment
exception {
to “$VPOP”
}
}
else
{
exception {
#log ” INFO: message is clean”
to “$VPOP”
}
}

ต่อจากนั้นแก้ไข /var/vpopmail/domains/example.net/.qmail-default
#| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox
| /usr/local/bin/maildrop /home/vpopmail/domains/example.net/mailfilter

เป็นอันเสร็จพิธี ใครจะ debug ก็ uncomment logfile ด้วยนะ

อ้างอิง

written by Mr-San \\ tags: ,

Close
E-mail It