Linux PHP compilation and generation extension and Configuration Modification

Source: Internet
Author: User
Tags php source code tidy zts

We recommend a very good Linux PHP system with great learning value. Here I will mainly explain the application of the Linux PHP system, including introducing the knowledge of Linux PHP. After the server runs for a period of time, it may suddenly need to add an extension, such as curl, pdo, and xmlrpc. This requires you to add the extension independently without re-compiling Linux PHP. The following describes how to install curl and tidy.

1. Install crul

 
 
  1. wget http://curl.haxx.se/download/curl-7.19.6.tar.gz  
  2. tar -zxvf curl-7.19.6.tar.gz  
  3. cd curl-7.19.6  
  4. ./configure --prefix=/usr/local/curl  
  5. make  
  6. make install 

2. Linux PHP compilation and generation Extension

Go to the ext directory in the Linux PHP source code directory, where the source code of each extension module is stored. Select the required module, such as the curl module: cd curl, and run phpize to generate the compilation file, phpize may report the following error when running/usr/local/php5/bin/phpize in the bin directory of the PHP installation directory: Cannot find autoconf. please check your autoconf installation and the $ PHP_AUTOCONF, environment variable is set correctly and then rerun this script. ", you need to install autoconf: yum install autoconfRedHat or CentOS), apt-get install autoconfUbuntu Linux)

Generate a configuration file and compile and generate a module for Linux PHP:

 
 
  1. /usr/local/php5/bin/phpize  
  2. ./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php5/bin/php-config  
  3. make  
  4. make install 

In this way, curl. so is copied to the PHP Directory such as:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626 /)

3. modify the configuration in Linux PHP

In Linux PHP. in ini, set the extension Directory: extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/" and add extension module reference: extension = curl. so

4. Check and restart Apache

When executing this command in/usr/local/php/bin/php-v, Linux PHP checks whether the configuration file is correct. If any configuration error occurs, an error is returned, you can troubleshoot the problem based on the error information. Install the tidy extension in this way.

However, the libtidy installation package is relatively verified and downloaded at the following address. The installation method is the same:
# Tar zxvf tidy-cvs_20070326.tar.bz2
# Cd tidy-cvs_20070326
#./Configure -- prefix =/usr/local/tidy
# Make
# Make install

  1. Ubuntu Linux is more powerful, faster, and better
  2. Update list of Linux yum installation package
  3. High-performance servers and monitoring required for Linux System Administrators
  4. Linux memory usage view unit display
  5. Build a powerful Linux SVN Control System

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.