Home Backend Development PHP Tutorial debian停安装php的一些扩展geoip,mongo,redis,libevent,proctitle,inotify,pcntl

debian停安装php的一些扩展geoip,mongo,redis,libevent,proctitle,inotify,pcntl

Jun 13, 2016 pm 12:35 PM
etc ini pcntl php

debian下安装php的一些扩展geoip,mongo,redis,libevent,proctitle,inotify,pcntl

因为项目的关系,需要安装一些新的扩展

debian xfce 7.2 x86   下面3个都是通过apt-get安装的。

PHP 5.4.4-14+deb7u5 (cli)

nginx1.2.1

apache 2.2.22

1: 通过默认的方法安装(最优),大部分常用的都在debian的仓库里面,可以下载到  注意,#是代表root 可通过su - 输入密码后进入root

#apt-get install php5-geoip
#apt-get install php-apc
#apt-get install libevent-dev
Copy after login

2:通过pecl 安装(其次)

#pecl install mongo
#pecl install channel://pecl.php.net/libevent-0.1.0
#pecl install channel://pecl.php.net/proctitle-0.1.2
#pecl install inotify
Copy after login


pecl 安装完后,需要做几个事情,一个是把 对应的so文件加到对应的ini,其次是把ini链接到conf.d

比如上面的3个扩展,pecl后 

在debian的

/usr/lib/php5/20100525/mongo.so
/usr/lib/php5/20100525/libevent.so
/usr/lib/php5/20100525/proctitle.so
/usr/lib/php5/20100525/inotify.so
Copy after login

php5在/etc/php5 执行下面的shell命名,这是建立一些配置文件,debian的php的php.ini 把配置文件分散到了/etc/php5/conf.d, 而conf.d 的内容都来自/etc/php5/mods-available/ 为了debian包的严谨,我们这里就作两次链接,而不是直接去conf.d 建对应的.ini 文件.


#echo "extension=mongo.so" > /etc/php5/mods-available/mongo.ini
#echo "extension=libevent.so" > /etc/php5/mods-available/libevent.ini
#echo "extension=proctitle.so" > /etc/php5/mods-available/proctitle.ini
#echo "extension=inotify.so" > /etc/php5/mods-available/inotify.ini
#ln -s /etc/php5/mods-available/mongo.ini /etc/php5/conf.d/mongo.ini
#ln -s /etc/php5/mods-available/libevent.ini /etc/php5/conf.d/libevent.ini
#ln -s /etc/php5/mods-available/proctitle.ini /etc/php5/conf.d/proctitle.ini
#ln -s /etc/php5/mods-available/inotify.ini /etc/php5/conf.d/inotify.ini
Copy after login

重启下nginx的php5-fcgi or apache,可以看到这些模块已经加载成功

3:通过扩展的源码安装(编译安装,对于debian不是很推荐,前提是仓库没有) 安装的是php-redis 扩展

(redis server需要你自己安,编译的环境这些软件参考我前面的文章安装就行了,gcc之类的

#wget https://redis.googlecode.com/files/redis-2.6.14.tar.gz
#tar -zxvf redis
#make
Copy after login

#tar -zxvf nicolasff-phpredis-2.1.3-124-gd4ad907.tar.gz
#cd nicolasff-phpredis-00233a3
#phpize
#./configure --with-php-config=/usr/bin/php-config
#echo "extension=redis.so" > /etc/php5/mods-available/redis.ini
#ln -s /etc/php5/mods-available/redis.ini /etc/php5/conf.d/redis.ini
Copy after login

同上,需要重启server


4:通过php源码安装(开关某些php默认安装了但是关闭的扩展,这里我们要开启的是pcntl)

#mkdir php
#cd php
#apt-get source php5
Copy after login

  这里我们进去 php5-(版本号)/ext/pcntl 

#cd php5-5.4.4/ext/pcntl
#phpize
#./configure
#make
#echo "extension=pcntl.so" > /etc/php5/mods-available/pcntl.ini
#ln -s /etc/php5/mods-available/pcntl.ini /etc/php5/conf.d/pcntl.ini
Copy after login

同上,重启server就可以了


如果php报错,

PHP Warning: Module ‘pcntl’ already loaded in Unknown on line 0

那就说明已经装上了,现在是重复装的,需要把上面添加的两个pcntl.ini文件删除掉。 然后去把php.ini 文件里面的

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

; 注释掉。重启server就可以了, 注意,php.ini 在apache2,nginx里面都不同的, apache2的在/etc/php5/apache2/php.ini  nginx我指定的是cgi里面的/etc/php5/cgi/php.ini 

看你server用的哪个,就去注释掉哪个就可以了

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles