Upgrade the GD library in Ubuntu to the full version.

Source: Internet
Author: User
Tags drupal

In general, we install the LAMPP environment in the Ubuntu Linux release version directly through apt-get (convenient and lazy! Haha )!

It is very convenient, but there are more or less problems in these integrated versions.

For example, PHP5-GD library ~ After installation, we found that the prompt in phpinfo is 2.0 or higher. Although most of the functions are available, this library is not complete.

The Drupal error was reported during a Xilin Drupal project, leading to missing functions of the image module! At the beginning is still very surprised, asked a friend, a friend said should not have such a problem (later I know, he has been compiling and installing T-T ).

 

The error message is as follows:

GD Image Filtering and GD Image Rotation cannot work normally. The system prompts that the GD library version is not the official release version!

So I began to find this problem on the Internet and found that all Ubuntu and debian users had this problem.

Because DRUPAL is rarely used in China, the problem is not obvious. I found a solution when I went to some foreign websites. (E is too difficult to find !)

The main problem lies in the GD library. Many people say that the GD library in the APT package has been modified and then compiled and integrated. So there will be a lack of functionality. Now that the problem is found, there is a solution. I saw his solution on the Cumu. li website. The original BLOG is as follows:

I 've been installing the LAMP stack on an Ubuntu based server for a client. they rely on the version of LibGD that's bundled with PHP5. This version already des certain functions including imagerotate () and others.

It seems that the people who build Ubuntu (and Debian) distribution do not want to compile PHP5 with the version of GD that comes bundled with PHP5. As far as I can tell the guys at Ubuntu (and Debian) consider this to be a fork of the original GD library and think that this cocould be a security risk. their stance on it is that if PHP want to use this version then they shocould contribute the changes That have been made to the original GD library back to the core project. this seems fair enough, but unfortunately I can't immediately change the ction of an open source project this big-or probably any project, come to think about it!

After a bit of rummaging around und on the Internet I found nothing to do with actually compiling in this support, so I tried to work out how to do this... In theory! I found a link on Ubuntu forums about including the GMP library I roughly followed this through.

(Xilin, my E-text water adjustment will not be ugly translation! Basically, we suggest you download the source code again and then compile and package it !)

The procedure is as follows:

First download the source code package
# Install build tools, debian helpers and fakeroot
Apt-get install build-essential debhelper fakeroot
# Source code shoshould reside in/usr/src
Cd/usr/src
# Download PHP source
Apt-get source php5
# Install all packages required to build PHP5
Apt-get build-dep php5
Cd php5-5.2.3 in Download PHP source program will automatically decompress the compressed package, so we just need to enter the decompressed directory first modify the debian/rules File

-- With-gd = shared,/usr -- enable-gd-native-ttf.

Modify:

-- With-gd = shared -- enable-gd-native-ttf.


Save and exit and compile the source code. The command is as follows:

# Build the php5-* packages note that the compilation process is quite long and takes a long time to wait.
Dpkg-buildpackage-rfakeroot
Cd ..
# Install the new php5-gd package
Dpkg-I php5-gd_5.2.3-1Ubuntu6.3_i386.deb


After OK, we can directly install the package. Of course, do not forget to restart the apache2 service.

Then, we use PHPINFO to check whether the prompts of the installed environment GD library have changed significantly. The information is as follows:

GD Version bundled (2.0.34 compatible)

In this way, your complete GD library is installed.

Finally, Xilin reminds you that the appeal process is directly copied from the original article of cumu. li. During actual installation and packaging, you should carefully check your package name, but you cannot COPY my code directly.

Like when I install my source package name is php5-5.2.3-org.1, so this place you need to carefully operate! OK. What are you waiting for? upgrade your GD database ~!

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.