The way PHP extensions are installed is usually divided into two types:
1. Compile with PHP
2. Create a separate. so file
The second approach is described here, which may be less efficient for the second approach, but modular, that is, the ability to keep the PHP installation intact, extending through the php.ini connection to a separate so file,
For example, if you have already installed PHP with the TAR package, you now want to increase the extension:
Installing the Curl Extension
I. Generate a dynamic link library file. So
Here's how:
Method 1. Apt-get Install Php5-curl
Method 2. Go to the PHP Web site to download the tar package, phpize local build.
Method 3. Pear mode installation, through the pecl command to download the compilation generated online.
Method 1 is the simplest under Ubuntu, which tells you when the command is complete. So directory
II. Configuring PHP.ini
Open PHP.ini, specify the Extension_dir directory, and if Extension_dir = '/usr/lib ', then copy the resulting. So file (such as curl.so) to the/usr/lib directory and add a new entry:
Extension=curl.so
III. Making it effective
Restart Apache, run phpinfo () to see if it takes effect
Installing the Pdo_mysql Extension
Installation with Pear method
I. Installing the Pear
Apt-get Install Php-pear If you don't have pear, you'll need to set up pear
II. Installing the Pdo,pdo_mysql
PECL Install PDO pecl install Pdo_mysql
Generate. So to replicate to the/usr/lib directory.
If you do not have a PHP and MySQL development package installed, you will need to install it before Step II
Apt-get Install Php5-devapt-get Install Libmysqlclient15-dev
Iii. Modifying the configuration file php.ini
Add entry
Extension=pdo.so
Extension=pdo_mysql.so
Iv. making it effective
Restart Apache, run phpinfo () to see if it takes effect
In php5.2.10, PHP has already installed the PDO by default, so extension=pdo.so does not add, but finds that it does not match its own generated pdo_mysql.so error, the solution is:
Reinstall PHP, add parameters--disable-pdo prohibit PDO module, with your own front generated pdo.so,pdo+mysql.so is OK
Installing the Imagemagic Extension
Installation with Pear method
I. Installing the ImageMagick
sudo apt-get install ImageMagick
II. Installing the ImageMagick lib for PHP calls
sudo apt-get install Libmagick++-dev
III. Call the current PECL installation Imagick
PECL Install Imagick
Iv. modifying php.ini. Restarting the Apache server
Added in php.ini: extension = imagick.so
Installation of Phpize
Phpize is a content that belongs to Php-devel, so just run
Apt-get install Php-devel on the line. Under Ubuntu is apt-get install Php-dev
When I installed it, it was php5-dev.
After loading, I used phpize5 to install the PHP extension that I wrote.