PHP extension (EXT) Compilation can be divided into two types: separate compilation and kernel compilation. the extension of compiling PHP separately has greatly improved the flexibility of PHP configuration. For example, you can compile the extension that does not need to be updated all the year round to the PHP kernel (such as GD and OpenSSL ), to update other extensions with a relatively higher update frequency (such as MySQL), you only need to re-compile the extension instead of re-compile the entire PHP. In theory, extending the compilation to the PHP kernel will bring a slight performance improvement, but you have to choose your own situation.
PHP installation directory:/usr/local/PHP/
Enter the directory of the module to be installed.
Use PHP's phpize tool,/usr/local/PHP/bin/phpize
Then use./configure -- With-PHP-Config =/var/PHP/bin/PHP-config
(If you have some special parameters to add, use./configure -- help to view them)
For separately compiled PHP extensions, you generally need to pass the-with-PHP-config parameter to the configure script to specify the path of the PHP-config file, the purpose of this file is to tell the extended configure script where to find PHP library files and development libraries. The following parameters are specified based on specific extensions. For xcache,
It is-enable-xcache and so on. For eaccelerator, it is-enable-eaccelerator and so on.
The Configure end is the two most familiar commands:
Then make Compilation
Compile make install.
After make install is complete, you will see similar output
Installing shared extensions:/usr/local/PhP5/lib/PHP/extensions/no-debug-non-zts-20060613/
Here I will tell you that the compiled xcache has been installed in the/usr/local/PhP5/lib/PHP/extensions/no-debug-non-zts-20060613/directory.
After compilation and installation, modify PHP. ini to load the extension.
Generally, opcache extensions such as xcache and eaccelerator are generally loaded in zend_extension mode, while others are loaded in normal extension mode, memcache curl soap zip FTP is common. The difference between the two is that the former needs to specify the absolute path of the extended so file during loading, and the latter needs to configure PHP first. extension_dir in ini (usually the directory output after make install), and then only enter the file name of the so file.
Then you need to open the extension in PHP. ini.
Extension = xxx. So
At the same time, pay attention to the extension_dir directory which requires you to install XXX. So.
========================================================== ========================================================== ======================================
The following describes how to install common modules.
1. memcache
CD memcache-2.5.5
/Usr/local/PhP5/bin/phpize
./Configure -- With-PHP-Config =/usr/local/PhP5/bin/PHP-config -- enable-memcache
Make
Make install
The compiled memcache. So is stored in the/usr/local/PhP5/lib/PHP/extensions/no-debug-non-zts-20060613/directory.
The next step is to let PHP load this extension, edit your php. ini, and add the following lines in the appropriate location (usually the last, or an independent INI file:
Extension = memcache. So
========================================================== ========================================================== ======================================
2. eaccelerator
1. Introduction to PhP accelerator eaccelerator;
Eaccelerator is a free and open source PHP accelerator. It optimizes and dynamically caches content, improves the cache performance of PHP scripts, and enables PHP scripts to be compiled, the server overhead is almost completely eliminated. It also optimizes scripts to accelerate execution efficiency. Improve the code execution efficiency of your PHP program by 1-10 times;
Official homepage: http://eaccelerator.net
2. installation and configuration;
First, you must install PHP and then compile and install eaccelerator. The process is as follows:
2.1 compile and install;
# Tar xvf eaccelerator-0.9.5.2.tar.bz2
# Cd eaccelerator-0.9.5.2
#/Usr/local/PHP/bin/phpize
#./Configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- enable-eaccelerator = shared
# Make
# Make install
# Ldconfig
Note: update the dynamic link library address;
Zend_extension = "/usr/local/PhP5/lib/PHP/extensions/no-debug-non-zts-20060613/eaccelerator. So" NOTE: the specific position of the module;
Eaccelerator. shm_size = "16" NOTE: shared memory size;
Eaccelerator. cache_dir = "/dev/SHM" NOTE: cache directory;
Eaccelerator. Enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. DEBUG = "0"
Eaccelerator. Filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. Compress = "1"
Eaccelerator. compress_level = "9"
Zip Extension
Go to the source code directory for installing the original PHP,
CD ext
CD zip
Phpize
./Configure
Make
The zip. So file is generated under phpdir/EXT/zip/modules.
Copy the zip. So file to the configuration directory of extensions and modify PHP. ini.
Soap Extension
Go to the source code directory for installing the original PHP,
CD ext
CD soap
Phpize
./Configure
Make
The file soap. So is generated under phpdir/EXT/soap/modules.
Copy the soap. So file to the configuration directory of extensions and modify PHP. ini.