Twitter Updates for 2008-04-20 เหตุเกิดจากการโดนหลอก รถดูดส้วม
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: , , ,


Comments are closed.