PHP installation of GD Library and phpize usage

Source: Internet
Author: User
Tags zts xenforo
    1. [Root@jbxue achievo]# Php-v
    2. PHP 5.3.6 (CLI) (Built:aug 19 2011 19:35:20)
    3. Copyright (c) 1997-2011 the PHP Group
    4. Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies


Two, phpize1, what is phpizephpize to extend the PHP extension module, through phpize can build PHP plug-in module.



When you install PHP, you need to use the phpize:


    1. './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 following parameters are required modules, sometimes need to add some modules, and do not want to recompile PHP, at this time can use Phpize to help plug modules.



2, 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 modules to be added, execute the following phpize.


    1. # If you forget to add some modules at compile time, you can use this method to recompile the additions!
    2. # First, go to the PHP directory (not compiled) extension directory
    3. cd/home/soft/php-5.2.14/ext/ftp/
    4. # Call the Phpize program to generate the compilation configuration file
    5. # Find/-name phpize
    6. /usr/local/php/bin/phpize
    7. configuring for:
    8. php Api version:2004122 5
    9. Zend Module API no:20060613
    10. Zend Extension API no:220060519
    11. # Compiling extension libraries
    12. /confi Gure–with-php-config=/usr/local/php/bin/php-config
    13. make
    14. # made successful execution, the resulting extension library file is in the modules subdirectory of the current directory
    15. # Edit the php.ini document, locate the Extension_dir directory, copy the compiled extension file to the extension
    16. vim/usr/local/php/etc/php.ini
    17. # Line No. 491
    18. # extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
    19. CP ftp.so/u sr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
    20. # in the Add Extension library location in php.ini, set the extension library to be added.
    21. # Add extension=ftp.so at 612
    22. # Restart WebService


------------------------------------------------------181 of PHP source location in/root/software/php-5.3.6



Try installing a Xenforo forum on the above platform, prompting for the following information at the beginning of the installation: The following errors occurred while verifying that your server can run Xenforo: * The Req uired 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:



Install GD extension 1. Download the installation of the GD Library extension required source package (click the source package directly download) 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 code package 1 separately), install Zlib


    1. Tar zxvf zlib-1.2.3.tar.gz
    2. CD zlib-1.2.3
    3. ./configure
    4. Make
    5. Make install


2), install libpng


    1. Tar zxvf Libpng-1.5.0.tar.tar
    2. CD libpng-1.5.0
    3. CD scripts
    4. MV Makefile.linux. /makefile
    5. Cd..
    6. Make
    7. Make install


3), install FreeType


    1. Tar zxvf freetype-2.4.4.tar.gz
    2. CD freetype-2.4.4
    3. ./configure
    4. Make
    5. Make install


4), install JPEG


    1. Tar zxvf jpegsrc.v8b.tar.gz
    2. CD jpeg-8b
    3. ./configure–enable-shared
    4. Make
    5. Make Test
    6. Make install


Note that this configure must take the –enable-shared parameter, otherwise the shared library will not be generated.



5), install the GD library


    1. Tar zxvf gd-2.0.33.tar.gz
    2. CD gd-2.0.33
    3. ./configure–with-png–with-freetype–with-jpeg
    4. 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)


    1. ./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 you previously installed PHP:


    1. Make
    2. 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 the mysqli extension here to use the Phpize,phpize command is used to prepare the PHP Extension Library compilation environment, generally after the installation of 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 needs? You should see the Mysqli folder.


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


Executing phpize in the current directory


    1. [Root@jbxue mysqli]#/opt/php/bin/phpize
    2. Configuring for:
    3. PHP Api version:20090626
    4. Zend Modeule Api no:20090626
    5. Zend Extension Api no:220090626
    6. [Root@jbxue mysqli]#./configure–prefix=/opt/mysqli–with-php-config=/opt/php/bin/php-config–with-mysqli=/opt/ Mysql/bin/mysql_config
    7. [Root@jbxue mysqli] #make
    8. [Root@jbxue mysqli] #make Install


After the installation is complete, you will be prompted to expand the directory path, for example:/opt/php/lib/php/extensions/no-debug-zts-20090626 the required mysqli.so will be located in this directory.



Next, modify the php.ini file under/opt/php/etc/and add the mysqli extension:


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


Restart the Apache service and open the PHP information page again to see the mysqli entry.


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.