Apache and PHP dynamic load modules

Source: Internet
Author: User

How to dynamically add Apache and PHP modules


One. Apache Dynamic Add Module:

Cd/home/redhat/httpd-2.2.15/modules/filters

/usr/local/ Apache2/bin/apxs-i-c-a mod_deflate.c

apxs Command parameter Description: BR style= "Padding:0px;margin:0px;color:rgb (51,51,51); font-family:arial, Helvetica, SimSun, U5b8bu4f53;line-height : 25px; " >-i  This option indicates the need to perform an installation operation to install one or more dynamic shared objects into the server's modules directory.
-a  This option automatically adds a loadmodule line to the httpd.conf file to activate the module, or, if this line already exists, enable it.
-a  is similar to the-a option, but its added loadmodule command has a pound sign prefix (#), which means that the module is ready but not yet enabled.
-c  This option indicates the need to perform a compilation operation. It first compiles the C source program (. c) files for the corresponding target code file (. o), and then connects the target code with the rest of the target code files (. O and. A) in file, to generate the dynamic shared object Dsofile. If you do not specify the-o option, the output file name is inferred from the first file name in files, which is the default of mod_name.so.

Restart Effective:/usr/local/apache2/bin/apachectl restart


Two. PHP Dynamic Add module:

To add the Memcache module as an example,

wget http://pecl.php.net/get/memcache-3.0.8.tgz

Tar zxf memcache-3.0.8.tgz

CD memcache-3.0.8

/usr/local/php/bin/phpize #通过phpize添加php扩展插件

./configure--with-php-config=/usr/local/php/bin/php-config

Make && make install

ls/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/#查看是否有memcache. So file

Configuration php.ini:

Cd/usr/local/php/lib

CP php.ini Php.ini.bak #备份配置文件

Vim php.ini search Extension_dir, add plugin path/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/in the back, note php.ini comments identifier The shelf must be removed after removing the comment.

and add a line extension = memcache.so

KILL-SIGUSR2 ' cat/app/logs/php-fpm.pid ' (Nginx smooth restart PHP in effect)

Finally view the Phpinfo page, search for memcache, if any, indicate the installation is successful.



This article is from the "Linux operation and Maintenance" blog, reproduced please contact the author!

Apache and PHP dynamic load modules

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.