PHP Assembly GD Library

Source: Internet
Author: User
Tags zts xenforo
PHP Installation GD Library
PHP Installation GD Library
1. View PHP Information
Php-v

[Email protected] achievo]# php-v
PHP 5.3.6 (CLI) (Built:aug 19 2011 19:35:20)
Copyright (c) 1997-2011 the PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

2.
What does Phpize do?

Phpize is used to extend the PHP extension module, through the phpize can build PHP plug-in module



When are we going to use phpize?

When we install PHP:

'./configure '--prefix=/usr/local/php '--with-mysql=/usr/local/mysql '--with-zlib-dir '--with-freetype-dir=/ usr '--with-jpeg-dir=/usr '--with-png-dir=/usr '--enable-gd-native-ttf '--with-gd '--enable-ftp '--with-iconv ' '--with-gettext '--with-curl '--enable-fastcgi '--with-openssl '

The parameters behind the root are the modules we want, but as we work, we need to add some modules and we don't want to recompile PHP, so we can use phpize.



Second, how to use Phpize?

When PHP is compiled, the phpize script file will be available in the bin directory of PHP. Before compiling the extension module you want to add, execute the following phpize.

------------------------------------
# If you forget to add some modules at compile time, you can use this method to recompile the additions!
# First, go to the PHP directory (not compiled) extension directory
cd/home/soft/php-5.2.14/ext/ftp/
# Call the Phpize program to generate the compilation configuration file
# Find/-name Phpize
/usr/local/php/bin/phpize
Configuring for:
PHP Api version:20041225
Zend Module Api no:20060613
Zend Extension Api no:220060519
# Compile the extension library
/configure–with-php-config=/usr/local/php/bin/php-config
Make
# After successful execution, the resulting extension library file is in the modules subdirectory of the current directory
# Edit the php.ini document, locate the Extension_dir directory, and copy the compiled extension file to extension
Vim/usr/local/php/etc/php.ini
# line No. 491
# Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
CP ftp.so/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
# in the Add Extension library location in php.ini, set the extension library to be added.
# Add extension=ftp.so at 612
# Restart WebService
------------------------------------------------------
181 of the PHP source location in
/root/software/php-5.3.6

----------------------------------------
This two-day attempt to install a Xenforo forum on the above platform, the installation started with the following information:

The following errors occurred while verifying that your server can run Xenforo:

* The required PHP extension mysqli could not be found. Please ask your the host to install the this extension.
* The required PHP extension GD could not be found. Please ask your the host to install the this extension.

Since PHP is compiled and installed by source code, the above two extensions are not installed, the following is the process of adding these two extensions for PHP:


First, install GD extension

1. Download the installation of the GD Library extension required source package (click the source package to download directly)

Gd-2.0.35.tar.gz http://www.libgd.org/releases/

Jpegsrc.v8b.tar.gz http://www.ijg.org/

Libpng-1.5.0.tar.gz http://sourceforge.net/projects/libpng/

Freetype-2.4.4.tar.gz http://sourceforge.net/projects/freetype/

Zlib-1.2.3.tar.gz

2. Compile and install each source package separately

Installing zlib

Tar zxvf zlib-1.2.3.tar.gz
CD zlib-1.2.3
./configure
Make
Make install

Installing libpng

Tar zxvf Libpng-1.5.0.tar.tar
CD libpng-1.5.0
CD scripts
MV Makefile.linux. /makefile
Cd..
Make
Make install

Installing FreeType

Tar zxvf freetype-2.4.4.tar.gz
CD freetype-2.4.4
./configure
Make
Make install

Install JPEG

Tar zxvf jpegsrc.v8b.tar.gz
CD jpeg-8b
./configure–enable-shared
Make
Make Test
Make install
Note that this configure must take the –enable-shared parameter, otherwise, the shared library will not be generated

Installing the GD Library
Tar zxvf gd-2.0.33.tar.gz
CD gd-2.0.33
./configure–with-png–with-freetype–with-jpeg
Make install

3. Recompile the installation of PHP (that is, after the previous compilation of PHP parameters, plus the above installation parameters)

CD php-5.3.4 (into the previous PHP source directory)

./configure–prefix=/opt/php–with-mysql=/opt/mysql–with-apxs2=/opt/apache/bin/apxs–enable-track-vars– enable-force-cgi-redirect–with-config-file-path=/opt/php/etc–with-gd–enable-gd-native-ttf–with-zlib–with-png– With-jpeg–with-freetype–enable-sockets

The Green Font section is the parameter that was added when PHP was previously installed

Make

Make install

So the GD library extension will be installed, restart Apache, view the PHP information test page can see the GD item;

Second, install mysqli extension

Here to use the Phpize,phpize command is used to prepare the PHP Extension Library compilation environment, usually after you install PHP, will be installed in the bin directory of PHP to find this command.

If you do not see a hint like autoconf after you execute the phpize command, install the autoconf again and execute again.

The directory path of the following instructions, please users according to the actual situation of their system to make corresponding changes.

PHP Source Package folder under the Ext folder is the current version of the available extensions, CD in to see what you need? You should see the Mysqli folder.

Cd/opt/software/php-5.3.4/ext/mysqli

Executing phpize in the current directory

[Email protected] Mysqli]#/opt/php/bin/phpize

Configuring for:

PHP Api version:20090626

Zend Modeule Api no:20090626

Zend Extension Api no:220090626

[Email protected] mysqli]#./configure–prefix=/opt/mysqli–with-php-config=/opt/php/bin/php-config–with-mysqli=/ Opt/mysql/bin/mysql_config

[[email protected] mysqli] #make

[[email protected] mysqli] #make Install

After the installation is complete, you will be prompted to expand the directory path, such as:

/opt/php/lib/php/extensions/no-debug-zts-20090626

The required mysqli.so will be in this directory, next modify the php.ini file under/opt/php/etc/, add the mysqli extension, that is, add the following line:

Extension=/opt/php/lib/php/extensions/no-debug-zts-20090626/mysqli.so

After restarting the Apache service, open the PHP information page again to see the mysqli entry.

Other PHP extensions are also similar to the installation ....


http://www.heiok.com/?p=517






  • 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.