Use php to install the gd library and phpize

Source: Internet
Author: User
Tags zts xenforo
Use php to install the gd library and phpize

  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

2. phpize1, what is phpizephpize, which is used to expand the php Extension Module. phpize can be used to establish a php plug-in module.

When installing php, you need to use 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 you need to add some modules and do not want to re-compile php. in this case, you can use phpize to help the plug-in module.

2. how to use phpize? After php compilation is complete, the php bin directory contains the phpize script file. Run the following phpize command before compiling the extension module to be added;

  1. # If you forget to add some modules during compilation, you can use this method to re-compile and add them!
  2. # First, go to the PHP Directory (uncompiled) 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. Processing ING:
  8. PHP Api Version: 20041225
  9. Zend Module Api No: 20060613
  10. Zend Extension Api No: 220060519
  11. # Compile the extension Library
  12. /Configure-with-php-config =/usr/local/php/bin/php-config
  13. Make
  14. # After make is successfully executed, the generated extension library file is in the modules subdirectory of the current directory.
  15. # Edit the php. ini file, locate the extension_dir directory, and copy the compiled extension file to the extension directory.
  16. Vim/usr/local/php/etc/php. ini
  17. # 491st rows
  18. # Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613 /"
  19. Cp ftp. so/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
  20. # Add The Extension Library location in php. ini and set the extension library to be added.
  21. # Add extension = ftp. so in section 612
  22. # Restart webservice

------------------------------------------------------ 181 php source code location in/root/software/php-5.3.6

Try to install a Xenforo forum on The above platform. The following message is displayed at The beginning of installation: The following errors occurred while verifying that your server can run XenForo: * The required PHP extension MySQLi cocould not be found. please ask your host to install this extension. * The required PHP extension GD cocould not be found. please ask your host to install this extension.

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

1. install GD extension 1. download and install GD Library extension source package (can click the source package to download directly) gd-2.0.35.tar.gz http://www.libgd.org/releases/ src.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/

2. Compile and install the source code packages respectively. 1) 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 configure must include 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, re-compile and install PHP (that is, in the previous PHP compilation parameters followed by the above installation parameters) cd php-5.3.4 (into the previous PHP source code 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- -jpeg-with-freetype-enable-sockets

The green font part is the parameter previously added when installing PHP:

  1. Make
  2. Make install

In this way, the GD Library extension is installed. restart Apache and check the PHP information test page to view the gd items;

2. install the MySQLi extension. here you need to use phpize. the phpize command is used to prepare the PHP Extension library compiling environment. generally, after installing PHP, the command is found in the bin directory where PHP is installed. If a prompt such as autoconf cannot be found after the phpize command is executed, install autoconf and execute it again. The directory path of the following command, please make changes according to the actual situation of your system. The EXT folder in the PHP source package folder contains the available extensions of the current version. What are the requirements of CD? The mysqli folder is displayed.

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

Run phpize in the current directory

  1. [Root @ jbxue mysqli] #/opt/php/bin/phpize
  2. Processing ING:
  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 extend the directory path, for example:/opt/php/lib/php/extensions/mysqli. so required by the no-debug-zts-20090626 will be under 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 view the MySQLi item.

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.